InteractableObject ​
Inherits: StaticBody3D
Unified interactable object class - uses InteractableDefinition + Interactions All specialized logic is now in Interaction subclasses
Properties ​
UniqueInteractableData | unique_data | |
InteractableDefinition : | definition |
Variables ​
String: | display_name | |
bool | is_initialized | false |
Node3D | editor_visual | |
int | locked_by_item_id | -1 |
bool | is_interactable | false |
FactionDefinition | faction | |
Variant | is_dead | false |
bool | object_targetable_directly | false |
bool | object_targetable_by_aoe | false |
bool | object_has_stats | false |
bool | wants_nameplate | false |
Marker3D | nameplate_marker | |
Nameplate | nameplate | |
CollisionShape3D | object_collision | |
AnimationPlayer | animation_player | |
Label3D | interact_prompt_label | |
Entity | summoner | null |
Effect | creating_effect | null |
Timer | interaction_cooldown_timer | |
bool | is_on_interaction_cooldown | false |
Interaction | interaction | null |
ChronoManager | chrono_manager | |
Array | loot_rolled | [] |
ComponentsManager | components |
Methods ​
Array[int] | get_ui_tag_ids() |
Array[UITagDefinition] | get_ui_tags() |
bool | has_ui_tag( tag: Variant ) |
void | initialize_interactable( system_hub: GameHost.SystemHub ) |
void | show_interact_prompt() |
void | hide_interact_prompt() |
void | handle_destruction() |
bool | is_destroyed() |
Array[LootRule] | get_loot_rules() |
int | run_loot_rules( trigger: LootRule.Trigger, receiver: Entity = null ) |
bool | has_pending_loot() |
bool | has_lootable_remains() |
void | process_interaction( entity: Entity ) |
String | get_requirements_blocker( entity: Entity ) |
bool | is_in_use() |
void | cancel_use() |
bool | is_locked() |
Interaction | get_interaction_by_type( type_name: String ) |
bool | unlock_from_external() |
bool | play_animation( anim_name: String ) |
bool | has_animation( anim_name: String ) |
Array[String] | get_available_animations() |
void | play_sound_stream( stream: AudioStream ) |
Node3D | get_attachment_point_node( location: VFXSelection.VfxLocation ) |
int | get_unique_id() |
int | get_object_id() |
String | get_object_name() |
void | set_faction_id( new_faction: FactionDefinition ) |
int | get_faction_id() |
void | set_summoner( new_summoner: Entity, effect: Effect = null ) |
void | summon_finished() |
InventoryComponent | get_inventory() |
bool | has_inventory() |
EffectInstance | get_effect( effect_id: int ) |
EffectInstance | get_effect_from_caller( effect_id: int, originator: Entity ) |
void | reduce_effect_stacks( effect_instance: EffectInstance, stacks_to_remove: int ) |
Array[EffectInstance] | get_active_effects_by_type( effect_type: String ) |
Array[EffectInstance] | get_all_active_effects() |
int | get_active_effect_count() |
bool | has_any_active_effects() |
void | remove_all_effects() |
void | remove_effects_from_originator( originator: Entity ) |
DamageResult | take_damage( result: DamageResult ) |
HealingResult | take_healing( result: HealingResult ) |
bool | can_apply_school_effect( school_id: int, source_entity: Variant = null, effect: EffectInstance = null ) |
float | get_current_health() |
float | get_max_health() |
float | get_health_percentage() |
bool | is_health_below( threshold: float ) |
bool | is_health_above( threshold: float ) |
float | get_pool_current( pool_id: int ) |
float | get_pool_max( pool_id: int ) |
float | get_pool_percentage( pool_id: int ) |
bool | has_pool( pool_id: int ) |
bool | is_master_pool( pool_id: int ) |
PoolInstance | get_master_pool() |
float | add_pool_value( pool_id: int, amount: float ) |
bool | remove_pool_value( pool_id: int, amount: float ) |
bool | is_resource_pool( pool_id: int ) |
float | get_stat( stat_id: int ) |
bool | has_stat( stat_id: int ) |
Array[int] | get_stat_ids_in_group( group_id: int ) |
bool | add_stat_bonus( stat_id: int, amount: float ) |
bool | add_stat_multiplier( stat_id: int, amount: float ) |
bool | set_stat_base( stat_id: int, value: float ) |
void | sync_to_unique_data() |
void | set_pointer_over( over: bool ) |
void | set_current_target_hover() |
void | set_current_target_on() |
void | set_current_target_off() |
void | set_map_marker_icon( type: Entity.MapMarkerType ) |
Dictionary | to_save_data() |
void | from_save_data( data: Dictionary, system_hub: GameHost.SystemHub ) |
Signals ​
object_interacted( object_id: int, entity: Entity ) ​
Signals
pointer_over_changed( target: Variant, over: bool ) ​
Emitted when the pointer starts or stops being over this (its body or its nameplate): what the entity tooltip follows
object_locked( object_id: int ) ​
Emitted when the object is locked.
object_unlocked( object_id: int ) ​
Emitted when the object is unlocked.
object_damaged( damage_amount: int, damage_source: Entity ) ​
Emitted when the object is damaged (an object with stats can be hit).
object_destroyed() ​
Emitted when the object is destroyed.
use_started( user: Entity, duration: float ) ​
Somebody started a use that takes time (the object has a use time), and how long it takes
use_ended( user: Entity, completed: bool ) ​
The use that took time ended: it was finished (true) or cancelled (false)
interaction_refused( user: Entity, message: String ) ​
Somebody tried to use the object and was refused (requirements, no room), with what they were told
object_health_changed( new_health: int ) ​
Emitted when the health of the object changes, with the new health.
Property descriptions ​
UniqueInteractableData unique_data ​
The record of this object in the world (a placed object): its overrides, state and position.
InteractableDefinition : definition ​
What kind of object this is: the interactable definition it was made from.
Variable descriptions ​
String: display_name ​
The name of the object: the one of its placed object or of its definition, when it is asked for (so it follows the language of the player); a name set by hand stays
bool is_initialized = false ​
True once initialize_interactable has run.
Node3D editor_visual ​
State Properties (from definition, can be overridden by unique_data)
int locked_by_item_id = -1 ​
The id of the item that opens the object, or -1 when it is not locked.
bool is_interactable = false ​
True while the object can be used.
FactionDefinition faction ​
The faction of the object. It decides who may attack it and who it fights for.
is_dead = false ​
True when the object has been destroyed.
bool object_targetable_directly = false ​
Targeting flags (from definition)
bool object_targetable_by_aoe = false ​
True when area effects hit the object (from the definition).
bool object_has_stats = false ​
True when the object has stats and pools of its own, so it can be hit (from the definition).
bool wants_nameplate = false ​
Nameplate support
Marker3D nameplate_marker ​
The marker where the nameplate of the object is placed.
Nameplate nameplate ​
The nameplate of the object, if it has one.
CollisionShape3D object_collision ​
Scene Structure References
AnimationPlayer animation_player ​
The animation player of the scene of the object.
Label3D interact_prompt_label ​
The label above the object that tells the player what the key does.
Entity summoner = null ​
Effect refs
Effect creating_effect = null ​
The effect that made the object (a summoned object), if any.
Timer interaction_cooldown_timer ​
Interactions
bool is_on_interaction_cooldown = false ​
True while the object cannot be used again because of its cooldown.
Interaction interaction = null ​
The interaction of the object (a door, a container, a trap ...), made from its definition.
ChronoManager chrono_manager ​
SystemRefs
Array loot_rolled = [] ​
The numbers of the loot rules that have rolled (a rule on Initialize or First Access rolls once). Saved with the object
ComponentsManager components ​
The components of the object (stats, effects, inventory, rig ...), made when it is initialized.
Method descriptions ​
Array[int] get_ui_tag_ids() ​
Core Properties The ids of the entity tags of this object: its definition's, plus the ones of its placed object, minus the ones the placed object takes away
Array[UITagDefinition] get_ui_tags() ​
The entity tags of this object (what the interface reads to show it)
bool has_ui_tag( tag: Variant ) ​
Does the object have this entity tag? By the key of the tag ("quest_giver") or its id
void initialize_interactable( system_hub: GameHost.SystemHub ) ​
Builds the object from its definition: resolves its template, makes its components, interaction, faction and stats, and sets it up. Called once when the object is made.
void show_interact_prompt() ​
Shows the prompt above the object (only to a player who can use it).
void hide_interact_prompt() ​
Hides the prompt above the object.
void handle_destruction() ​
Destroys the object: plays its death, drops what it drops and tells everyone.
bool is_destroyed() ​
Has the object been destroyed?
Array[LootRule] get_loot_rules() ​
The loot rules of this object: the ones of the placed object when it has its own, else the ones of its definition, plus those of the older settings of its container (its fixed contents and its loot table)
int run_loot_rules( trigger: LootRule.Trigger, receiver: Entity = null ) ​
Rolls the loot rules of a trigger into the inventory of this object (see LootDispatcher). receiver is whoever gets the loot (the one who opens a chest): it changes the amount and the quality by its loot gains and can give the item level. Returns how many rules rolled
bool has_pending_loot() ​
Is there a rule that rolls the first time the object is opened and has not rolled yet?
bool has_lootable_remains() ​
Does a destroyed object still hold something to take (loot in its inventory, or a rule that rolls when it is opened)?
void process_interaction( entity: Entity ) ​
Runs the interaction of the object for an entity (checks, then does what the interaction does).
String get_requirements_blocker( entity: Entity ) ​
Why the user cannot use the object ("" = they can): what the object asks for (see InteractableDefinition.use_requirements)
bool is_in_use() ​
Is somebody using the object now (a use that takes time)?
void cancel_use() ​
The use that takes time is cancelled (the user moved, was hurt, cast an ability, died, or an event cancels it)
bool is_locked() ​
Is the object locked?
Interaction get_interaction_by_type( type_name: String ) ​
The interaction of this object when it is of the type asked for (the name of its class), else null
bool unlock_from_external() ​
Unlocks the object without its key (a script, a switch). False when it was not locked.
bool play_animation( anim_name: String ) ​
Plays an animation on the rig of the object. False when there is none.
bool has_animation( anim_name: String ) ​
Does the rig of the object have this animation?
Array[String] get_available_animations() ​
The names of the animations of the rig of the object.
void play_sound_stream( stream: AudioStream ) ​
Plays a sound from the object.
Node3D get_attachment_point_node( location: VFXSelection.VfxLocation ) ​
The node where a visual effect attaches (the object itself when it has no rig).
int get_unique_id() ​
The id of the unique record of the object (its place in the world), or -1 when it has none.
int get_object_id() ​
The same as get_unique_id.
String get_object_name() ​
The name of the object: its display name, else its node name.
void set_faction_id( new_faction: FactionDefinition ) ​
Sets the faction of the object.
int get_faction_id() ​
The id of the faction of the object.
void set_summoner( new_summoner: Entity, effect: Effect = null ) ​
Marks the object as summoned by an entity (and by an effect): it takes the faction of the summoner and goes when the summoner dies.
void summon_finished() ​
Ends the life of a summoned object (it is removed).
InventoryComponent get_inventory() ​
The inventory component of the object.
bool has_inventory() ​
Does the object have an inventory?
EffectInstance get_effect( effect_id: int ) ​
The effect of the object with this effect id, or null.
EffectInstance get_effect_from_caller( effect_id: int, originator: Entity ) ​
The effect with this id that this originator put on the object, or null.
void reduce_effect_stacks( effect_instance: EffectInstance, stacks_to_remove: int ) ​
Takes stacks off an effect (the effect ends when none is left).
Array[EffectInstance] get_active_effects_by_type( effect_type: String ) ​
The active effects of one effect type (the class name of the type).
Array[EffectInstance] get_all_active_effects() ​
A copy of the list of the active effects of the object.
int get_active_effect_count() ​
How many effects are active on the object.
bool has_any_active_effects() ​
Is any effect active on the object?
void remove_all_effects() ​
Removes every effect from the object.
void remove_effects_from_originator( originator: Entity ) ​
Removes the effects an entity put on the object.
DamageResult take_damage( result: DamageResult ) ​
Completes the DamageResult for a hit on this object (see StatsComponent.take_damage). Returns null if it aborted
HealingResult take_healing( result: HealingResult ) ​
Completes the HealingResult for a heal on this object (see StatsComponent.take_healing). Returns null if it aborted
bool can_apply_school_effect( school_id: int, source_entity: Variant = null, effect: EffectInstance = null ) ​
Can an effect of this school land on the object?
float get_current_health() ​
The current health (the current value of the master pool).
float get_max_health() ​
The maximum health (the maximum of the master pool).
float get_health_percentage() ​
The health as a percentage of the maximum.
bool is_health_below( threshold: float ) ​
Is the health percentage below the threshold?
bool is_health_above( threshold: float ) ​
Is the health percentage above the threshold?
float get_pool_current( pool_id: int ) ​
The current value of a pool.
float get_pool_max( pool_id: int ) ​
The maximum value of a pool.
float get_pool_percentage( pool_id: int ) ​
The value of a pool as a percentage of its maximum.
bool has_pool( pool_id: int ) ​
Does the object have this pool?
bool is_master_pool( pool_id: int ) ​
Is this the master pool of the object (the one whose emptying destroys it)?
PoolInstance get_master_pool() ​
The master pool of the object (health).
float add_pool_value( pool_id: int, amount: float ) ​
Adds an amount to a pool, up to its maximum. Gives back what was added.
bool remove_pool_value( pool_id: int, amount: float ) ​
Takes an amount from a pool. False when the object has no such pool.
bool is_resource_pool( pool_id: int ) ​
Is the pool a resource pool and not a health pool?
float get_stat( stat_id: int ) ​
The current value of a stat, with every bonus and multiplier.
bool has_stat( stat_id: int ) ​
Does the object have this stat?
Array[int] get_stat_ids_in_group( group_id: int ) ​
The ids of the stats the object has in a stat group.
bool add_stat_bonus( stat_id: int, amount: float ) ​
Adds a flat amount to a stat (a negative amount takes away).
bool add_stat_multiplier( stat_id: int, amount: float ) ​
Adds to the multiplier of a stat.
bool set_stat_base( stat_id: int, value: float ) ​
Sets the base value of a stat.
void sync_to_unique_data() ​
Writes the state of the object (locked, destroyed, health, interaction state) into its unique record, so a save keeps it.
void set_pointer_over( over: bool ) ​
The pointer went over this or left it. Several things can hold it (the body and the nameplate): the signal is emitted when it goes from nothing holding it to something
void set_current_target_hover() ​
Shows the hover highlight on the object (the mouse is over it).
void set_current_target_on() ​
Shows the target highlight, in the color of the relation of the object to the player.
void set_current_target_off() ​
Takes the target highlight off.
void set_map_marker_icon( type: Entity.MapMarkerType ) ​
Sets the picture of the mini map mark of the object.
Dictionary to_save_data() ​
Standardized save method
void from_save_data( data: Dictionary, system_hub: GameHost.SystemHub ) ​
Standardized load method