Item

new Item()

Properties:
Name Type Description
area Area

Area the item belongs to (warning: this is not the area is currently in but the area it belongs to on a fresh load)

metadata object

Essentially a blob of whatever attrs the item designer wanted to add

behaviors array | string

Single or list of behaviors this object uses

description string

Long description seen when looking at it

id number

vnum

isEquipped boolean

Whether or not item is currently equipped

inventory Map

Current items this item contains

name string

Name shown in inventory and when equipped

room Room

Room the item is currently in

roomDesc string

Description shown when item is seen in a room

script string

A custom script for this item

type ItemType | string
uuid string

UUID differentiating all instances of this item

closeable boolean

Whether this item can be closed (Default: false, true if closed or locked is true)

closed boolean

Whether this item is closed

locked boolean

Whether this item is locked

lockedBy entityReference

Item that locks/unlocks this item

Mixes In:

Extends

  • EventEmitter

Methods

addItem(item)

Add an item to this item's inventory

Parameters:
Name Type Description
item Item

close()

Fires:

findOwner() → {Player|null}

For finding the player who has the item in their possession.

Returns:
Player | null -

owner

getBehavior(name) → {*}

Parameters:
Name Type Description
name string
Returns:
*

hasBehavior(name) → {boolean}

Parameters:
Name Type Description
name string
Returns:
boolean

initializeInventory(inventory)

Create an Inventory object from a serialized inventory

Parameters:
Name Type Description
inventory object

Serialized inventory

isInventoryFull() → {boolean}

Returns:
boolean

lock()

Fires:

open()

Open a container-like object

Fires:

removeItem(item)

Remove an item from this item's inventory

Parameters:
Name Type Description
item Item

unlock()

Fires:

Events

closed

locked

opened

unlocked

updateTick