Events
Events
**Exports are the supported integration surface.** Most `aty_inventory:*` events are the internal client↔server protocol; they change between versions and are not contracts. The events below are the ones deliberately raised for other resources to listen to.
Server events you can listen to
AddEventHandler('aty_inventory:itemUsed', function(src, name, metadata, info)
-- a player finished using an item
-- info: { spoiled, bite, handled, animPlayed }
end)
| Event | Raised when |
|---|---|
aty_inventory:itemUsed |
A use completed |
aty_inventory:consumeStarted |
The action bar began |
aty_inventory:consumeFinished |
It completed and the effect applied |
aty_inventory:consumeCancelled |
It was interrupted — nothing applied |
aty_inventory:placed |
A placeable item was set down in the world — (id, item, coords, src) |
aty_inventory:pickedUp |
A placed object was picked back up — (id, item, src) |
aty_inventory:outfitUsed |
An outfit was applied |
aty_inventory:airdropSpawned |
A crate landed |
aty_inventory:airdropGone |
A crate swept away |
aty_inventory:forceOpenStash |
A stash was opened programmatically — (src, stashId). Triggering it from a server script opens one; the stash's job gate still applies |
aty_inventory:forceClose |
A panel was closed by the server — (src). Triggering it closes one |
Why there is no itemAdded event
Because listening for it is the wrong shape. Another resource that wants to know what a player has should ask:
exports.aty_inventory:GetItemCount(inv, 'water')
An event stream of every mutation invites a listener to keep its own copy of the inventory, and that copy is wrong the first time a transaction is refused or rolled back. The server's answer is the only one that stays correct.
The framework mirror inside this resource follows the same reasoning: it watches the container's version rather than hooking every mutation, because a hook added per-mutation is a hook somebody eventually forgets to add.