From 78e93902622d63f2ab265a7dbf0499bd82b9969c Mon Sep 17 00:00:00 2001 From: Will Baumgartner Date: Wed, 19 Jun 2024 17:57:28 -0400 Subject: [PATCH] Fixe base class identification For previous classes with custom blocks, like SimpleCharacter, you had to define a method that specified the base class so the picker would know which blocks to populate itself with. However, there is a function script.get_instance_base_type() that gets this automatically from whichever class the script extends. Much nicer than having to define a function for this every time. This change also fixes an error when opening the pong game. --- .../simple_nodes/simple_character/simple_character.gd | 4 ---- addons/block_code/ui/picker/picker.gd | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) 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 829186a0..5b4de358 100644 --- a/addons/block_code/simple_nodes/simple_character/simple_character.gd +++ b/addons/block_code/simple_nodes/simple_character/simple_character.gd @@ -13,10 +13,6 @@ func get_custom_class(): return "SimpleCharacter" -static func get_base_class(): - return "CharacterBody2D" - - static func get_exposed_properties() -> Array[String]: return ["position"] diff --git a/addons/block_code/ui/picker/picker.gd b/addons/block_code/ui/picker/picker.gd index 99cfdf72..803d6698 100644 --- a/addons/block_code/ui/picker/picker.gd +++ b/addons/block_code/ui/picker/picker.gd @@ -25,7 +25,7 @@ func bsd_selected(bsd: BlockScriptData): var parent_class: String if found_simple_class_script: - parent_class = found_simple_class_script.get_base_class() + parent_class = str(found_simple_class_script.get_instance_base_type()) else: # Built in parent_class = bsd.script_inherits