new EntityFactory()
Methods
-
addScriptListener(entityRef, event, listener)
-
Add an event listener from a script to a specific item
Parameters:
Name Type Description entityRefstring eventstring listenerfunction - See:
-
- BehaviorManager::addListener
-
clone(entity) → {Item|Npc|Room|Area}
-
Clone an existing entity.
-
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 areaArea entityRefstring TypeClass Type of entity to instantiate
Returns:
type -
createEntityRef(areaName, id) → {string}
-
Create the key used by the entities and scripts maps
Parameters:
Name Type Description areaNamestring idnumber Returns:
string -
getDefinition(entityRef) → {Object}
-
Parameters:
Name Type Description entityRefstring Returns:
Object -
setDefinition(entityRef, def)
-
Parameters:
Name Type Description entityRefstring defObject