Remove example scripts and update core logic
Deleted all files in the examples directory to clean up unused or test scripts. Updated fxmanifest.lua to enable ox_lib initialization. Improved error handling and entity tracking in utility functions, added prop removal, and made minor localization and code style adjustments throughout the codebase. Significant reword of inventory module, notification module, and framework module. Added support for wasabi_uikit, added support for keep-progressbars,
This commit is contained in:
1 parent
c40a260ea2
commit
343af95794
100 files changed
+2403
-2755
No files matched your search
@@ -1,13 +1,20 @@
|
||||
---@diagnostic disable: duplicate-set-field
|
||||
if GetResourceState('origen_inventory') ~= 'started' then return end
|
||||
if GetResourceState('origen_inventory') == 'missing' then return end
|
||||
if GetResourceState('ox_inventory') ~= 'missing' then return end
|
||||
Inventory = Inventory or {}
|
||||
local origin = exports.origen_inventory
|
||||
|
||||
---Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@description This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "origen_inventory"
|
||||
end
|
||||
|
||||
---@description Return the item info in oxs format, {name, label, stack, weight, description, image}
|
||||
---@param item string
|
||||
---@return table
|
||||
Inventory.GetItemInfo = function(item)
|
||||
local itemData = origin:Items(item)
|
||||
local itemData = Inventory.Items()[item]
|
||||
if not itemData then return {} end
|
||||
return {
|
||||
name = itemData.name or "Missing Name",
|
||||
@@ -19,26 +26,16 @@ Inventory.GetItemInfo = function(item)
|
||||
}
|
||||
end
|
||||
|
||||
---This will get the name of the in use resource.
|
||||
---@return string
|
||||
Inventory.GetResourceName = function()
|
||||
return "origen_inventory"
|
||||
end
|
||||
|
||||
---This will return the entire items table from the inventory.
|
||||
---@return table
|
||||
Inventory.Items = function()
|
||||
return origin:Items()
|
||||
end
|
||||
|
||||
---Will return boolean if the player has the item.
|
||||
---@description Will return boolean if the player has the item.
|
||||
---@param item string
|
||||
---@param requiredCount number (optional)
|
||||
---@return boolean
|
||||
Inventory.HasItem = function(item)
|
||||
return origin:HasItem(item)
|
||||
Inventory.HasItem = function(item, requiredCount)
|
||||
local count = Inventory.GetItemCount(item)
|
||||
return count >= (requiredCount or 1)
|
||||
end
|
||||
|
||||
---This will return th count of the item in the players inventory, if not found will return 0.
|
||||
---@description This will return their count of the item in the players inventory, if not found will return 0.
|
||||
---@param item string
|
||||
---@return number
|
||||
Inventory.GetItemCount = function(item)
|
||||
@@ -47,7 +44,7 @@ Inventory.GetItemCount = function(item)
|
||||
return inventory.count
|
||||
end
|
||||
|
||||
---This will get the image path for this item, if not found will return placeholder.
|
||||
---@description This will get the image path for this item, if not found will return placeholder.
|
||||
---@param item string
|
||||
---@return string
|
||||
Inventory.GetImagePath = function(item)
|
||||
@@ -57,7 +54,7 @@ Inventory.GetImagePath = function(item)
|
||||
return imagePath or "https://avatars.githubusercontent.com/u/47620135"
|
||||
end
|
||||
|
||||
---This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@description This will return the players inventory in the format of {name, label, count, slot, metadata}
|
||||
---@return table
|
||||
Inventory.GetPlayerInventory = function()
|
||||
local repack = {}
|
||||
@@ -67,10 +64,10 @@ Inventory.GetPlayerInventory = function()
|
||||
table.insert(repack, {
|
||||
name = v.name,
|
||||
label = v.label,
|
||||
count = v.amount,
|
||||
count = v.amount or v.count,
|
||||
slot = v.slot,
|
||||
metadata = v.metadata,
|
||||
stack = v.unique,
|
||||
metadata = v.metadata or v.info or {},
|
||||
stack = v.unique or v.stack or false,
|
||||
close = v.useable,
|
||||
weight = v.weight
|
||||
})
|
||||
@@ -78,8 +75,4 @@ Inventory.GetPlayerInventory = function()
|
||||
return repack
|
||||
end
|
||||
|
||||
Inventory.OpenStash = function(id)
|
||||
origin:openInventory('stash', id, { label = id, weight = 400000, slots = 100, })
|
||||
end
|
||||
|
||||
return Inventory
|
||||
Reference in new issue
Block a user