Skip to main content

Standstill

Overview

StandStill is a behaviour node used within DST's state machine/behaviour system to enforce a stationary state on an entity. It inherits from BehaviourNode and halts the entity's movement by calling locomotor:Stop() on the associated entity. The node supports optional callbacks (startfn and keepfn) to determine whether the entity should begin or continue standing still. If either callback returns false, the node transitions to FAILED; otherwise, it remains in RUNNING and periodically re-checks the keepfn condition while re-invoking locomotor:Stop() every 0.5 seconds.

This component is typically used in conjunction with a state graph or behaviour tree to enforce idle, waiting, or interrupted states where movement must be explicitly blocked regardless of AI goals.

Dependencies & Tags

  • Components used:
    • locomotor — accessed via self.inst.components.locomotor:Stop() to halt movement.
  • Tags:
    • None identified.

Properties

PropertyTypeDefault ValueDescription
instEntitynilThe entity instance this behaviour belongs to.
startfnfunction?nilOptional callback invoked on entry to determine if standing still should begin. Takes inst as argument and returns a boolean.
keepfnfunction?nilOptional callback invoked periodically while running to determine if the entity should continue standing still. Takes inst as argument and returns a boolean.

Main Functions

StandStill:Visit()

  • Description: Core execution method called by the behaviour tree manager on each tick. Handles transitions between READY, RUNNING, and FAILED states. Checks startfn/keepfn conditions and ensures locomotor:Stop() is called at appropriate times.
  • Parameters: None.
  • Returns: nil.

Events & Listeners

  • None.