hero-mark-2/addons/godot_state_charts/atomic_state.gd

23 lines
735 B
GDScript

tool
class_name AtomicState, "atomic_state.svg"
extends State
func _handle_transition(transition: Transition, source: State) -> void:
# resolve target state
var target = transition.resolve_target()
if not target is State:
push_error("the target state: %s of transition from state: %s is not a state" % [str(transition.to), source.name])
return
# atomic states can't transition, gotta ask mommy
get_parent()._handle_transition(transition, source)
func _get_configuration_warning() -> String:
var warning := ._get_configuration_warning()
if not warning.empty():
return warning
for child in get_children():
if not child is Transition:
return "atomic states cannot have children other than transitions"
return ""