ListenerDef beta
Interface of @v12-engine/engine
ts
export interface ListenerDefHow a game reacts to an event: the engine's ('entityDied', 'enteredArea') or one of its own. Listeners are given in Rules.listeners, and the world subscribes them when it is made, in their order: a new game, a loaded save and every player's machine get the same ones. They run at the end of the tick, once everything in it is settled, and may change the world: what happens then is part of that tick. One with the id of another takes its place, in a mod
Members
event
ts
event: EventKey<any>;The event it reacts to
id
ts
id: string;The listener's id; a listener of another with the same id takes its place
run
ts
run(world: World, payload: any): void;Reacts to one occurrence of the event, with the world and the event's payload