Area()

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

new Area()

Properties:
Name Type Description
bundle string

Bundle this area comes from

name string
title string
script string

A custom script for this item

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

Extends

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

addRoomToMap(room)

Parameters:
Name Type Description
room Room
Throws:

Error

getBroadcastTargets() → {Array.<Broadcastable>}

Get all possible broadcast targets within an area. This includes all npcs, players, rooms, and the area itself

Returns:
Array.<Broadcastable>

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 area. NOTE: This must manually remove the NPC from its room as well

Parameters:
Name Type Description
npc Npc

removeRoom(room)

Parameters:
Name Type Description
room Room
Fires:

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

Parameters:
Name Type Description
state GameState
Fires:

Events

channelReceive

Docs limit this to be for GameEntity (Area/Room/Item) but also applies to NPC and Player

Parameters:
Name Type Description
channel Channel
sender Character
rawMessage string
Inherited From:

roomAdded

Parameters:
Name Type Description
room Room

roomRemoved

Parameters:
Name Type Description
room Room

updateTick

See: