Skip to content

Commit

Permalink
Merge pull request #119 from endlessm/add-blockcode-warnings
Browse files Browse the repository at this point in the history
Add blockcode warnings
  • Loading branch information
wnbaum authored Jul 5, 2024
2 parents 4e75147 + 7a9ee11 commit b7cbac1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions addons/block_code/block_code_node/block_code.gd
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ func _update_parent_script():

func _get_configuration_warnings():
var warnings = []
if self.owner == null:
warnings.append("A BlockCode must not be a root node.")
if get_parent() is BlockCode:
warnings.append("The parent must not be a BlockCode.")
if get_parent().find_children("*", "BlockCode", false).size() > 1:
warnings.append("The parent should only contain one BlockCode.")
if block_script and _get_custom_or_native_class(get_parent()) != block_script.script_inherits:
var warning = "The parent is not a %s. Create a new BlockCode node and reattach." % block_script.script_inherits
warnings.append(warning)
Expand Down

0 comments on commit b7cbac1

Please sign in to comment.