163 lines
11 KiB
Plaintext
163 lines
11 KiB
Plaintext
<460> A base class for LimboAI typed parameters.
|
||
<461> A base class for LimboAI typed parameters, with the ability to reference a <l1>Blackboard</l> variable or hold a raw value of a specific Variant.Type.
|
||
<462> <b>Note</b>: Don’t instantiate. Use specific subtypes instead.
|
||
<463> <l1>saved_value</l>
|
||
<464> <l1>ValueSource</l>
|
||
<465> <l1>value_source</l>
|
||
<466> <l1>variable</l>
|
||
<467> Variant.Type
|
||
<468> <l1>get_type</l>() <2/>
|
||
<469> <l1>get_value</l>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null)
|
||
<470> enum <b>ValueSource</b>: <l1>🔗</l>
|
||
<471> <l1>ValueSource</l> <b>SAVED_VALUE</b> = <2/>
|
||
<472> The value is stored directly within the BBParam resource.
|
||
<473> <l1>ValueSource</l> <b>BLACKBOARD_VAR</b> = <2/>
|
||
<474> The value is referenced by a variable name and retrieved from the <l1>Blackboard</l>. The variable name is stored within the BBParam resource.
|
||
<475> <1/> <b>saved_value</b> = <2/> <l3>🔗</l>
|
||
<476> <1/> <b>set_saved_value</b>(value: <2/>)
|
||
<477> <1/> <b>get_saved_value</b>()
|
||
<478> Stores the parameter value when <l1>value_source</l> is set to <l2>SAVED_VALUE</l>. The data type of the value is determined by <l3>get_type</l>.
|
||
<479> <l1>ValueSource</l> <b>value_source</b> = <2/> <l3>🔗</l>
|
||
<480> <1/> <b>set_value_source</b>(value: <l2>ValueSource</l>)
|
||
<481> <l1>ValueSource</l> <b>get_value_source</b>()
|
||
<482> Specifies the source of the value for BBParam. See <l1>ValueSource</l>.
|
||
<483> <1/> <b>variable</b> <l2>🔗</l>
|
||
<484> <1/> <b>set_variable</b>(value: <2/>)
|
||
<485> <1/> <b>get_variable</b>()
|
||
<486> Stores the name of a <l1>Blackboard</l> variable when <l2>value_source</l> is set to <l3>BLACKBOARD_VAR</l>.
|
||
<487> Variant.Type <b>get_type</b>() <1/> <l2>🔗</l>
|
||
<488> Returns the expected data type of the parameter.
|
||
<489> <1/> <b>get_value</b>(scene_root: <2/>, blackboard: <l3>Blackboard</l>, default: <4/> = null) <l5>🔗</l>
|
||
<490> Returns the value of the parameter.
|
||
<491> LimboState
|
||
<492> <b>Inherited By:</b> <l1>BTState</l>, <l2>LimboHSM</l>
|
||
<493> A state node for Hierarchical State Machines (HSM).
|
||
<494> A LimboAI state node for Hierarchical State Machines (HSM).
|
||
<495> You can create your state behavior by extending this class. To implement your state logic, you can override <l1>_enter</l>, <l2>_exit</l>, <l3>_setup</l>, and <l4>_update</l>. Alternatively, you can delegate state implementation to external methods using the <5/> methods.
|
||
<496> For additional details on state machines, refer to <l1>LimboHSM</l>.
|
||
<497> <l1>EVENT_FINISHED</l>
|
||
<498> <l1>agent</l>
|
||
<499> <l1>blackboard</l>
|
||
<500> <l1>blackboard_plan</l>
|
||
<501> <l1>_enter</l>() <2/>
|
||
<502> <l1>_exit</l>() <2/>
|
||
<503> <l1>_setup</l>() <2/>
|
||
<504> <l1>_update</l>(delta: <2/>) <3/>
|
||
<505> <l1>add_event_handler</l>(event: <2/>, handler: <3/>)
|
||
<506> <l1>LimboState</l>
|
||
<507> <l1>call_on_enter</l>(callable: <2/>)
|
||
<508> <l1>call_on_exit</l>(callable: <2/>)
|
||
<509> <l1>call_on_update</l>(callable: <2/>)
|
||
<510> <l1>clear_guard</l>()
|
||
<511> <l1>dispatch</l>(event: <2/>, cargo: <3/> = null)
|
||
<512> <l1>get_root</l>() <2/>
|
||
<513> <l1>is_active</l>() <2/>
|
||
<514> <l1>named</l>(name: <2/>)
|
||
<515> <l1>set_guard</l>(guard_callable: <2/>)
|
||
<516> <b>entered</b>() <l1>🔗</l>
|
||
<517> Emitted when the state is entered.
|
||
<518> <b>exited</b>() <l1>🔗</l>
|
||
<519> Emitted when the state is exited.
|
||
<520> <b>setup</b>() <l1>🔗</l>
|
||
<521> Emitted when the state is initialized.
|
||
<522> <b>updated</b>(delta: <1/>) <l2>🔗</l>
|
||
<523> Emitted when the state is updated.
|
||
<524> <1/> <b>EVENT_FINISHED</b> <l2>🔗</l>
|
||
<525> <1/> <b>event_finished</b>()
|
||
<526> A commonly used event that indicates that the state has finished its work.
|
||
<527> <1/> <b>agent</b> <l2>🔗</l>
|
||
<528> An agent associated with the state, assigned during initialization.
|
||
<529> <l1>Blackboard</l> <b>blackboard</b> <l2>🔗</l>
|
||
<530> A key/value data store shared by states within the state machine to which this state belongs.
|
||
<531> <l1>BlackboardPlan</l> <b>blackboard_plan</b> <l2>🔗</l>
|
||
<532> <1/> <b>_enter</b>() <2/> <l3>🔗</l>
|
||
<533> Called when the state is entered.
|
||
<534> <1/> <b>_exit</b>() <2/> <l3>🔗</l>
|
||
<535> Called when the state is exited. This happens on a transition to another state, and when the state machine is removed from the scene tree (e.g., when the node is freed with Node.queue_free or the scene changes). Due to implementation details, <l1>_exit</l> will not be called on Object.free!
|
||
<536> <1/> <b>_setup</b>() <2/> <l3>🔗</l>
|
||
<537> Called once during initialization. Use this method to initialize your state.
|
||
<538> <1/> <b>_update</b>(delta: <2/>) <3/> <l4>🔗</l>
|
||
<539> Called during the update. Implement your state’s behavior with this method.
|
||
<540> <1/> <b>add_event_handler</b>(event: <2/>, handler: <3/>) <l4>🔗</l>
|
||
<541> Registers a <1/> to be called when <2/> is dispatched. The handler function should have the following signature:
|
||
<542> If the handler returns <1/>, the event will be consumed. Cargo is an optional parameter that can be passed to the handler. See also <l2>dispatch</l>.
|
||
<543> <l1>LimboState</l> <b>call_on_enter</b>(callable: <2/>) <l3>🔗</l>
|
||
<544> A chained method that connects the <l1>entered</l> signal to a <2/>.
|
||
<545> <l1>LimboState</l> <b>call_on_exit</b>(callable: <2/>) <l3>🔗</l>
|
||
<546> A chained method that connects the <l1>exited</l> signal to a <2/>.
|
||
<547> <l1>LimboState</l> <b>call_on_update</b>(callable: <2/>) <l3>🔗</l>
|
||
<548> A chained method that connects the <l1>updated</l> signal to a <2/>.
|
||
<549> <1/> <b>clear_guard</b>() <l2>🔗</l>
|
||
<550> Clears the guard function, removing the <1/> previously set by <l2>set_guard</l>.
|
||
<551> <1/> <b>dispatch</b>(event: <2/>, cargo: <3/> = null) <l4>🔗</l>
|
||
<552> Recursively dispatches a state machine event named <1/> with an optional argument <2/>. Returns <3/> if the event was consumed.
|
||
<553> Events propagate from the leaf state to the root state, and propagation stops as soon as any state consumes the event. States will consume the event if they have a related transition or event handler. For more information on event handlers, see <l1>add_event_handler</l>.
|
||
<554> <l1>LimboState</l> <b>get_root</b>() <2/> <l3>🔗</l>
|
||
<555> Returns the root <b>LimboState</b>.
|
||
<556> <1/> <b>is_active</b>() <2/> <l3>🔗</l>
|
||
<557> Returns <1/> if it is currently active, meaning it is the active substate of the parent <l2>LimboHSM</l>.
|
||
<558> <l1>LimboState</l> <b>named</b>(name: <2/>) <l3>🔗</l>
|
||
<559> A chained method for setting the name of this state.
|
||
<560> <1/> <b>set_guard</b>(guard_callable: <2/>) <l3>🔗</l>
|
||
<561> Sets the guard function, which is a function called each time a transition to this state is considered. If the function returns <1/>, the transition will be disallowed.
|
||
<562> LimboHSM
|
||
<563> <b>Inherits:</b> <l1>LimboState</l>
|
||
<564> Event-based Hierarchical State Machine (HSM).
|
||
<565> Event-based Hierarchical State Machine (HSM) that manages <l1>LimboState</l> instances and facilitates transitions between them. LimboHSM is a <l2>LimboState</l> in itself and can also serve as a child of another LimboHSM node.
|
||
<566> <l1>LimboState</l>
|
||
<567> <l1>ANYSTATE</l>
|
||
<568> <l1>initial_state</l>
|
||
<569> <l1>UpdateMode</l>
|
||
<570> <l1>update_mode</l>
|
||
<571> <l1>add_transition</l>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable())
|
||
<572> <l1>change_active_state</l>(state: <l2>LimboState</l>)
|
||
<573> <l1>get_active_state</l>() <2/>
|
||
<574> <l1>get_leaf_state</l>() <2/>
|
||
<575> <l1>get_previous_active_state</l>() <2/>
|
||
<576> <l1>has_transition</l>(from_state: <l2>LimboState</l>, event: <3/>) <4/>
|
||
<577> <l1>initialize</l>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null)
|
||
<578> <l1>remove_transition</l>(from_state: <l2>LimboState</l>, event: <3/>)
|
||
<579> <l1>set_active</l>(active: <2/>)
|
||
<580> <l1>update</l>(delta: <2/>)
|
||
<581> <b>active_state_changed</b>(current: <l1>LimboState</l>, previous: <l2>LimboState</l>) <l3>🔗</l>
|
||
<582> Emitted when the currently active substate is switched to a different substate.
|
||
<583> enum <b>UpdateMode</b>: <l1>🔗</l>
|
||
<584> <l1>UpdateMode</l> <b>IDLE</b> = <2/>
|
||
<585> Update the state machine during the idle process.
|
||
<586> <l1>UpdateMode</l> <b>PHYSICS</b> = <2/>
|
||
<587> Update the state machine during the physics process.
|
||
<588> <l1>UpdateMode</l> <b>MANUAL</b> = <2/>
|
||
<589> Manually update the state machine by calling <l1>update</l> from a script.
|
||
<590> <l1>LimboState</l> <b>ANYSTATE</b> <l2>🔗</l>
|
||
<591> <l1>LimboState</l> <b>anystate</b>()
|
||
<592> Useful for defining a transition from any state.
|
||
<593> <l1>LimboState</l> <b>initial_state</b> <l2>🔗</l>
|
||
<594> <1/> <b>set_initial_state</b>(value: <l2>LimboState</l>)
|
||
<595> <l1>LimboState</l> <b>get_initial_state</b>()
|
||
<596> The substate that becomes active when the state machine is activated using the <l1>set_active</l> method. If not explicitly set, the first child of the LimboHSM will be considered the initial state.
|
||
<597> <l1>UpdateMode</l> <b>update_mode</b> = <2/> <l3>🔗</l>
|
||
<598> <1/> <b>set_update_mode</b>(value: <l2>UpdateMode</l>)
|
||
<599> <l1>UpdateMode</l> <b>get_update_mode</b>()
|
||
<600> Specifies when the state machine should be updated. See <l1>UpdateMode</l>.
|
||
<601> <1/> <b>add_transition</b>(from_state: <l2>LimboState</l>, to_state: <l3>LimboState</l>, event: <4/>, guard: <5/> = Callable()) <l6>🔗</l>
|
||
<602> Establishes a transition from one state to another when <1/> is dispatched. Both <2/> and <3/> must be immediate children of this <b>LimboHSM</b>.
|
||
<603> Optionally, a <1/> function can be specified, which must return a boolean value. If the guard function returns <2/>, the transition will not occur. The guard function is called immediately before the transition is considered. For a state-wide guard function, check out <l3>LimboState.set_guard</l>.
|
||
<604> <1/> <b>change_active_state</b>(state: <l2>LimboState</l>) <l3>🔗</l>
|
||
<605> Changes the currently active substate to <1/>. If <2/> is already active, it will be exited and reentered.
|
||
<606> <1/> must be a child of this <b>LimboHSM</b>.
|
||
<607> <l1>LimboState</l> <b>get_active_state</b>() <2/> <l3>🔗</l>
|
||
<608> Returns the currently active substate.
|
||
<609> <l1>LimboState</l> <b>get_leaf_state</b>() <2/> <l3>🔗</l>
|
||
<610> Returns the currently active leaf state within the state machine.
|
||
<611> <l1>LimboState</l> <b>get_previous_active_state</b>() <2/> <l3>🔗</l>
|
||
<612> Returns the previously active substate.
|
||
<613> <1/> <b>has_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <4/> <l5>🔗</l>
|
||
<614> Returns <1/> if there is a transition from <2/> for a given <3/>.
|
||
<615> <1/> <b>initialize</b>(agent: <2/>, parent_scope: <l3>Blackboard</l> = null) <l4>🔗</l>
|
||
<616> Initiates the state and calls <l1>LimboState._setup</l> for both itself and all substates.
|
||
<617> <1/> <b>remove_transition</b>(from_state: <l2>LimboState</l>, event: <3/>) <l4>🔗</l>
|
||
<618> Removes a transition from a state associated with specific <1/>.
|
||
<619> <1/> <b>set_active</b>(active: <2/>) <l3>🔗</l>
|
||
<620> When set to <1/>, switches the state to <l2>initial_state</l> and activates state processing according to <l3>update_mode</l>.
|
||
<621> <1/> <b>update</b>(delta: <2/>) <l3>🔗</l>
|
||
<622> Calls <l1>LimboState._update</l> on itself and the active substate, with the call cascading down to the leaf state. This method is automatically triggered if <l2>update_mode</l> is not set to <l3>MANUAL</l>. |