RabbitHoleInteraction ​
Inherits: InteractableObjectInteraction < Interaction < Resource
Rabbit hole teleportation system - supports both local and inter-map teleportation Used by players: local teleportation (same map) and inter-map teleportation (NPCs and pets using a rabbit hole is a future option, through the behaviour tasks)
Properties ​
int | destination_rabbit_hole_id | -1 |
Vector3 | arrival_position | Vector3.ZERO |
Vector3 | arrival_rotation | Vector3.ZERO |
String | idle_animation | "idle" |
String | disabled_animation | "disabled" |
String | broken_animation | "broken" |
Variables ​
RabbitHoleState | current_state | RabbitHoleState.ACTIVE |
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() |
Vector3 | get_spawn_position() |
Vector3 | get_spawn_rotation() |
void | set_rabbit_hole_state( new_state: RabbitHoleState ) |
void | set_destination_rabbit_hole( rabbit_hole_id: int ) |
int | get_destination_rabbit_hole_id() |
bool | can_teleport() |
bool | is_destination_reachable() |
bool | can_entity_teleport( entity: Entity ) |
void | set_enabled( enabled: bool ) |
void | set_broken( broken: bool ) |
bool | force_teleport_entity( entity: Entity ) |
Dictionary | save_state() |
void | load_state( state: Dictionary ) |
void | cleanup() |
Signals ​
rabbit_hole_entered( entity: Entity, teleportation_type: String ) ​
Emitted when an entity goes in: the entity and the kind of travel.
rabbit_hole_exited( entity: Entity ) ​
Emitted when an entity comes out of this rabbit hole.
teleportation_failed( entity: Entity, reason: String ) ​
Emitted when the travel fails: the entity and why.
Enumerations ​
enum RabbitHoleState ​
The states of a rabbit hole: active, disabled for now, or broken for good.
- ACTIVE =
0- Ready for use - DISABLED =
1- Temporarily disabled - BROKEN =
2- Permanently broken
Property descriptions ​
Rabbit Hole Setup
int destination_rabbit_hole_id = -1 ​
The unique ID of the destination rabbit hole to teleport to
Vector3 arrival_position = Vector3.ZERO ​
Arrival position offset (relative to this rabbit hole's position)
Vector3 arrival_rotation = Vector3.ZERO ​
Arrival rotation (euler angles)
Animations
String idle_animation = "idle" ​
The animation of an active rabbit hole.
String disabled_animation = "disabled" ​
The animation of a disabled rabbit hole.
String broken_animation = "broken" ​
The animation of a broken rabbit hole.
Variable descriptions ​
RabbitHoleState current_state = RabbitHoleState.ACTIVE ​
The state of the rabbit hole now.
Method descriptions ​
void setup_for_interactable_objects( interactable: InteractableObject ) ​
Sets the rabbit hole up on its object: finds the nodes it needs and applies its starting state.
bool can_interact( player: Player ) ​
Can the player use the rabbit hole now (in range, the object is not broken, the requirements are met)?
void start_interaction( player: Player ) ​
The player uses the rabbit hole.
void end_interaction() ​
Does nothing: a rabbit hole has no end of interaction.
String get_interaction_prompt() ​
The text of the prompt above the object for its state now ("Open", "Climb" ...).
Vector3 get_spawn_position() ​
Where an entity appears when it comes out of this rabbit hole.
Vector3 get_spawn_rotation() ​
The rotation of an entity that comes out of this rabbit hole.
void set_rabbit_hole_state( new_state: RabbitHoleState ) ​
Sets the state of the rabbit hole and plays its animation.
void set_destination_rabbit_hole( rabbit_hole_id: int ) ​
Set the destination rabbit hole by unique ID
int get_destination_rabbit_hole_id() ​
Get the destination rabbit hole ID
bool can_teleport() ​
Check if this rabbit hole can currently be used
bool is_destination_reachable() ​
Check if destination is reachable (local or inter-map)
bool can_entity_teleport( entity: Entity ) ​
Check if an entity can use this rabbit hole
void set_enabled( enabled: bool ) ​
Force enable/disable the rabbit hole
void set_broken( broken: bool ) ​
Mark rabbit hole as broken
bool force_teleport_entity( entity: Entity ) ​
Force teleport an entity (bypasses normal restrictions)
Dictionary save_state() ​
The state of the rabbit hole for a save.
void load_state( state: Dictionary ) ​
Restores the state of the rabbit hole from a save.
void cleanup() ​
Gives its timers back and clears what it holds (the object is going away).