DoorInteraction ​
Inherits: InteractableObjectInteraction < Interaction < Resource
Door interaction - opens/closes doors with animations Uses available_animations from InteractableDefinition for animation selection
Properties ​
bool | is_open | false |
bool | can_open_when_damaged | true |
bool | auto_close_enabled | false |
float | auto_close_delay | 5.0 |
String | open_animation | "open" |
String | close_animation | "close" |
String | locked_animation | "locked" |
SFXSelection | door_open_sound | |
SFXSelection | door_close_sound | |
SFXSelection | door_locked_sound | |
SFXSelection | door_creak_sound |
Variables ​
int | original_collision_layer | |
int | original_collision_mask | |
Timer | auto_close_timer | null |
Methods ​
void | setup_for_interactable_objects( interactable: InteractableObject ) |
bool | can_interact( player: Player ) |
void | start_interaction( player: Player ) |
void | on_object_destroyed() |
void | on_locked_reaction() |
bool | force_open() |
bool | force_close() |
Dictionary | save_state() |
void | load_state( state: Dictionary ) |
void | cleanup() |
Signals ​
door_opened( entity: Entity ) ​
Emitted when the door opens.
door_closed( entity: Entity ) ​
Emitted when the door closes.
Property descriptions ​
bool is_open = false ​
True when the door is open.
bool can_open_when_damaged = true ​
True when a damaged door can still be opened.
bool auto_close_enabled = false ​
True when the door closes by itself after a delay.
float auto_close_delay = 5.0 ​
How many seconds an open door waits before it closes by itself.
Animations
String open_animation = "open" ​
Animation to play when door opens Editor will show dropdown of available_animations from InteractableDefinition
String close_animation = "close" ​
Animation to play when door closes
String locked_animation = "locked" ​
Animation to play when locked (optional)
Audio
SFXSelection door_open_sound ​
The sound of the door opening.
SFXSelection door_close_sound ​
The sound of the door closing.
SFXSelection door_locked_sound ​
The sound of trying a locked door.
SFXSelection door_creak_sound ​
A creak played now and then (optional).
Variable descriptions ​
int original_collision_layer ​
The collision layer of the door when it is closed (kept to give it back).
int original_collision_mask ​
The collision mask of the door when it is closed (kept to give it back).
Timer auto_close_timer = null ​
The timer of the automatic closing.
Method descriptions ​
void setup_for_interactable_objects( interactable: InteractableObject ) ​
Sets the door up on its object: finds the nodes it needs and applies its starting state.
bool can_interact( player: Player ) ​
Can the player use the door now (in range, the object is not broken, the requirements are met)?
void start_interaction( player: Player ) ​
The player uses the door.
void on_object_destroyed() ​
Called when the object is destroyed: a destroyed door is forced open and has no collision.
void on_locked_reaction() ​
Called when someone tries the object while it is locked: plays the locked sound and animation.
bool force_open() ​
Opens the door without a player (a script or an event). False when it is destroyed.
bool force_close() ​
Closes the door without a player. False when it is destroyed.
Dictionary save_state() ​
The state of the door for a save.
void load_state( state: Dictionary ) ​
Restores the state of the door from a save.
void cleanup() ​
Gives its timers back and clears what it holds (the object is going away).