Skip to content

BeforeDeath beta ​

Interface of @v12-engine/engine

ts
export interface BeforeDeath

Something is about to die. cancel() keeps it alive: it is then up to the handler what health it has

Members ​

attack ​

ts
readonly attack: boolean;

An attack of the killer did it

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()

cause ​

ts
readonly cause?: DeathCause;

The blow that did it, when it ran out of health

entity ​

ts
readonly entity: Entity;

The entity about to die

fromDamage ​

ts
readonly fromDamage: boolean;

It ran out of health, rather than being removed by the rules (felled, expired, cancelled)

killer ​

ts
readonly killer?: Entity;

The entity that killed it, left out when nothing did

reason ​

ts
readonly reason: DeathReason;

Why it dies (DeathReason): damage, or what the rules said (cancelled, expired, a game's own word)