Skip to content

twine / AreaTrigger

Type Alias: AreaTrigger

AreaTrigger = { center: Vec3; kind: "region"; radius: number; } | { from: Vec3; kind: "cuboid"; to: Vec3; } | { kind: "zones"; zones: Zone[]; } | { equals: number; kind: "score"; objective: string; target: string; }

Defined in: area.ts:40

Declares how an area switches itself on. The factory emits a cheap per-tick detector for the area; presence triggers (region/cuboid/zones) are tracked both ways - the area turns on while a player is inside and off once the region empties - while score latches on until something calls deactivate.

  • region - a single sphere: shorthand for one sphere Zone.
  • cuboid - a single axis-aligned box between two corners.
  • zones - a union of any number of spheres/boxes; a player anywhere inside the union counts. Use this to fence off an irregular area out of several boxes, or to cover several rooms with one flag.
  • score - activate when #<target> <objective> equals equals (drive levels/quests from your own scoreboard state).

Areas with no trigger are activated manually (/function <ns>:<name>/activate) or by another module.

Released under the MIT License · Credits