five-on-it / packages/sim/src/griefing
packages/sim/src/griefing
The griefing controls the simulation keeps (GAME_DESIGN §13): who may hurt whom, the game's safe zones, the parties and the ghost a player is for a few seconds after respawning. They are the game's rules (SimRules) applied tick by tick, deterministic and part of the world's hash (Character.ghost, Character.party).
- Player damage. A hit dealt by a player (a shot, a blast, a car running someone down) on another player's character, or on a car another player sits in, deals nothing when the game's
playerDamageisoff, when it isrivalsand the two are in one party, when either player stands in a safe zone, or when the one hit is a ghost (mayHurt). Hits from nobody (a crash, an NPC) are not a player's and always count; a ghost shrugs them off too. - Safe zones. Circles of the level (a game's zones that its rules name): inside one no player hurts another and no car is carjacked (inSafeZone).
- Parties.
Character.party(0 for none): a party member is never carjacked nor put out of a car by another, and underrivalsnever hurt by another (sameParty). - Ghosts. A player who comes back after lying dead is a ghost for the game's
ghostTicks: its capsule passes through cars and people (Rapier collision groups: the cars', the people's and the ghosts' own,GHOST_GROUPS), the cars' wheels ride over nothing where it stands, and it takes no harm; then it is solid again (ghostTick). Only players respawn as ghosts; the client's twin of a ghost is one too, from the snapshots, so prediction agrees. - Respawn points. Where a dead player comes back: the place the server set (setRespawn, the start of their mission under a game's
respawn: mission), else the nearest spawn point (the "hospital").