Entity fix and stash update

Slimed OpenStash down to just an src and id instead of needing duplicate data.

Was not sure if this affects newb so im throwing it in a pr.
This commit is contained in:
gononono64 committed 2025-05-19 07:20:23 -05:00
1 parent 68e81b720a
commit 0d606bc859
10 files changed
+109 -18

No files matched your search

+18 -1
View File
@@ -2,6 +2,7 @@
if GetResourceState('codem-inventory') ~= 'started' then return end
Inventory = Inventory or {}
Inventory.Stashes = Inventory.Stashes or {}
local codem = exports['codem-inventory']
@@ -104,10 +105,16 @@ end
---@param groups table
---@param coords table
---@return nil
Inventory.OpenStash = function(src, id, label, slots, weight, owner, groups, coords)
Inventory.OpenStash = function(src, id)
local stash = Inventory.Stashes[id]
assert(stash, "Stash not found", id)
local label = stash.label
local slots = stash.slots
local weight = stash.weight
TriggerClientEvent('community_bridge:client:codem-inventory:openStash', src, id, { label = label, slots = slots, weight = weight })
end
---This will register a stash
---@param id number||string
---@param label string
@@ -118,6 +125,16 @@ end
---@param coords table
---@return boolean
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
if Inventory.Stashes[id] then return true end
Inventory.Stashes[id] = {
id = id,
label = label,
slots = slots,
weight = weight,
owner = owner,
groups = groups,
coords = coords
}
return true
end