touch up
This commit is contained in:
1 parent
6c6b4e9e86
commit
93ae1411e8
1 file changed
+16
-4
@@ -107,7 +107,20 @@ end
|
|||||||
---@return table
|
---@return table
|
||||||
Inventory.GetPlayerInventory = function(src)
|
Inventory.GetPlayerInventory = function(src)
|
||||||
local playerInv = origin:GetInventory(src)
|
local playerInv = origin:GetInventory(src)
|
||||||
return playerInv.inventory or {}
|
local inv = playerInv.inventory or {}
|
||||||
|
local repack = {}
|
||||||
|
for _, v in pairs(inv) do
|
||||||
|
if v.slot then
|
||||||
|
table.insert(repack, {
|
||||||
|
item = v.name,
|
||||||
|
count = v.amount,
|
||||||
|
metadata = v.metadata or {},
|
||||||
|
slot = v.slot,
|
||||||
|
label = v.label or "Unknown"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return repack
|
||||||
end
|
end
|
||||||
|
|
||||||
---Returns the specified slot data as a table.
|
---Returns the specified slot data as a table.
|
||||||
@@ -116,9 +129,8 @@ end
|
|||||||
---@param slot number
|
---@param slot number
|
||||||
---@return table
|
---@return table
|
||||||
Inventory.GetItemBySlot = function(src, slot)
|
Inventory.GetItemBySlot = function(src, slot)
|
||||||
local playerInv = origin:getInventory(src)
|
local playerInv = Inventory.GetPlayerInventory(src)
|
||||||
local inv = playerInv.inventory or {}
|
for _, v in pairs(playerInv) do
|
||||||
for k, v in pairs(inv) do
|
|
||||||
if v.slot == slot then
|
if v.slot == slot then
|
||||||
return {
|
return {
|
||||||
weight = v.weight,
|
weight = v.weight,
|
||||||
|
|||||||
Reference in new issue
Block a user