five-on-it / apps/client/src/renderer/car-doors
apps/client/src/renderer/car-doors
The cars' doors swinging open and shut: a door opens when someone gets in or out of a seat (a player, an NPC, the player's own character: whoever the snapshots show going from on foot to a seat or back), the doorway the person stood at (the one nearest where it got out, or where it was last seen on foot getting in: the simulation gets people in and out by the seat's door, or by another when that one is blocked), else the seat's; it opens already as someone starts getting in at a door (the simulation's enter act, a third of a second at the door before it is seated) and stays open through it; and a carjack holds the driver's open while the carjacker pulls the driver out and takes the wheel (the carjack event, for the simulation's half-second beat). Nothing of it is the server's: the client reads the seats, the poses and the acts its snapshots already carry. A door opens in a fifth of a second, stays open a moment (while the person steps in or out) and shuts in a little more, eased at both ends; the vehicle model says which doorway serves which seat and how far each door swings (models.ts). Someone seen for the first time already seated opened nothing.