Room

new Room()

Listens to Events:
  • Room#event:updateTick
Properties:
Name Type Description
area Area

Area room is in

defaultItems Array.<number>

Default list of item ids that should load in this room

defaultNpcs Array.<number>

Default list of npc ids that should load in this room

description string

Room description seen on 'look'

exits Array.<object>

Exits out of this room { id: number, direction: string, leaveMessage: string }

id number

Area-relative id (vnum)

items Set

Items currently in the room

npcs Set

Npcs currently in the room

players Set

Players currently in the room

script string

Name of custom script attached to this room

title string

Title shown on look/scan

Extends

  • EventEmitter

Members

spawnedNpcs

spawnedNpcs keeps track of NPCs even when they leave the room for the purposes of respawn. So if we spawn NPC A into the room and it walks away we don't want to respawn the NPC until it's killed or otherwise removed from the area

Methods

addItem(item)

Parameters:
Name Type Description
item Item

addNpc(npc)

Parameters:
Name Type Description
npc Npc

addPlayer(player)

Parameters:
Name Type Description
player Player

emit(eventName, …args) → {void}

Emits event on self and proxies certain events to other entities in the room.

Parameters:
Name Type Attributes Description
eventName string
args * <repeatable>
Returns:
void

getBehavior(name) → {*}

Parameters:
Name Type Description
name string
Returns:
*

getBroadcastTargets() → {Array.<Character>}

Used by Broadcaster

Returns:
Array.<Character>

hasBehavior(name) → {boolean}

Parameters:
Name Type Description
name string
Returns:
boolean

removeItem(item)

Parameters:
Name Type Description
item Item

removeNpc(npc)

Parameters:
Name Type Description
npc Npc

removePlayer(player)

Parameters:
Name Type Description
player Player

removeSpawnedNpc(npc)

Parameters:
Name Type Description
npc Npc

respawnTick(state)

Parameters:
Name Type Description
state GameState

spawnItem(state, entityRef)

Parameters:
Name Type Description
state GameState
entityRef string

spawnNpc(state, entityRef)

Parameters:
Name Type Description
state GameState
entityRef string
Fires: