godot-finite-state-machine icon indicating copy to clipboard operation
godot-finite-state-machine copied to clipboard

Passing messages between states

Open aclave1 opened this issue 4 years ago • 0 comments

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.

aclave1 avatar Jun 28 '20 20:06 aclave1