Skip to content

five-on-it / apps/client/src/renderer/vehicle-fire

apps/client/src/renderer/vehicle-fire ​

Cars smoking and on fire, every frame, for every car on screen (the player's and everyone else's), as the snapshots carry them (the simulation's fire.ts lights and blows them up; the client only draws it):

  • Smoking. A car at SMOKE_HEALTH hit points or below, not yet wrecked nor on fire, smokes out of its engine bay: a thin light grey at first, thicker and darker the lower it gets (smokeOf). It warns that the car is about to catch fire.
  • Burning. Flames out of the engine bay, growing over the first seconds it burns (flameRate), and black smoke over them, while its fuse runs on the server.
  • Blown up. The whole wreck in flames while it still burns, then only the wreck's smoke (wreck-smoke.ts).
  • In water (CarView.inWater). Neither smoke nor flames: a car driven into water stops smoking and burning within wreck-smoke.ts' DOUSE_SECONDS (what is already out drifts off and dies as it does), before the server's word that its fire is out arrives, and starts again only once it is out of the water.

The cars are remembered by id while they burn (when they caught fire), and forgotten once they no longer do; how much smoke each keeps out of water, while it is on screen.

Variables ​

Functions ​