five-on-it / apps/client/src/renderer/anim-state
apps/client/src/renderer/anim-state
The people's animation state machine, a pure function: from what the client knows of a person (its speed and footing, its status, its seat, its cover, its weapon, what it does with its hands, its role and a guard's alert) to the clips it plays (clips.ts): a base clip for the whole figure and, over it, an upper clip for some upper parts (a weapon held, the phone, a guard's look around) that leaves the legs to the base. One-shots (a shot's recoil, a punch, a landing, a door) are not states: the figure plays them on top when something happens (oneShotOf, figure.ts).
The priorities, first that holds: dead, then lying (asleep, knocked out, stunned, down), sitting on a bench, seated (each seat's pose; pedalling a bicycle; slumped, dead in its seat), a carjack's beat, getting in at a car's door or standing at it just out (the enter and exit acts), cover (crouched behind low cover, flat against tall cover, still or moving; popped up to aim), in the air (rising, falling a little, falling far), busy on the ground (searching a body, rummaging in a container, picking a lock, hacking, planting a bomb, defusing one, repairing: the interaction key held at a device; restraining somebody; held up, its hands up, kneeling, restrained; a body dragged; a pose it was told to hold: dancing, leaning on a wall, smoking, sitting, lying down), then on its feet (a box carried in both hands, carry, over the legs): standing (a guard at its post looking around, suspicious, a shopkeeper's crossed arms, a smoker's cigarette, a vendor leaning on its counter, one in three in a bus queue eating, a partier's dance, a mechanic at work) or moving (a walk, a run, fleeing with the arms up, the pedestrians' strolls, brisk walks and jogs, a dog walker's lead held out while its dog is on it, a sweeper's broom). A punch thrown with a crowbar in the hand is a swing of it.
The client fills an AnimInput from its local world for the player and from the snapshots for everyone else (remotes.ts, riders.ts): nothing here reads either.