five-on-it / packages/sim/src/captives
packages/sim/src/captives
Captives (GAME_DESIGN §8, §9): people held up at gunpoint, kneeling, restrained. Who holds whom up is the AI's to decide (@foi/ai's holdup.ts: a gun aimed from close, a guard that complies or refuses); what a captive is, the simulation keeps, so that every side agrees on it:
- its hands up (
handsUp): held up, it lets go of what it carried (its pockets laid at its feet, its weapon among them) and stands still, its hands raised; - kneeling (
surrendered): kneeling, its hands on its head, after a while held up; - restrained (
restrained): its hands tied behind its back, kneeling, for good, until somebody frees it. A player restrains a captive by holding the interaction key at it (holds.ts'restrain), and frees a restrained one the same way (free: a hostage, or a guard's colleague, whom a guard frees by walking up to it).
A captive stands still and fires nothing whatever its input says (character.ts). Lying down (asleep, knocked out) it is held up no more, but a restrained one stays restrained; dead or back at a spawn point, it is free. Every change raises a captive event (weapon the new state's index in CAPTIVE_STATES, owner the player behind it), which the AI reads (a freed hostage follows its rescuer). The state and its captor are components, hashed with the rest; the snapshots carry them as the act (acts.ts).