Skip to content

UseLadderTask ​

Inherits: BehaviorTask < Resource

Climb a ladder (any entity can use) Enhanced with proper signal-based movement handling

Properties ​

intladder_id0
ClimbDirectionclimb_directionClimbDirection.AUTO_DETECT
boolmove_to_laddertrue
floatinteraction_distance3.0
floatclimb_timeout30.0
boolinterrupt_if_occupiedfalse

Variables ​

InteractableObjecttarget_laddernull
Timerclimb_timernull
boolis_climbingfalse
boolclimb_startedfalse
Vector3ladder_positionVector3.ZERO
floatinteraction_range3.0
boolmovement_completedfalse
boolladder_interaction_completedfalse

Methods ​

voidexecute_task_start()
voidexecute_task_complete()
voidexecute_task_interrupt()
voidexecute_task_fail()
floatget_climb_progress()
boolis_ladder_accessible()
floatget_distance_to_ladder()
boolis_in_ladder_interaction_range()
voidset_ladder_id( new_id: int )
voidset_climb_direction( direction: int )
voidset_interaction_distance( distance: float )
voidcleanup_timers()

Enumerations ​

enum ClimbDirection ​

The options of climb direction: auto detect, up, down.

  • AUTO_DETECT = 0
  • UP = 1
  • DOWN = 2

Property descriptions ​

Target

int ladder_id = 0 ​

The unique ID of the ladder to climb

ClimbDirection climb_direction = ClimbDirection.AUTO_DETECT ​

Climb direction (0 = auto-detect, 1 = up, -1 = down)

bool move_to_ladder = true ​

Whether to move to ladder before climbing

float interaction_distance = 3.0 ​

Interaction distance from ladder

Behavior

float climb_timeout = 30.0 ​

Maximum time to wait for climb completion (seconds)

bool interrupt_if_occupied = false ​

Whether to interrupt if ladder becomes occupied (for single-climber ladders)

Variable descriptions ​

InteractableObject target_ladder = null ​

The ladder the entity climbs.

Timer climb_timer = null ​

The timer of the climb.

bool is_climbing = false ​

True while the entity climbs.

bool climb_started = false ​

True once the climb has started.

Vector3 ladder_position = Vector3.ZERO ​

The position of the ladder.

float interaction_range = 3.0 ​

How close the entity must be to use the ladder.

bool movement_completed = false ​

True once the entity arrived.

bool ladder_interaction_completed = false ​

True once the climb is done.

Method descriptions ​

void execute_task_start() ​

Starts the task.

void execute_task_complete() ​

Called when the task finishes well.

void execute_task_interrupt() ​

Called when something interrupts the task.

void execute_task_fail() ​

Called when the task fails.

float get_climb_progress() ​

How far along the ladder the entity is (0 to 1).

bool is_ladder_accessible() ​

Can the ladder be used now (it is not broken)?

float get_distance_to_ladder() ​

The distance to the ladder (-1 when there is none).

bool is_in_ladder_interaction_range() ​

Is the entity close enough to use the ladder?

void set_ladder_id( new_id: int ) ​

Set the target ladder ID dynamically

void set_climb_direction( direction: int ) ​

Set the climb direction dynamically

void set_interaction_distance( distance: float ) ​

Set interaction distance dynamically

void cleanup_timers() ​

Frees the timers of the task.