Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

checkTarget

checkTarget<Check>(world, from, target, check?): TargetRefusalOf<Check> | undefined

Checks that from may act on target, in the order the engine’s cast checks it: Refusal.NoTarget where it is missing, from itself, gone, not targetable, downed or out of health, then, each only where check asks, NotHostile, OutOfRange and NoLineOfSight; undefined where it passes. A target with no health counts as standing, so a chest or a door passes where a press asks no more. Refuse a press with what it returns, press.refuse(refusal), at the press for what a player sees as the player presses, such as range, and again as the action lands for what may have changed, such as sight.

Type Parameter Default type
Check extends TargetCheck Record<never, never>
Parameter Type
world World
from Entity
target Entity | null | undefined
check? Check

TargetRefusalOf<Check> | undefined