client runtime · Lua API
Open77.consumables
Runs inside the game process. Reads and presentation are local; anything that changes shared state has to go through the server.
configure
Open77.consumables.configure(kind, options)Configures a grenade or healing kit.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Set record, count (0..999), capacity (1..999), equipped and recharge. Unknown options or count above an explicit capacity are rejected. Omitted fields preserve state; capacity grows to fit count if omitted. The first managed write defaults to recharge=false. See Grenades and healing items.
Parameters 2
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
options | table | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.configure("grenade", { record = "Items.GrenadeFragRegular", count = 5, capacity = 5, equipped = true, recharge = false })
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
equip
Open77.consumables.equip(kind, [record])Equips the selected consumable on its hotkey.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Optionally selects a new record. Omitting record uses the retained type and preserves its charges. Fails with no_consumable_type if none is available. See Grenades and healing items.
Parameters 2
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
record | string | optional | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.equip("healing", "Items.FirstAidWhiffV0")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
get
Open77.consumables.get(kind)Reads cached consumable state.
Client-only; requires player.weapons.read. Source is native_readback. Returns kind, record, tweakDbId, count, capacity, equipped, recharge, managed, sequence, reportedAgeMs and source. An unresolved native record name can be empty; use tweakDbId to identify it. Age measures time since observation, not a heartbeat. Use snapshot when fresh state is required. See Grenades and healing items.
Parameters 1
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
Returns
- state table or nil
- reason on failure
Example
CreateThread(function()
local result, reason = Open77.consumables.get("healing")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
reset
Open77.consumables.reset(kind)Releases managed consumable capacity and regeneration.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Restores the captured native regeneration policy and removes this API's capacity modifiers. Preserves the selected item, clamps excess charges to restored capacity, and leaves unrelated inventory and modifiers intact. See Grenades and healing items.
Parameters 1
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.reset("grenade")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
setCount
Open77.consumables.setCount(kind, count)Sets usable consumable charges.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Count is 0..999, not an inventory stack size. Zero retains the selected type without allowing a use. Capacity grows when needed. See Grenades and healing items.
Parameters 2
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
count | integer | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.setCount("grenade", 5)
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
setRecharge
Open77.consumables.setRecharge(kind, enabled)Controls native consumable regeneration.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Accepts a strict boolean. False gives a finite charge supply; true enables native regeneration. Native capacity and regeneration modifiers are released on reset or player/session replacement. See Grenades and healing items.
Parameters 2
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
enabled | boolean | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.setRecharge("healing", false)
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
setType
Open77.consumables.setType(kind, record)Changes the selected consumable type.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Preserves charges and equipped state. The record must resolve to the matching grenade, inhaler or injector type; an Items.* name alone is insufficient. See Grenades and healing items.
Parameters 2
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
record | string | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.setType("healing", "Items.FirstAidWhiffV0")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
snapshot
Open77.consumables.snapshot(kind)Requests fresh native consumable state.
Client-only; requires player.weapons.read. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Asynchronous readback of the actual selected type, charges, capacity, equipment and regeneration. Use get for a synchronous cached observation. See Grenades and healing items.
Parameters 1
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.snapshot("healing")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
unequip
Open77.consumables.unequip(kind)Clears the consumable hotkey and equipment slots.
Client-only; requires player.weapons.edit. Returns a request ID when queued, not when applied. Wait for open77:weapons:completed with operation consumable before another write to the same kit. Client completion accepted is a string; open77:consumables:state precedes completion. Native refusal includes consumable_busy, invalid_consumable_type and readback mismatches. Failed writes report observed partial state without atomic rollback. Preserves selected type and charges so equip can restore the kit. See Grenades and healing items.
Parameters 1
| Name | Type | Use | Default |
|---|---|---|---|
kind | "grenade" or "healing" | required | — |
Returns
- requestId or nil
- reason on immediate refusal
Example
CreateThread(function()
local result, reason = Open77.consumables.unequip("grenade")
if not result then print(reason) end
end)Grenades & healing items guide · Registered in ResourceHost.cpp as LuaConsumable (line 24967).
// For agents & LLMsthis page as Markdownllms.txtllms-full.txt
