five-on-it / packages/ai/src/police-heat
packages/ai/src/police-heat
Two kinds of Heat (GAME_DESIGN §12, M1): the person's (wanted.ts) and the car's. When the police see a wanted player in a car, the car takes the player's stars as its own (a record in the police's book, heatCar), and from then on the police hunt whichever they see:
- A car with Heat seen (by an officer of any kind or a drone) makes whoever plays in it wanted at the car's stars at least, whoever that is (carHeatSystem); seen empty, it is where the police look for its player while they do not see them.
- A person on foot seen keeps their own stars, recognised by their face.
- R12, swapping cars in a blind spot. A wanted player who gets into a car without Heat with none of the police's eyes on them (no unit, drone, camera, citizen) is not known in it (noteVehicle): the police seeing that car see somebody else (knownIn), so the player's own Heat cools as if unseen (they are still wanted), while the old car keeps its Heat and is hunted until it cools.
- R29, the disguise. A change of clothes put on with nobody watching (changeClothes) clears their sightings on foot: their stars drop by two (never below one while a car of theirs has Heat) and the police do not know them on foot, nor in a car without Heat, until they commit a crime again. Seen changing, it is no disguise.
- R38, fake plates (clearCarHeat, a gadget at the wheel, a respray) clear a car's Heat, never the person's.
- R39, an emergency vehicle. At the wheel of an ambulance or a fire truck with its lights on, a player below six stars is not known for what they are (emergencyCover).
A car's stars cool as a person's do (WANTED.loseSeconds, from the last time it was seen with a wanted player in it), one at a time, and the record goes at none or with the car. A crime charged makes the player known again (police.ts). Deterministic: the records in the order they were made, the players by client id.