add useful debug info and assertion

This commit is contained in:
yuki 2025-11-14 22:22:50 -03:00
parent 77a6bea4d6
commit 43500b3ca5

View file

@ -38,6 +38,12 @@ func _get_initial_state() -> State:
## Transitions the active state out after receiving a finished signal. ## Transitions the active state out after receiving a finished signal.
func _transition_to_next_state(target_state_path: String, data: Dictionary = {}) -> void: func _transition_to_next_state(target_state_path: String, data: Dictionary = {}) -> void:
print("+++ TRANSITION CALLED: ", target_state_path)
print("+++ Has node? ", has_node(target_state_path))
print("+++ All children: ", get_children().map(func(c: Node) -> StringName: return c.name))
assert(has_node(target_state_path), owner.name + ": Trying to transition to state " + target_state_path + " but it does not exist.")
if not has_node(target_state_path): if not has_node(target_state_path):
printerr(owner.name + ": Trying to transition to state " + target_state_path + " but it does not exist.") printerr(owner.name + ": Trying to transition to state " + target_state_path + " but it does not exist.")
return return