Skip to content

UseRabbitHoleTask ​

Inherits: BehaviorTask < Resource

Use rabbit hole for teleportation Enhanced with proper signal-based movement handling

Properties ​

intrabbit_hole_id0
boollocal_teleport_onlytrue
boolmove_to_rabbit_holetrue
floatinteraction_distance2.0
floatteleport_timeout10.0
boolfail_on_cross_map_for_non_playertrue

Variables ​

InteractableObjecttarget_rabbit_holenull
Timerteleport_timernull
boolteleportation_startedfalse
boolteleportation_completedfalse
Vector3rabbit_hole_positionVector3.ZERO
floatinteraction_range2.0
boolmovement_completedfalse
boolrabbit_hole_interaction_completedfalse

Methods ​

voidexecute_task_start()
voidexecute_task_complete()
voidexecute_task_interrupt()
voidexecute_task_fail()
InteractableObjectget_target_rabbit_hole()
boolis_teleportation_in_progress()
boolis_rabbit_hole_accessible()
floatget_distance_to_rabbit_hole()
boolis_in_rabbit_hole_interaction_range()
voidset_rabbit_hole_id( new_id: int )
voidset_local_teleport_only( local_only: bool )
voidset_interaction_distance( distance: float )
voidcleanup_timers()

Property descriptions ​

Target

int rabbit_hole_id = 0 ​

The unique ID of the rabbit hole to use

bool local_teleport_only = true ​

Whether to only allow local teleportation (NPCs should set this true)

bool move_to_rabbit_hole = true ​

Whether to move to rabbit hole before using

float interaction_distance = 2.0 ​

Interaction distance from rabbit hole

Behavior

float teleport_timeout = 10.0 ​

Maximum time to wait for teleportation to complete

bool fail_on_cross_map_for_non_player = true ​

Whether to fail if rabbit hole leads to different map and entity is not player

Variable descriptions ​

InteractableObject target_rabbit_hole = null ​

The rabbit hole the entity uses.

Timer teleport_timer = null ​

The timer of the travel.

bool teleportation_started = false ​

True once the travel has started.

bool teleportation_completed = false ​

True once the travel is done.

Vector3 rabbit_hole_position = Vector3.ZERO ​

The position of the rabbit hole.

float interaction_range = 2.0 ​

How close the entity must be to use the rabbit hole.

bool movement_completed = false ​

True once the entity arrived.

bool rabbit_hole_interaction_completed = false ​

True once the rabbit hole was used.

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.

InteractableObject get_target_rabbit_hole() ​

The rabbit hole the entity uses.

bool is_teleportation_in_progress() ​

Is the entity travelling now?

bool is_rabbit_hole_accessible() ​

Can the rabbit hole be used now?

float get_distance_to_rabbit_hole() ​

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

bool is_in_rabbit_hole_interaction_range() ​

Is the entity close enough to use the rabbit hole?

void set_rabbit_hole_id( new_id: int ) ​

Set the target rabbit hole ID dynamically

void set_local_teleport_only( local_only: bool ) ​

Set local teleport only flag dynamically

void set_interaction_distance( distance: float ) ​

Set interaction distance dynamically

void cleanup_timers() ​

Frees the timers of the task.