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
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

Methods

addNpc(npc)

Parameters:
Name Type Description
npc Npc

addRoom(room)

Parameters:
Name Type Description
room Room

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