LadderInteraction ​
Inherits: InteractableObjectInteraction < Interaction < Resource
Ladder interaction - climbing system using Path3D Discovers scene structure by name: "LadderPath", "StartMarker", "EndMarker"
Properties ​
float | climb_speed | 3.0 |
bool | allow_multiple_climbers | false |
bool | lock_entity_controls | true |
Variables ​
Path3D | ladder_path | |
Marker3D | start_marker | |
Marker3D | end_marker | |
LadderState | current_state | LadderState.IDLE |
Array[Dictionary] | active_climbers | [] |
float | ladder_length | 0.0 |
Methods ​
void | setup_for_interactable_objects( interactable: InteractableObject ) |
bool | can_interact( player: Player ) |
void | start_interaction( player: Player ) |
void | end_interaction() |
String | get_interaction_prompt() |
void | start_climbing( entity: Entity, direction: ClimbDirection ) |
void | interrupt_climbing( entity: Entity ) |
void | set_ladder_state( new_state: LadderState ) |
bool | is_entity_climbing( entity: Entity ) |
float | get_climb_progress( entity: Entity ) |
Dictionary | save_state() |
void | load_state( state: Dictionary ) |
void | cleanup() |
Signals ​
climb_started( entity: Entity, direction: ClimbDirection ) ​
Emitted when an entity starts to climb: the entity and the direction.
climb_finished( entity: Entity, direction: ClimbDirection ) ​
Emitted when an entity reaches the end of the ladder.
climb_interrupted( entity: Entity ) ​
Emitted when a climb is interrupted before the end.
Enumerations ​
enum ClimbDirection ​
Which way an entity climbs: up (start to end of the path) or down.
- UP =
0- Climbing from start to end of path - DOWN =
1- Climbing from end to start of path
enum LadderState ​
The states of a ladder: idle (nobody climbs), in use or broken.
- IDLE =
0- No one is climbing - IN_USE =
1- Someone is currently climbing - BROKEN =
2- Ladder is broken/unusable
Property descriptions ​
Ladder Setup
float climb_speed = 3.0 ​
Speed at which entities climb (units per second)
bool allow_multiple_climbers = false ​
Whether ladder can be used simultaneously by multiple entities
bool lock_entity_controls = true ​
(kept for older scenes: the controls of a climbing entity are always locked, the controller ignores input while is_climbing is set)
Variable descriptions ​
Path3D ladder_path ​
Path3D defining the ladder route (found by name "LadderPath")
Marker3D start_marker ​
Start point marker (found by name "StartMarker")
Marker3D end_marker ​
End point marker (found by name "EndMarker")
LadderState current_state = LadderState.IDLE ​
The state of the ladder now.
Array[Dictionary] active_climbers = [] ​
{entity: Entity, direction: ClimbDirection, progress: float, tween: Tween}
float ladder_length = 0.0 ​
The length of the path of the ladder.
Method descriptions ​
void setup_for_interactable_objects( interactable: InteractableObject ) ​
Sets the ladder up on its object: finds the nodes it needs and applies its starting state.
bool can_interact( player: Player ) ​
Can the player use the ladder now (in range, the object is not broken, the requirements are met)?
void start_interaction( player: Player ) ​
The player uses the ladder.
void end_interaction() ​
Does nothing: the climb goes on after the interaction ends.
String get_interaction_prompt() ​
The text of the prompt above the object for its state now ("Open", "Climb" ...).
void start_climbing( entity: Entity, direction: ClimbDirection ) ​
Makes an entity climb the ladder in a direction. Does nothing when it already climbs it.
void interrupt_climbing( entity: Entity ) ​
Stops the climb of an entity.
void set_ladder_state( new_state: LadderState ) ​
Sets the state of the ladder.
bool is_entity_climbing( entity: Entity ) ​
Is the entity climbing this ladder?
float get_climb_progress( entity: Entity ) ​
How far along the ladder the entity is (0 to 1).
Dictionary save_state() ​
The state of the ladder for a save.
void load_state( state: Dictionary ) ​
Restores the state of the ladder from a save.
void cleanup() ​
Gives its timers back and clears what it holds (the object is going away).