From 80317f3098c4a237e12bf50986d51f340f43a33c Mon Sep 17 00:00:00 2001 From: Will Baumgartner Date: Thu, 27 Jun 2024 14:39:48 -0400 Subject: [PATCH] Fix Simple node setup not happening Any Simple node like SimpleCharacter will have its _ready overwritten by the block script if a ready block exists. This enables setup for the Simple node to still happen regardless. --- addons/block_code/block_code_node/block_code.gd | 4 ++++ .../simple_nodes/simple_character/simple_character.gd | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/addons/block_code/block_code_node/block_code.gd b/addons/block_code/block_code_node/block_code.gd index 9fdf4fe0..8c2b867f 100644 --- a/addons/block_code/block_code_node/block_code.gd +++ b/addons/block_code/block_code_node/block_code.gd @@ -60,6 +60,10 @@ func _update_parent_script(): for property_name in persist_properties: parent.set(property_name, persist_properties.get(property_name)) + # Run simple setup after node is ready + if parent.has_method("simple_setup"): + parent.call_deferred("simple_setup") + func _get_configuration_warnings(): var warnings = [] diff --git a/addons/block_code/simple_nodes/simple_character/simple_character.gd b/addons/block_code/simple_nodes/simple_character/simple_character.gd index fbecbcff..1b488fd2 100644 --- a/addons/block_code/simple_nodes/simple_character/simple_character.gd +++ b/addons/block_code/simple_nodes/simple_character/simple_character.gd @@ -19,6 +19,10 @@ func _set_texture(new_texture): func _ready(): + simple_setup() + + +func simple_setup(): _set_texture(texture)