RoomFactory()

Stores definitions of npcs to allow for easy creation/cloning

new RoomFactory()

Extends

Methods

addScriptListener(entityRef, event, listener)

Add an event listener from a script to a specific item

Parameters:
Name Type Description
entityRef string
event string
listener function
Inherited From:
See:
  • BehaviorManager::addListener

clone(entity) → {Item|Npc|Room|Area}

Clone an existing entity.

Parameters:
Name Type Description
entity Item | Npc | Room | Area
Returns:
Item | Npc | Room | Area
Inherited From:

create(area, entityRef) → {Room}

Create a new instance of a given room. Room will not be hydrated

Parameters:
Name Type Description
area Area
entityRef string
Returns:
Room

createByType(area, entityRef, Type) → {type}

Create a new instance of a given npc definition. Resulting npc will not be held or equipped and will not have its default contents. If you want it to also populate its default contents you must manually call npc.hydrate(state)

Parameters:
Name Type Description
area Area
entityRef string
Type Class

Type of entity to instantiate

Returns:
type
Inherited From:

createEntityRef(areaName, id) → {string}

Create the key used by the entities and scripts maps

Parameters:
Name Type Description
areaName string
id number
Returns:
string
Inherited From:

getDefinition(entityRef) → {Object}

Parameters:
Name Type Description
entityRef string
Returns:
Object
Inherited From:

setDefinition(entityRef, def)

Parameters:
Name Type Description
entityRef string
def Object
Inherited From: