forked from team-sg/hero-mark-2
statecharts ehehehehehe
This commit is contained in:
parent
4d59717b88
commit
6eff1601a9
23 changed files with 895 additions and 2 deletions
23
addons/godot_state_charts/atomic_state.gd
Normal file
23
addons/godot_state_charts/atomic_state.gd
Normal file
|
@ -0,0 +1,23 @@
|
|||
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 ""
|
Loading…
Add table
Add a link
Reference in a new issue