Bug seemingly fixed by duplicating states per state machine. More testing needed.

This commit is contained in:
Dustin 2025-04-12 14:56:53 -07:00
parent 45cff3f039
commit f67fdbbe3e

View File

@ -36,14 +36,15 @@ func _ready():
#check for unique state name #check for unique state name
if !(states_index.has(this_state.name)): if !(states_index.has(this_state.name)):
# call setup # call setup
this_state.setup() var dupe_state = this_state.duplicate()
dupe_state.setup()
if debug_state_machine: if debug_state_machine:
print("Initializing State Node: ", s) print("Initializing State Node: ", s)
this_state.debug_state = true dupe_state.debug_state = true
if this_state.state_timeout != null: if dupe_state.state_timeout != null:
add_child(this_state.state_timeout) add_child(dupe_state.state_timeout)
# Add to state index # Add to state index
states_index[this_state.name] = this_state states_index[dupe_state.name] = dupe_state
else: else:
push_error("Multiple states with same name in: ") push_error("Multiple states with same name in: ")
else: else: