<?xml version="1.0" encoding="UTF-8" ?>
<class name="LimboHSM" inherits="LimboState" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd">
	<brief_description>
		Event-based Hierarchical State Machine (HSM).
	</brief_description>
	<description>
		Event-based Hierarchical State Machine (HSM) that manages [LimboState] instances and facilitates transitions between them. LimboHSM is a [LimboState] in itself and can also serve as a child of another LimboHSM node.
	</description>
	<tutorials>
	</tutorials>
	<methods>
		<method name="add_transition">
			<return type="void" />
			<param index="0" name="from_state" type="LimboState" />
			<param index="1" name="to_state" type="LimboState" />
			<param index="2" name="event" type="StringName" />
			<param index="3" name="guard" type="Callable" default="Callable()" />
			<description>
				Establishes a transition from one state to another when [param event] is dispatched. Both [param from_state] and [param to_state] must be immediate children of this [LimboHSM].
				Optionally, a [param guard] function can be specified, which must return a boolean value. If the guard function returns [code]false[/code], the transition will not occur. The guard function is called immediately before the transition is considered. For a state-wide guard function, check out [method LimboState.set_guard].
				[codeblock]
				func my_guard() -&gt; bool:
				    return is_some_condition_met()
				[/codeblock]
			</description>
		</method>
		<method name="change_active_state">
			<return type="void" />
			<param index="0" name="state" type="LimboState" />
			<description>
				Changes the currently active substate to [param state]. If [param state] is already active, it will be exited and reentered.
				[param state] must be a child of this [LimboHSM].
			</description>
		</method>
		<method name="get_active_state" qualifiers="const">
			<return type="LimboState" />
			<description>
				Returns the currently active substate.
			</description>
		</method>
		<method name="get_leaf_state" qualifiers="const">
			<return type="LimboState" />
			<description>
				Returns the currently active leaf state within the state machine.
			</description>
		</method>
		<method name="get_previous_active_state" qualifiers="const">
			<return type="LimboState" />
			<description>
				Returns the previously active substate.
			</description>
		</method>
		<method name="has_transition" qualifiers="const">
			<return type="bool" />
			<param index="0" name="from_state" type="LimboState" />
			<param index="1" name="event" type="StringName" />
			<description>
				Returns [code]true[/code] if there is a transition from [param from_state] for a given [param event].
			</description>
		</method>
		<method name="initialize">
			<return type="void" />
			<param index="0" name="agent" type="Node" />
			<param index="1" name="parent_scope" type="Blackboard" default="null" />
			<description>
				Initiates the state and calls [method LimboState._setup] for both itself and all substates.
			</description>
		</method>
		<method name="remove_transition">
			<return type="void" />
			<param index="0" name="from_state" type="LimboState" />
			<param index="1" name="event" type="StringName" />
			<description>
				Removes a transition from a state associated with specific [param event].
			</description>
		</method>
		<method name="set_active">
			<return type="void" />
			<param index="0" name="active" type="bool" />
			<description>
				When set to [code]true[/code], switches the state to [member initial_state] and activates state processing according to [member update_mode].
			</description>
		</method>
		<method name="update">
			<return type="void" />
			<param index="0" name="delta" type="float" />
			<description>
				Calls [method LimboState._update] on itself and the active substate, with the call cascading down to the leaf state. This method is automatically triggered if [member update_mode] is not set to [constant MANUAL].
			</description>
		</method>
	</methods>
	<members>
		<member name="ANYSTATE" type="LimboState" setter="" getter="anystate">
			Useful for defining a transition from any state.
		</member>
		<member name="initial_state" type="LimboState" setter="set_initial_state" getter="get_initial_state">
			The substate that becomes active when the state machine is activated using the [method set_active] method. If not explicitly set, the first child of the LimboHSM will be considered the initial state.
		</member>
		<member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="LimboHSM.UpdateMode" default="1">
			Specifies when the state machine should be updated. See [enum UpdateMode].
		</member>
	</members>
	<signals>
		<signal name="active_state_changed">
			<param index="0" name="current" type="LimboState" />
			<param index="1" name="previous" type="LimboState" />
			<description>
				Emitted when the currently active substate is switched to a different substate.
			</description>
		</signal>
	</signals>
	<constants>
		<constant name="IDLE" value="0" enum="UpdateMode">
			Update the state machine during the idle process.
		</constant>
		<constant name="PHYSICS" value="1" enum="UpdateMode">
			Update the state machine during the physics process.
		</constant>
		<constant name="MANUAL" value="2" enum="UpdateMode">
			Manually update the state machine by calling [method update] from a script.
		</constant>
	</constants>
</class>