MobFactory

Stores definitions of npcs to allow for easy creation/cloning

Constructor

new MobFactory()

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(item) → {Item}

Clone an existing item. Resulting item 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 item.hydrate(state)

Parameters:
Name Type Description
item Item
Returns:
Item
Inherited From:

create(area, entityRef) → {Npc}

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

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

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: