World- & Player Interaction
All information you would need regarding world- & player interactions.
#World and Player Interactions
zyke_consumables includes world interactions for placed consumables, placed packs, player handoffs, and pouring drinks into glasses. Server scripts can also spawn targetable consumables and packs at exact coordinates through the world spawn exports.
All keybinds for player-controlled interactions can be changed in the player's keybind settings.
Even if you are not using a targeting system, you must use the internal targeting key to interact with placed objects. This avoids accidental pickups and clumsy overlap with normal controls.
#Table of Contents
- Placement and Pickup
- Transferring to Another Player
- Glass Interaction (Pouring)
- Coordinate Spawn Exports (Packs & Consumables)
- SpawnWorldConsumable
- SpawnWorldPack
- RemoveWorldSpawn
- Temporary and Persistent Spawns
- Pack Behavior
- Examples
- Failure Reasons
- World Spawn FAQ
#Placement and Pickup
Any consumable can be placed in the world. The item uses its first configured prop as the world model. If no prop is configured, a default model is used.
#Placing an Item
- Enter placement mode using the keybind (Arrow Up, by default).
- A preview of the item appears and follows your aim.
- Confirm the placement to drop the item in the world.
- The item is removed from your hand and placed at the chosen position.
#Picking Up an Item
- Look at a placed item and use your targeting key to interact with it.
- The indicator turns green when you are within range.
- Interact with it to pick the item back up.
Placed items persist in the world and can be picked up by any player within range.
#Transferring to Another Player
You can hand your currently held item directly to another player.
- Enter placement mode using the keybind (Arrow Up, by default).
- Aim at another player instead of the ground.
- The outline turns green when the transfer is possible.
- Confirm to transfer the item to that player.
The item is moved from your inventory to the other player's inventory, keeping its current state, including remaining amount, quality, and metadata.
#Glass Interaction (Pouring)
You can pour the contents of a held drink into a placed glass in the world. This is the core mechanic behind bartender RP.
#How to Pour
- Hold a drink item in your hand.
- Look at a placed glass and interact with it using your targeting key.
- Use scroll to set the amount you want to pour.
- Press the interaction button to pour.
#Mixing
Glasses support mixing multiple drinks together:
- You can pour any drink or ingredient-based item into a glass.
- Multiple different drinks can be combined in the same glass.
- You can also add one-hit items like pills into a glass, even when the glass is already full.
- Each poured item retains its own metadata, quality, and rewards, and contributes proportionally when consumed.
#Limits
- The glass has a maximum capacity based on its configured amount.
- If you try to pour more than the glass can hold, it fills to the max and the leftover stays in your held item.
- If your held drink runs out during a pour, the pour stops at whatever amount was left.
#Coordinate Spawn Exports (Packs & Consumables)
Server scripts can spawn configured consumables and packs at exact coordinates. This is useful for events, restaurants, jobs, staged scenes, stash rewards, and temporary props that players interact with through the normal world interaction system.
The exports are server-side exports. Call them from another server script, not from client code.
The item must exist as an active configured item in zyke_consumables. Inventory-only items are not enough.
Coordinates can be a vector3 or a table with x, y, and z.
Temporary spawns are the default. They can be removed by TTL (Time to Live), manual cleanup, player interaction, invoking-resource stop, or zyke_consumables restart cleanup. Persistent spawns are saved and restored like normal placed world items or packs.
#SpawnWorldConsumable
Spawns one configured consumable directly into the world.
#Options
| Option | Type | Description |
|---|---|---|
persist | boolean | Saves the spawn so it survives restart. Default: false. |
ttl | number | Seconds before temporary spawn removal. Cannot be used with persist = true. |
owner | string | Custom owner value. Default: resource:<invoking resource>. |
rotation | number, vector3, or table | Heading number or full rotation. Default: vector3(0.0, 0.0, 0.0). |
bucketId | number | Routing bucket. Default: 0. |
amount | number | Current amount. Omit it to use the configured max amount for normal consumables. Glass items start empty unless an amount is supplied. |
quality | number | Quality from 0 to 100. Values outside that range are clamped. |
ingredients | table | Optional ingredient metadata for ingredient-based items. |
metadata | table | Extra metadata to merge into the spawned item before normal item metadata is constructed. |
#Behavior
Players interact with the spawned consumable like a normal placed world item. Picking it up equips it in hand. If the spawn is temporary, pickup also removes it from export-spawn tracking.
amount is clamped to the item's max amount. If quality is omitted, normal metadata handling decides the item quality.
#SpawnWorldPack
Spawns a world pack that gives one consumable each time a player uses it.
#Options
| Option | Type | Description |
|---|---|---|
persist | boolean | Saves the pack so it survives restart. Default: false. |
ttl | number | Seconds before temporary pack removal. Cannot be used with persist = true. |
owner | string | Custom owner value. Default: resource:<invoking resource>. |
amount | number | Servings inside the pack. Required when the item does not have packs enabled. |
metadata | table | Extra pack metadata. |
canPickup | boolean | Allows picking up the whole pack when the item has packs enabled. Default: false. |
prop | string | World model for the pack. Default: v_serv_abox_02. |
#Behavior
Using the pack gives the player one base consumable item and reduces the pack amount by one. When the amount reaches zero, the pack is removed.
If the item has packs enabled in the creator, the export can use the item's pack settings. If the item does not have packs enabled, pass amount and treat the pack as world-only. World-only packs should use canPickup = false because there is no registered inventory pack item to return.
canPickup = true only takes effect when the item has packs enabled. If packs are not enabled for that item, the spawned world pack can still be used, but it cannot be picked up as an inventory pack.
#RemoveWorldSpawn
Removes a spawn created by SpawnWorldConsumable or SpawnWorldPack.
Use the activeItemId returned by SpawnWorldConsumable or the packId returned by SpawnWorldPack.
RemoveWorldSpawn only removes export-spawned world items and packs that are still tracked by the spawn system. It is not a generic delete function for every placed item in the world.
#Temporary and Persistent Spawns
Temporary spawns are the default.
Temporary spawns are removed when one of these happens:
- The TTL expires.
RemoveWorldSpawnis called.- The player picks up the consumable or finishes the pack.
- The invoking resource stops.
- zyke_consumables restarts and cleanup runs.
Persistent spawns are saved and restored on restart.
Do not pass ttl with persist = true.
#Pack Behavior
Packs do not require the item to have packs enabled when spawned as temporary world-only packs.
This lets you create event packs for any configured consumable:
For items that already have packs enabled, canPickup = true allows players to pick up the whole pack and receive the proper pack inventory item.
#Examples
#Temporary Item With Max Amount
Omit amount to use the configured max amount for normal consumables.
#Temporary Item With Custom Amount
#Persistent Item in a Routing Bucket
#Temporary Custom Pack
#Persistent World Pack
#Manual Cleanup
#Failure Reasons
The spawn exports return nil, reason when something fails. RemoveWorldSpawn returns false, reason.
| Reason | Meaning |
|---|---|
missingItemSettings | The item is not configured in zyke_consumables. |
itemNotActive | The configured item is disabled. |
itemDraft | The item is saved as a draft. |
invalidCoords | The coordinates are missing or invalid. |
invalidAmount | The amount is missing or invalid. For world-only packs, amount is required. |
invalidTtl | TTL must be a positive number. |
ttlRequiresTemporarySpawn | TTL cannot be used with persist = true. |
globalWorldItemLimitReached | The world item limit has been reached. |
notWorldSpawn | RemoveWorldSpawn was called for an id not tracked as an export spawn. |
noPack | RemoveWorldSpawn was called for a tracked pack that no longer exists. |
invalidWorldSpawnType | The tracked spawn type is invalid. This should only happen if spawn tracking data is corrupted. |
#World Spawn FAQ
#Can I spawn an item that only exists in my inventory?
No. The item must be configured and active in zyke_consumables.
#How do I use max amount?
Omit amount when spawning a normal consumable. The export uses the configured max amount for that item. Glass items are the exception: they start empty unless you pass an amount.
#Can packs be temporary?
Yes. Packs are temporary by default. Add ttl if you want automatic cleanup after a set number of seconds.
#Can a custom pack be picked up?
Only if the item has packs enabled and has a valid pack inventory item. For packs created from items without pack settings, use canPickup = false.
#What happens when the invoking resource stops?
Temporary spawns created by that resource are removed. Persistent spawns are kept.
