Skip to content

Add blockcode warnings #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading