five-on-it / packages/sim/src/garages
packages/sim/src/garages
Garages (GAME_DESIGN §5.5): bays of the level (LevelData.garages) a car drives into and stops in. At the wheel of a car standing still in a bay, the garage offers what it does, each for its price in dollars (the game's rules over the level's; paid from the player's Cash, cash.ts), and the input's service takes it:
- Respray (1): the car takes the next paint of PAINTS (
Vehicle.paint), repaired, its tyres new; the server's police clear the player's Wanted level unless they saw the player go in (@foi/ai'swanted.ts, from theresprayevent). - Store (2): everyone gets out (the driver where the car stood), and the car is kept for the player in the room (storedCars: its class, paint and key), gone from the world. Any car but another player's can be stored, and is the player's then.
On foot in the empty bay of a garage that stores, the interaction key says Take out when the player has a car stored: the last one stored is put in the bay facing out of its door, the player's and open, and the player at its wheel (interaction.ts).
The services and the take-out are the server's: the clients never predict them (the snapshots and the inventory message say what came of them). Each raises an event (respray, store, takeOut) the missions read.