SetItemCarrying
Switches the players’ own pickup of carry items on or off, with its rules.
On, a carry item shows the game’s “Pick up” prompt to a player within reach whose hands are free, and his ask is checked (the
reach, that nobody else holds it, OnPlayerPickUpCarryItem). Off by default. A carry that runs goes on when it is switched
off; the mode’s own orders (PickUpCarryItem, GivePlayerCarryItem) do not need it.
rules is a table, every key optional: range (metres a player may stand from the item when he reaches for it, 2.5; held at
4 at the most - a player’s ask is checked against the range plus a metre, because the games’ positions are a few frames old).
Without rules the earlier ones stay; a rules table that leaves a key out puts that key back to its default. A mode reload
(ReloadGameMode) switches the pickup off again and resets the rules. The world state key carryitems is the server’s - this
call writes it.
Syntax
Section titled “Syntax”SetItemCarrying(enabled [, rules])| Parameter | Type | |
|---|---|---|
enabled |
boolean | true shows the prompt and answers asks; false (the default) takes it away |
rules |
table | {range} - how far a player may reach (optional) |
Returns
Section titled “Returns”nothing
Example
Section titled “Example”function OnGameModeInit() SetItemCarrying(true, {range = 2})endSee also
Section titled “See also”GetItemCarrying · OnPlayerPickUpCarryItem · CreateCarryItem · SetEntityCarryable · the Carry items group of the index
