godot-finite-state-machine
godot-finite-state-machine copied to clipboard
Passing messages between states
Hey again @brandonlamb. I'm testing out this lib and I'd like to propose a feature. In the past, I've used the implementation from gdquest's godot-3d-mannequin
In gdquest's implementation, transition takes 2 parameters:
transition_to(target_state_path: String, msg: Dictionary = {})
This allows one state to pass data to another state during the transition. In the past, I've used this for transitioning from idle-> move_to like:
fsm.transition("move",{"position":pos})
class Move:
func _on_enter_state(msg:={}):
var pos = msg.position
Does this functionality seem useful for this library? It wouldn't be difficult to add this functionality and we can do so without breaking the existing API. If so, I can submit a PR.