Skip to content

CanHarvest beta ​

Interface of @v12-engine/engine

ts
export interface CanHarvest

Whether a worker may gather from a resource: by default, a resource of a kind it gathers (harvester.ids). Refuse it for a game's own rule: a mine only its owner's cursed mine stands on, a tree of a sacred grove. Asked when it is told to, and of every resource it would go on to by itself

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 refused it; set by cancel()

reason ​

ts
reason?: MessageRef;

What the player is told when it is refused

source ​

ts
readonly source: Entity;

The resource entity it would gather from

worker ​

ts
readonly worker: Entity;

The worker that would gather