pub struct Trigger {
pub id: String,
pub map_id: String,
pub trigger_type: TriggerType,
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
pub script_name: String,
pub one_shot: bool,
pub fired: bool,
}Expand description
A trigger bound to a specific tile or rectangular area on a map.
When the player satisfies the trigger_type
condition (stepping on, entering, or interacting with the tile), the
associated script_name is returned so the game
loop can call the corresponding JS function on the script engine.
Fields§
§id: StringUnique identifier for this trigger (e.g. "start_town_prof").
map_id: StringThe map this trigger lives on (e.g. "StartTown").
trigger_type: TriggerTypeWhen the trigger fires — every frame (OnStep),
once on entry (OnEnter), or on A-press
(OnInteract).
x: u32Top-left X coordinate of the trigger area (in tile units).
y: u32Top-left Y coordinate of the trigger area (in tile units).
width: u32Width of the trigger area in tiles. 1 for a single-tile trigger;
larger values for rectangular area triggers.
height: u32Height of the trigger area in tiles.
script_name: StringName of the exported JS async function to call when this trigger fires.
one_shot: boolIf true, the trigger fires only once and then is permanently disabled.
fired: boolWhether this trigger has already been activated (relevant for one-shot
triggers). Call TriggerManager::reset_fired_for_map to re-enable
triggers after re-entering a map.