summaryrefslogtreecommitdiff
path: root/addons/escoria-core/patterns
diff options
context:
space:
mode:
authorradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
committerradiohotline <radoihotline@disroot.rg>2026-08-25 16:33:56 +0300
commita89e744ed0e8c759caf041a580112365bbfe4303 (patch)
treedd61e320904176995727e86a857d00c90d4933ba /addons/escoria-core/patterns
parent6d53d8cac78250dc888aa49d5f9d4175c6652feb (diff)
escoria updateHEADmain
Diffstat (limited to 'addons/escoria-core/patterns')
-rw-r--r--addons/escoria-core/patterns/state_machine/state.gd2
-rw-r--r--addons/escoria-core/patterns/state_machine/state_machine.gd17
2 files changed, 10 insertions, 9 deletions
diff --git a/addons/escoria-core/patterns/state_machine/state.gd b/addons/escoria-core/patterns/state_machine/state.gd
index cfa9e0f..0d28ac2 100644
--- a/addons/escoria-core/patterns/state_machine/state.gd
+++ b/addons/escoria-core/patterns/state_machine/state.gd
@@ -1,5 +1,5 @@
-extends Node
class_name State
+extends Node
## Base interface for all states.
##
## This class doesn't do anything in itself but forces us to pass the right
diff --git a/addons/escoria-core/patterns/state_machine/state_machine.gd b/addons/escoria-core/patterns/state_machine/state_machine.gd
index 2fa5d96..95a3e64 100644
--- a/addons/escoria-core/patterns/state_machine/state_machine.gd
+++ b/addons/escoria-core/patterns/state_machine/state_machine.gd
@@ -1,5 +1,5 @@
-extends Node
class_name StateMachine
+extends Node
## Base interface for a generic state machine
## It handles initializing, setting the machine active or not
## delegating _physics_process, _input calls to the State nodes,
@@ -15,9 +15,9 @@ class_name StateMachine
## [br]
signal state_changed(current_state)
-## Starting state. This node has to be set *before* the initialize(START_STATE)
+## Starting state. This node has to be set *before* the initialize(start_state)
## command is called.
-var START_STATE: Node
+var start_state: Node
## List of states
var states_map = {}
@@ -48,13 +48,14 @@ var _active = false:
## [br]
## Returns nothing.
func initialize(start_state: State):
- if START_STATE == null:
+ if start_state == null:
escoria.logger.error(
self,
- "Starting state is required to be initialized with a defined state,
- but it is null. Escoria cannot determine which of the defined states
- (in states_map dictionary) is supposed to be the starting one.
- Please assign a state to START_STATE in your implementation of the StateMachine class.")
+ "Starting state is required to be initialized with a defined state," + \
+ "but it is null. Escoria cannot determine which of the defined states" + \
+ "(in states_map dictionary) is supposed to be the starting one." + \
+ "Please assign a state to start_state in your implementation of the StateMachine class.")
+ return
for child in get_children():
child.connect("finished", Callable(self, "_change_state"))