five-on-it / packages/ai/src/arms
packages/ai/src/arms
An NPC's weapons are items in its pockets, as a player's are in their inventory (GAME_DESIGN §7.4): armNpc puts a weapon and a full stack of its ammunition there when it is spawned (a chaser that shoots its profile's weapon, and the pistol a crew shoots out of its car's windows; a guard its own; an officer always carries its pistol), so a searched body gives them up. Each tick the NPC's input selects the slot that holds the weapon its profile shoots (npcSlot); once its ammunition runs out it holds its fists instead, and fights at arm's length (fireReach).