TriggerOnceOnPickup

TriggerOnceOnPickup

A one-shot trigger that fires when a specific item is picked up from this cell. The item is matched by its exact name or by a flag string (using _itemMatchesFlag). Once it fires it removes itself, so it will never fire again.

Typical use: react to the player collecting a key item from a location — e.g. the moment the player lifts the Amulet off a pedestal — then vanish so the event fires only once.

Constructor

new TriggerOnceOnPickup(terrain, color, flagStr)

Source:
Parameters:
Name Type Description
terrain Terrain

The underlying terrain this decorator wraps.

color Color

Color event broadcast to the board on firing.

flagStr string

Item name or flag string that must match the picked-up item to trigger the event.

Extends

Classes

TriggerOnceOnPickup

Members

terrain :Terrain

Source:
Overrides:
Type:

Methods

getProxiedTerrain()

Description:
  • Return the terrain being wrapped (TerrainProxy interface).

Source:
Overrides:

onPickupInternal(event, cell, _agent, item)

Description:
  • Fires the color event and removes this trigger when the picked-up item matches TriggerOnceOnPickup#flagStr by name or by flag. Skips silently when the event is already cancelled or the item does not match.

Source:
Parameters:
Name Type Description
event GameEvent
cell Cell
_agent Agent

Unused; the agent performing the pickup.

item Item

The item being picked up.