Skip to content

TimerDef beta ​

Interface of @v12-engine/engine

ts
export interface TimerDef<T = any>

Something a game does after a while, or every so often: a wave coming, a spell wearing off, a line of dialog. Made with defineTimer and given in Rules.timers, the way listeners are, so that a loaded save finds the code by id: what is waiting in the world is data, which timer and with what, never a function

Members ​

id ​

ts
readonly id: string;

Shared by every game, like other ids: give it a prefix of the game's ('td.waveComes')

run ​

ts
run(world: World, data: T, timer: TimerInfo): void;

What happens when the timer goes off: given the world, the data it was set with and which timer this is