PlayerGate

PlayerGate

Blocks the player from entering this cell unless they possess a specific flag or item. An optional modal message is shown when movement is blocked, matching the conversational feel of an NPC gate.

Typical use: pair with an NPC to simulate a guard who refuses to let the player pass until a condition is met — e.g. require the player to carry a Pass before crossing a checkpoint.

Constructor

new PlayerGate(terrain, testable, message)

Source:
Parameters:
Name Type Description
terrain Terrain

The underlying terrain this decorator wraps.

testable string

Flag name or item name the player must possess to pass.

message string | null

Optional modal message shown when the player is blocked.

Extends

Classes

PlayerGate

Members

terrain :Terrain

Source:
Overrides:
Type:

Methods

getProxiedTerrain()

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

Source:
Overrides:

onEnterInternal(event, player, cell, _dir)

Description:
  • Cancels the movement event if the player does not satisfy PlayerGate#testable, optionally showing a modal message first. Skips silently when the event is already cancelled.

Source:
Parameters:
Name Type Description
event GameEvent
player Player
cell Cell
_dir Direction

Unused.