Restore stash registration return values
Reverts stash registration to return a boolean and id, undoing a breaking change from commit #e06e04a. This restores compatibility with multiple resources and inventories that rely on the previous behavior. Also returning a success status on registration has many uses.
This commit is contained in:
1 parent
9062e5b2a8
commit
a435a4a75c
1 file changed
+6
-4
@@ -130,17 +130,19 @@ Inventory.OpenStash = function(src, _type, id)
|
|||||||
ox_inventory:forceOpenInventory(src, _type, id)
|
ox_inventory:forceOpenInventory(src, _type, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- restores stashes to before commit #e06e04a (no depreication path followed, breaking change and not present on all inventories so undoing it. (also breaking multiple resources))
|
||||||
---This will register a stash
|
---This will register a stash
|
||||||
---@param id string
|
---@param id number|string
|
||||||
---@param label string
|
---@param label string
|
||||||
---@param slots number
|
---@param slots number
|
||||||
---@param weight number
|
---@param weight number
|
||||||
---@param owner string
|
---@param owner string
|
||||||
---@param groups table
|
---@param groups table
|
||||||
---@param coords table
|
---@param coords table
|
||||||
---@return string
|
---@return boolean
|
||||||
|
---@return string|number
|
||||||
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coords)
|
||||||
if Inventory.Stashes[id] then return id end
|
if Inventory.Stashes[id] then return true, id end
|
||||||
Inventory.Stashes[id] = {
|
Inventory.Stashes[id] = {
|
||||||
id = id,
|
id = id,
|
||||||
label = label,
|
label = label,
|
||||||
@@ -151,7 +153,7 @@ Inventory.RegisterStash = function(id, label, slots, weight, owner, groups, coor
|
|||||||
coords = coords
|
coords = coords
|
||||||
}
|
}
|
||||||
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords)
|
ox_inventory:RegisterStash(id, label, slots, weight, owner, groups, coords)
|
||||||
return id
|
return true, id
|
||||||
end
|
end
|
||||||
|
|
||||||
---This will return a boolean if the player has the item.
|
---This will return a boolean if the player has the item.
|
||||||
|
|||||||
Reference in new issue
Block a user