Skip to content

five-on-it / packages/ai/src/holdup

packages/ai/src/holdup ​

Hold-ups (GAME_DESIGN §8, §9): a gun aimed at a person from close holds it up. Run by aiSystem before the NPCs decide, in entity order:

  • Who: a sentry of stealth (a guard, a civilian) or a role NPC on foot (a target, a witness, a hostage), awake, in the world. A player aims at it a gun (no fists, no dart, no grenade) from within HOLDUP.range on its floor, the aim within cone of it, with a clear line between them, and not from behind cover.
  • Complying: its hands go up (@foi/sim's holdUp: what it carried laid at its feet, its weapon among them), it stands still facing the gun, and after kneelSeconds it kneels, hands on its head. A witness held up drops the call it was making. Once no gun has been on it for releaseSeconds it is free again: a guard turns on whoever held it up (alert, after them), a civilian runs, a target runs for its refuge, a witness runs to call again. Restrained (holds.ts' restrain), it stays so, whatever the guns do; freed by somebody else (a colleague, a player), it reacts as when it is let go.
  • Refusing: a guard on the alert never complies; an armed guard that sees the gun refuses with a refuse chance, drawn from the AI's own stream once every refuseSeconds, and fights (alert, after the player).
  • A hostage (roles.ts) not tied up is taken instead: it follows the player who aimed at it.

What it remembers (HoldupState) is part of the AI's hash; the captive state is the simulation's (captives.ts). A captive's brain rests: captiveStep writes its input.

Interfaces ​

Variables ​

Functions ​