Skip to content

SetCarrying

Switches the players’ own grab on or off, with its rules.

On, the game’s “grab” prompt shows on a body that lies down - a dead character’s, a knocked-out player’s or actor’s, as the rules allow - and a player’s ask is checked (the reach, that nobody else has the body, OnPlayerCarry). Off by default. A carry that runs goes on when it is switched off; the mode’s own orders (CarryPlayer, CarryEntity, ActorCarryEntity, ActorCarryPlayer) do not need it.

rules is a table, every key optional: range (metres a player may stand from the body when they reach for it, 3; a value is held between 0.5 and 6, and a player’s own ask is checked against the range plus a metre - 7 at the most - because the games’ positions are a few frames old), speed (the carrier’s pace in metres per second, 2.4; held between 0.5 and 4), corpses (the prompt works on a dead body, true), players (on a knocked-out player, true), actors (on a knocked-out NPC actor, true). Without rules the earlier ones stay. A rules table that leaves a key out puts that key back to its default, not to what an earlier call set: pass every rule you want to keep each time.

A mode reload (ReloadGameMode) switches the grab off again and resets the rules: the new mode’s OnGameModeInit sets what it wants. The world state key carry is the server’s (see the group’s description) - this call writes it.

SetCarrying(enabled [, rules])
Parameter Type
enabled boolean true shows the prompt and answers asks; false (the default) takes it away
rules table {range, speed, corpses, players, actors} - what the grab takes and how fast the carrier walks (optional)

nothing

function OnGameModeInit()
SetCarrying(true, {range = 2.5, speed = 2, players = true, corpses = true, actors = false})
end

GetCarrying · OnPlayerCarry · CarryPlayer · SetEntityCarryable · the Carrying group of the index