Skip to content

InteractableDefinition ​

Inherits: DatabaseResource < Resource

Core data definition for interactable objects. This is the "NPCDefinition" equivalent for interactables.

Properties ​

PackedScene :model_scene
Array[String]available_animations[]
Vector3model_scaleVector3.ONE
boolobject_targetable_directlyfalse
boolobject_targetable_by_aoefalse
boolobject_has_statsfalse :
StatsDatastats_data
floatdamaged_threshold0.7
intlocked_by_item_id-1
boolconsume_key_on_unlockfalse
Array[int]ui_tags[]
floatinteraction_cooldown_duration0.5
Array[Requirement]use_requirements[]
Stringuse_requirement_message"":
boolhide_prompt_until_requirements_metfalse
floatuse_time0.0
Stringuse_time_label"":
boolinterrupt_on_movetrue
boolinterrupt_on_damagetrue
AnimationSelectionSocialuser_animation
Stringobject_use_animation""
Interactioninteractionnull
Array[LootRule]loot_rules[]
SFXSelectioninteraction_sfx
SFXSelectionhit_sound
SFXSelectiondamaged_sound
SFXSelectiondestroyed_sound
VFXSelectiondestruction_vfx
inttemplate_id0
TemplateBaselinetemplate_baseline
Array[int]template_fixed_stats[]
booltemplatefalse

Methods ​

boolis_valid()
Stringget_display_name()
boolis_destructible()
boolis_targetable()
boolis_directly_targetable()
boolis_aoe_targetable()
boolis_locked()
boolhas_animation( anim_name: String )
Array[String]get_available_animations()
voidset_targeting_config( directly_targetable: bool, aoe_targetable: bool )
voidmake_fully_targetable()
voidmake_aoe_targetable_only()
voidmake_non_targetable()
boolis_template()

Property descriptions ​

Visuals & Physics

PackedScene : model_scene ​

InteractableScene containing model, collision, and animations

Array[String] available_animations = [] ​

Available animations (auto-populated from InteractableScene)

Vector3 model_scale = Vector3.ONE ​

Scale multiplier applied to the instantiated scene

Targeting

bool object_targetable_directly = false ​

Can this object be targeted directly by single-target abilities? Examples: Single-target damage spells, heals on destructible objects

bool object_targetable_by_aoe = false ​

Can this object be hit by area-of-effect abilities? Examples: Fireball explosions, cleave attacks hitting nearby objects

bool object_has_stats = false : ​

Does this object have combat stats (health, defense, etc.)? AUTO-CALCULATED: True if either targeting flag is true When true, creates StatsComponent + EffectsComponent at runtime

Combat Stats

StatsData stats_data ​

Stats configuration for objects with combat capabilities Only used if object_has_stats is true

float damaged_threshold = 0.7 ​

Damage threshold at which object becomes "damaged" (0.0-1.0)

Lock System

int locked_by_item_id = -1 ​

If > -1, this item ID is required to unlock this object

bool consume_key_on_unlock = false ​

The key is used up when it unlocks the object (off: the key stays in the bag)

Entity Tags

Array[int] ui_tags = [] ​

The entity tags of this kind of object (UITagDefinition ids): labels with no effect on the object that the interface reads to show it differently (a nameplate, a map icon). A placed object can add tags and take some away (UniqueInteractableData)

Interaction

float interaction_cooldown_duration = 0.5 ​

Seconds an object waits after it was used before it can be used again (0 = no wait)

Using it

Array[Requirement] use_requirements = [] ​

What a user needs to use the object (a profession level, a tool, a quest). Empty = anyone. Works for every kind of interaction: a locked-by-skill chest, a gathering node

String use_requirement_message = "": ​

What the user is told when the requirements are not met. Empty = the reasons the requirements give

bool hide_prompt_until_requirements_met = false ​

The "interact" prompt of the object is not shown to a user who does not meet the requirements (off: the prompt is shown and using the object tells the user why not)

float use_time = 0.0 ​

Seconds that using the object takes. 0 = at once. While it lasts the user's cast bar shows it, and the use is done when it ends

String use_time_label = "": ​

The text of the cast bar. Empty = "Using <name of the object>"

bool interrupt_on_move = true ​

Moving cancels the use

bool interrupt_on_damage = true ​

Taking damage cancels the use

AnimationSelectionSocial user_animation ​

The animation the user plays while the object is used (a social animation, from the "actions" category: kneel, mine, pick)

String object_use_animation = "" ​

The animation the object plays when its use starts (one of the animations of its model)

Behaviors

Interaction interaction = null ​

The interaction of this object (what happens when it is used) Examples: ContainerInteraction, DoorInteraction, TrapInteraction An object has one interaction (several on one object is a possible future option)

Loot

Array[LootRule] loot_rules = [] ​

What this object hands out and when: each rule is a loot table with a trigger (when the object is set up, the first time it is opened, when it is destroyed) and a source for the item level of what drops (see LootRule). A destroyed object that has loot stays lootable, like a corpse. A placed object can replace the rules

Audio

SFXSelection interaction_sfx ​

Sound when object is interacted with (generic interaction)

SFXSelection hit_sound ​

Sound when object takes damage (if object_has_stats)

SFXSelection damaged_sound ​

Sound when object becomes damaged (if object_has_stats)

SFXSelection destroyed_sound ​

Sound when object is destroyed (if object_has_stats)

VFX

VFXSelection destruction_vfx ​

VFX to play when destroyed (if object_has_stats)

Template

int template_id = 0 ​

The template this one follows (an id of the npc_template / interactable_template database type), 0 = none. An entity that follows a template has the changes of the template added when they are made (see EntityTemplates). Its growth is the growth of the template

TemplateBaseline template_baseline ​

What the template was when this entity last looked at it (the difference to the template now is what is added)

Array[int] template_fixed_stats = [] ​

Stats whose base value does not follow the template (they have the value set here whatever the template does)

bool template = false ​

Is this a template (a definition that others follow)?

Method descriptions ​

bool is_valid() ​

Validates that required configuration is present

String get_display_name() ​

Get display name with ID prefix

bool is_destructible() ​

Check if this object is destructible (has combat stats)

bool is_targetable() ​

Check if this object can be targeted by abilities

bool is_directly_targetable() ​

Check if this object can be targeted by single-target abilities

bool is_aoe_targetable() ​

Check if this object can be hit by AoE abilities

bool is_locked() ​

Check if this object is locked

bool has_animation( anim_name: String ) ​

Check if an animation is available

Array[String] get_available_animations() ​

Get all available animation names

void set_targeting_config( directly_targetable: bool, aoe_targetable: bool ) ​

Set targeting configuration and auto-update stats flag

void make_fully_targetable() ​

Configure as fully targetable destructible

void make_aoe_targetable_only() ​

Configure as AoE-only targetable (common for environmental objects)

void make_non_targetable() ​

Configure as non-targetable (pure interaction objects)

bool is_template() ​

Is this definition a template?