Cell

Cell

A single cell on the board. Holds terrain, one optional agent, a list of items on the ground, and a list of active effects.

Cells do not fire DOM or network events — they notify the board, which fans out to any registered change listeners (e.g. the renderer).

Constructor

new Cell()

Source:

Classes

Cell

Members

animAgentSymbol

Description:
  • Per-cell animated agent symbol set by onFrame. Same mechanism as animTerrainSymbol but for the agent layer, allowing singleton agents to animate independently on each cell.

Source:

Per-cell animated agent symbol set by onFrame. Same mechanism as animTerrainSymbol but for the agent layer, allowing singleton agents to animate independently on each cell.

animItemSymbol

Description:
  • Per-cell animated item symbol set by onFrame. Same mechanism as animTerrainSymbol but for the topmost item.

Source:

Per-cell animated item symbol set by onFrame. Same mechanism as animTerrainSymbol but for the topmost item.

animTerrainSymbol

Description:
  • Per-cell animated terrain symbol set by onFrame. Equivalent to Java's fireRerender(cell, piece, symbol) — lets singleton terrain pieces render different symbols at different positions without lock-step.

Source:

Per-cell animated terrain symbol set by onFrame. Equivalent to Java's fireRerender(cell, piece, symbol) — lets singleton terrain pieces render different symbols at different positions without lock-step.

hasNoEffects

Description:
  • True if there are no active effects in this cell.

Source:

True if there are no active effects in this cell.

isBagEmpty

Description:
  • True if there are no items on the ground in this cell.

Source:

True if there are no items on the ground in this cell.

topEffect

Description:
  • The topmost effect, or null.

Source:

The topmost effect, or null.

topItem

Description:
  • The topmost item, or null.

Source:

The topmost item, or null.

visited

Description:
  • Breadcrumb counter: updated each time the player steps here. Used for pathfinding heuristics.

Source:

Breadcrumb counter: updated each time the player steps here. Used for pathfinding heuristics.

(static) Cell

Description:
  • Count of MEAT-flagged items on this cell. Mirrors Java's ItemBag.meatCount.

Source:

Count of MEAT-flagged items on this cell. Mirrors Java's ItemBag.meatCount.

Methods

canEnter()

Description:
  • Can an agent enter this cell from agentLoc in direction dir?

Source:

containsMeat()

Description:
  • True if at least one MEAT-flagged item is on the ground here. Mirrors Java's ItemBag.containsMeat().

Source:

containsPlayer()

Description:
  • True if the player is currently standing on this cell.

Source:

createCloud()

Description:
  • Spread an effect cloud from this cell to nearby penetrable cells within a radius of 2.5. Mirrors Java Cell.createCloud().

Source:

explosion()

Description:
  • Trigger a fire explosion at this cell, spreading to all adjacent cells whose terrain can be entered. Mirrors Java Cell.explosion().

Source:

getAdjacentCell()

Description:
  • The adjacent cell in the given direction, or null for vertical directions (UP/DOWN cross board boundaries, handled at a higher level).

Source:

getAdjacentCells()

Description:
  • Get the adjacent cells that this agent can enter from this cell.

Source:

getApparentTerrain()

Description:
  • The terrain as it should appear to the player. Subclasses that implement a TerrainProxy decorator should override this to return the wrapped terrain.

Source:

getDisplaySymbol()

Description:
  • Compute the display symbol for this cell by layering terrain → item → under-effects → agent → above-effects. Used by the board renderer.

    The layering order mirrors the original Java getCurrentSymbol() logic:

    1. terrain (or the piece being queried if it IS the terrain)
    2. top item (unless terrain has HIDES_ITEMS)
    3. under-effects (isAboveAgent === false)
    4. agent
    5. above-effects (isAboveAgent === true)
Source:

moveAgentTo()

Description:
  • Move an agent from this cell to another cell in one operation (more efficient than remove + set, avoids creating an intermediate state).

Source:

onSteppedOn()

Description:
  • Notify items on this cell that an agent has stepped onto it.

Source:

openContainer()

Description:
  • Open a container (Chest, Crate, etc.): change the terrain to the empty state, add items to the player's bag, and fire a message.

Source:

removeAgent()

Description:
  • Remove the given agent from this cell (no-op if agent is null or differs).

Source:

removeItem()

Description:
  • Remove the last occurrence of the given item from this cell.

Source:

setAgent()

Description:
  • Place an agent on this cell. Any previously present agent is cleared first. Do NOT pass null — use removeAgent() to clear.

Source:

setTerrain()

Description:
  • Replace the terrain on this cell. Fires a cell-change notification.

Source: