SetCarryItemUse
Makes the left mouse button the mode’s while a player holds a carry item - one item, or every item of a class.
Off by default: the left button stays the game’s. With it on, a player holding the item - a sack, a basket or a bucket the
game carries, or a lantern, a tool, a crate or a tankard in the hand - no longer punches with the left button: its press and
release go to OnPlayerUseCarryItem, and the corner’s key hints show the left button with label. label is shown as
written, or an "@key" of the game’s own texts in the player’s language; nil or "" shows the game’s own “Use” (“Drink”
on a tankard or a stein).
The button stays the game’s while the player has a weapon out or fists up, has a menu or the inventory open, or shows the
cursor - fighting never changes - and on every item that is not usable.
what is a carry item’s entity id, or an item class (its name, id or GUID) for every carry item of it - the ones lying now
and the ones made later. An item’s own setting wins over its class’s (SetCarryItemUse(id, false) keeps one item of a usable
class the game’s). A tankard or a stein made usable keeps its sip on the press, after OnPlayerUseCarryItem (false there
skips it). A mode reload (ReloadGameMode) makes every item the game’s again. The rule is shown to the games through the
entity state key carry_use: do not set it with SetEntityState yourself.
Syntax
Section titled “Syntax”SetCarryItemUse(what [, enabled, label])| Parameter | Type | |
|---|---|---|
what |
number|string | a carry item’s entity id, or an item class for all of its kind |
enabled |
boolean | true (the default) the button is the mode’s, false the game’s again (optional) |
label |
string | the hint’s text; "" the game’s own (optional) |
Returns
Section titled “Returns”boolean - false for an entity that is no carry item or a class the catalogue does not know
Example
Section titled “Example”-- every hammer strikes; this one lantern is raised to signalSetCarryItemUse("normalHammer", true, "Strike")local lantern = CreateCarryItem("lamp_tool", 512.4, 340.1, 31.2)SetCarryItemUse(lantern, true, "Signal")See also
Section titled “See also”GetCarryItemUse · OnPlayerUseCarryItem · CreateCarryItem · the Carry items group of the index
