five-on-it / packages/sim/src/damage
packages/sim/src/damage
Health and damage: every character and every vehicle has hit points. A hit takes some off and is recorded as an event (the renderers log it and draw a spark); at zero a character falls and lies dead until it respawns, a vehicle is wrecked and answers nobody until it is reset. A character hidden behind cover, or seated (its car takes the shots), cannot be hurt, but for a wreck's crash, which hurts the people in it by its violence (hurtOccupants). Trailers pass their hits on to their tractor. An invincible character (a debug switch) is hit and shrugs it off, and so does the car it drives; so does a ghost, and a player a hit of another player may not hurt (the game's player damage, its safe zones, a party under rivals: griefing.ts). A security camera takes hits too, and is destroyed at zero. A hit may be non-lethal (a tranquilizer dart, a knockout): it never kills. A dog (dogs.ts) has few hit points and stays on its feet until they are gone: a hit that leaves it alive sends it bolting instead.
Variables
- COVER_EXPOSED
- COVER_HIDDEN
- COVER_NONE
- CRASH_WEAPON
- DOG_HEALTH
- EXPLOSION_WEAPON
- FALL_WEAPON
- FIRE_WEAPON
- LAVA_WEAPON
- MAX_HEALTH
- PEDESTRIAN_HEALTH
- PLAYER_HEALTH
- VEHICLE_HEALTH
- WATER_WEAPON