Passer au contenu principal

dispatch()

world.events.dispatch(target, name, data)

Description

Used to emit events that the listeners can listen to.

Parameters

PropertyTypeDescription
targeteidThe entity that is you want the dispatch to target.
namestringThe name of the event you want to dispatch.
data (optional)unknownCustom data that is optionally emitted by the dispatch call.

Returns

None.

Example

// This line emits an event to the eid of an enemy entity with the name attack with the
// damage the attack caused stored as the data parameter.
world.events.dispatch(eidOfEnemy, "attack", {damage: 10})