Arming, trigger paths, hit effect
Gravity traps internals
A one-shot trap: arm a prop, and the first player who opens it or the first impact that destroys it fires a single expanding gravity wave with a configurable hit effect.
1. Arming
// server
[_crate, createHashMapFromArray [
["radius", 50], ["duration", 1], ["tolerance", 5],
["inventory", true], ["killed", true],
["onHit", { params ["_player", "_originASL", "_target"];
// custom server-side effect for each reached player
}]
]] call FF_horror_fnc_gravityTrapRegister;
| Key | Default | Meaning |
|---|---|---|
radius | 50 | Wave radius in metres. |
duration | 1 | Seconds the wave takes to reach the radius. |
tolerance | 5 | Distance tolerance applied when deciding whether a player was reached. |
inventory | true | Opening the target's inventory fires the trap. |
killed | true | Destroying the target fires the trap. |
onHit | faults both firearms | Server callback [player, originASL, target] for every reached player. |
A registered object is armed once. gravityTrapUnregister disarms it without firing, and registering an
already-armed object replaces its configuration.
2. Trigger paths
- Inventory open ? the client request is authenticated by
gravityTrapRequestbefore the server allows the inventory and fires the wave. - Destruction ? the target's killed handler fires the same wave once.
- Explicit ?
[target] call FF_horror_fnc_gravityTrapTriggerfrom mission code or a trigger.
All three paths converge on gravityTrapTrigger, which refuses a second fire, so a crate that is opened and
then destroyed only fires once.
3. Hit effect
The wave expands from the target's position. As it reaches each player, the server runs the onHit callback
once for that player with the wave origin and the trap object. The default effect uses the Utils weapon-fault service to
fault both firearms; local-only effects belong in an explicit owner dispatch inside your callback.
4. Authority and cleanup
The registry lives on the server: clients cannot arm, disarm or fire a trap, and the callback never reaches a client. Unregistering, deleting the target or ending the mission clears the registration; a fired trap stays registered but inert until released.
Verified offline: registration, single-fire state and callback dispatch. In-engine object locality and multiplayer behaviour remain a manual check.
Related functions
FF_horror_fnc_gravityTrapRegister— Arms an explicit object for a single expanding gravity trap.FF_horror_fnc_gravityTrapTrigger— Fires a registered trap once and applies its callback as the wave reaches players.FF_horror_fnc_gravityTrapUnregister— Disarms a registered gravity trap without triggering it.