Area

Representation of an in game area See the Area guide for documentation on how to actually build areas.

Constructor

new Area()

Properties:
Name Type Description
bundle string

Bundle this area comes from

name string
title string
map Map

a Map object keyed by the floor z-index, each floor is an array with [x][y] indexes for coordinates.

rooms Map.<string, Room>

Map of room id to Room

npcs Set.<Npc>

Active NPCs that originate from this area. Note: this is NPCs that originate from this area. An NPC may not actually be in this area at any given moment.

info Object

Area configuration

lastRespawnTick Number

milliseconds since last respawn tick. See Area#update

Members

areaPath

Get ranvier-root-relative path to this area

floors

Get an ordered list of floors in this area's map

Methods

addNpc(npc)

Parameters:
Name Type Description
npc Npc

addRoom(room)

Parameters:
Name Type Description
room Room

addRoomToMap(room)

Parameters:
Name Type Description
room Room
Throws:

Error

getRoomAtCoordinates(x, y, z) → {Room|boolean}

find a room at the given coordinates for this area

Parameters:
Name Type Description
x number
y number
z number
Returns:
Room | boolean

getRoomById(id) → {Room|undefined}

Parameters:
Name Type Description
id string

Room id

Returns:
Room | undefined

removeNpc(npc)

Removes an NPC from the game and frees its place in its originating room to allow it to respawn

Parameters:
Name Type Description
npc Npc

removeRoom(room)

Parameters:
Name Type Description
room Room

update(state)

This method is automatically called every N milliseconds where N is defined in the setInterval call to GameState.AreaMAnager.tickAll in the ranvier executable. It, in turn, will fire the updateTick event on all its rooms.

Also handles firing the respawnTick event on rooms to trigger respawn.

Parameters:
Name Type Description
state GameState
See:
  • Room.respawnTick