origin inventory patch

the getinventory export returns a table of nested values, inside there is a inventory table. This gets us by on the compatibility. It appears that many of the exports have changed, I have tested this on the latest version with a resource that makes use of these items. Also they use amount, I "think" they used to use count but im 100% they use metadata & info tables.
This commit is contained in:
MrNewb committed 2025-06-09 15:47:25 -04:00
1 parent 2ed71df1b6
commit 6ae273544d
1 file changed
+5 -3
@@ -106,7 +106,8 @@ end
---@param src number ---@param src number
---@return table ---@return table
Inventory.GetPlayerInventory = function(src) Inventory.GetPlayerInventory = function(src)
return origin:GetInventory(src) local playerInv = origin:GetInventory(src)
return playerInv.inventory or {}
end end
---Returns the specified slot data as a table. ---Returns the specified slot data as a table.
@@ -115,7 +116,8 @@ end
---@param slot number ---@param slot number
---@return table ---@return table
Inventory.GetItemBySlot = function(src, slot) Inventory.GetItemBySlot = function(src, slot)
local inv = origin:getInventory(src) local playerInv = origin:getInventory(src)
local inv = playerInv.inventory or {}
for k, v in pairs(inv) do for k, v in pairs(inv) do
if v.slot == slot then if v.slot == slot then
return { return {
@@ -124,7 +126,7 @@ Inventory.GetItemBySlot = function(src, slot)
metadata = v.metadata, metadata = v.metadata,
slot = v.slot, slot = v.slot,
label = v.label, label = v.label,
count = v.count count = v.amount
} }
end end
end end