Skip to content

five-on-it / packages/sim/src/grappler

packages/sim/src/grappler ​

The Grappler (C3, GAME_DESIGN §12 at seven stars): a police cruiser's bumper net that catches the rear wheel of the car ahead and drags it to a stop. A cruiser is fitted with one by the police (@foi/ai), the net drawn on its bumper (VehicleState.grappler, on the wire).

  • The hook (grappleSystem): a fitted cruiser with a live driver whose nose comes within GRAPPLER.reach of the rear of a car a player drives, square behind it, closing slower than GRAPPLER.closing (15 km/h), hooks it: the car is held (VehicleState.hooked, and which cruiser holds it, hookedBy), a hook event. A car heavier than GRAPPLER.heavy (the APC, the armoured limo: R5) is never held: it snaps the net at once.
  • The tether: a held car's engine drives it no further forward and its brakes drag at GRAPPLER.drag of their force, so it slows to a stop in three seconds or so (vehicle.ts reads the flag); the officers then pull its driver out as at any car standing still (@foi/ai's police).
  • The escapes: its driver pulling hard in reverse for a second snaps it; so does the cruiser's driver shot at the wheel (one that got out to make the arrest leaves the cruiser parked, the net holding), the cruiser wrecked or gone, or the two pulled more than GRAPPLER.tether apart. A snap is a hook event too, and the cruiser's net takes GRAPPLER.resetTicks to be ready again (VehicleState.grappler counts them down).

Deterministic and hashed. The hook is the server's (a client's twins of the police's cars are fitted with nothing), but a client's predicted car is held as the server's is (the snapshots carry hooked, setHooked): its drag, and the snap of a hard reverse, replay as on the server.

Variables ​

Functions ​