five-on-it / packages/sim/src/sinking
packages/sim/src/sinking
Cars in water and lava (water.ts): every tick after the physics step, a car in a surface is slowed by it (it sinks to the bottom rather than falling through), and one whose middle has sunk under the surface floods: wrecked, everyone in it put out, into the water. Lava wrecks a car the moment it touches it. A boat floats on its own (boat.ts): the water takes it only once it has flooded (wrecked, VehicleState.flood at 1), and then it sinks like a car, its people put out to swim when its middle has gone under; lava wrecks it as it does a car.