BeforeProduce beta
Interface of @v12-engine/engine
ts
export interface BeforeProduceSomething about to be made: a unit trained, an upgrade researched, a building upgraded, a hero brought back, a structure put down by a worker. Change what it costs and how long it takes, or call it off with a reason
Members
cancel
ts
cancel(reason?: MessageRef): void;Stops it. The reason is what the player is told, where this hook tells them (reason)
cancelled
ts
cancelled: boolean;Whether a handler has called it off; set by cancel()
cost
ts
cost: Cost;What it costs the player; a handler may change it
id
ts
readonly id: string;Unit type, upgrade, the type a building becomes, the id of a hero, or a structure type
kind
ts
readonly kind: ProductionKind;What is being made: unit, upgrade, morph, revive or structure
player
ts
readonly player: PlayerId;The player the production is for
producer
ts
readonly producer: Entity;The building it is made in, or the worker putting down a structure
reason
ts
reason?: MessageRef;What the player is told of why it was called off
time
ts
time: number;Seconds it takes