From 466e86bfdb8451f38a9a7fc54587403562fe88df Mon Sep 17 00:00:00 2001 From: "Mr.Crowley" Date: Mon, 28 Jul 2025 00:10:51 -0500 Subject: [PATCH] targets and inventory update Targets: sphearzone should not take a heading, removed optional debug at the end for individual debugging Inventory: Added OpenPlayerInventory for all inventories. 2 (aka codem and qs) did not have clear documentation. Probably doesnt work --- modules/inventory/_default/client.lua | 2 ++ modules/inventory/_default/server.lua | 4 ++++ modules/inventory/codem-inventory/server.lua | 9 +++++++++ modules/inventory/core_inventory/server.lua | 10 ++++++++++ modules/inventory/jpr-inventory/server.lua | 10 ++++++++++ modules/inventory/origen_inventory/server.lua | 8 ++++++++ modules/inventory/ox_inventory/server.lua | 8 ++++++++ modules/inventory/qb-inventory/server.lua | 8 ++++++++ modules/inventory/qs-inventory/server.lua | 8 ++++++++ modules/inventory/tgiann-inventory/server.lua | 9 +++++++++ modules/target/ox_target/client.lua | 4 ++-- modules/target/qb-target/client.lua | 4 ++-- modules/target/sleepless_interact/client.lua | 4 ++-- 13 files changed, 82 insertions(+), 6 deletions(-) diff --git a/modules/inventory/_default/client.lua b/modules/inventory/_default/client.lua index 820f869..68aba63 100644 --- a/modules/inventory/_default/client.lua +++ b/modules/inventory/_default/client.lua @@ -52,4 +52,6 @@ Inventory.Items = function() return Framework.Shared.Items end + + return Inventory \ No newline at end of file diff --git a/modules/inventory/_default/server.lua b/modules/inventory/_default/server.lua index c6b24d1..6278594 100644 --- a/modules/inventory/_default/server.lua +++ b/modules/inventory/_default/server.lua @@ -193,4 +193,8 @@ Inventory.StripPNG = function(item) return item end +Inventory.OpenPlayerInventory = function(src, targetSrc) + return false, Prints.Error("OpenPlayerInventory is not implemented in this inventory, because of this we dont have a way to open a players inventory.") +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/codem-inventory/server.lua b/modules/inventory/codem-inventory/server.lua index fc652f9..2927e6e 100644 --- a/modules/inventory/codem-inventory/server.lua +++ b/modules/inventory/codem-inventory/server.lua @@ -190,4 +190,13 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['codem-inventory']:OpenInventory(src, target) +end + + return Inventory \ No newline at end of file diff --git a/modules/inventory/core_inventory/server.lua b/modules/inventory/core_inventory/server.lua index 9d0956d..b3d7032 100644 --- a/modules/inventory/core_inventory/server.lua +++ b/modules/inventory/core_inventory/server.lua @@ -257,4 +257,14 @@ Inventory.Items = function() return core:getItemsList() end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + local identifier = Framework.GetPlayerIdentifier(target) + if not identifier then return false end + exports.core_inventory:openInventory(src, 'stash-'.. identifier:gsub(':',''), 'stash', nil, nil, true, nil, false) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/jpr-inventory/server.lua b/modules/inventory/jpr-inventory/server.lua index c46ae2a..e0f31ff 100644 --- a/modules/inventory/jpr-inventory/server.lua +++ b/modules/inventory/jpr-inventory/server.lua @@ -189,4 +189,14 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou return true end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + local identifier = Framework.GetPlayerIdentifier(target) + if not identifier then return false end + exports['jpr-inventory']:OpenInventory(src, identifier) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/origen_inventory/server.lua b/modules/inventory/origen_inventory/server.lua index b6d799c..784cb9b 100644 --- a/modules/inventory/origen_inventory/server.lua +++ b/modules/inventory/origen_inventory/server.lua @@ -239,4 +239,12 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports.origen_inventory:OpenInventory(src, "otherplayer", target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/ox_inventory/server.lua b/modules/inventory/ox_inventory/server.lua index 2a35e95..973cbd5 100644 --- a/modules/inventory/ox_inventory/server.lua +++ b/modules/inventory/ox_inventory/server.lua @@ -224,4 +224,12 @@ Inventory.GetItem = function(src, item, metadata) return ox_inventory:GetItem(src, item, metadata, false) end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports.ox_inventory:openInventory('player', target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/qb-inventory/server.lua b/modules/inventory/qb-inventory/server.lua index ae8b715..ce60468 100644 --- a/modules/inventory/qb-inventory/server.lua +++ b/modules/inventory/qb-inventory/server.lua @@ -275,4 +275,12 @@ Inventory.RegisterShop = function(shopTitle, shopInventory, shopCoords, shopGrou end end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['qb-inventory']:OpenInventory(src, target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/qs-inventory/server.lua b/modules/inventory/qs-inventory/server.lua index 8ae16a4..52a542c 100644 --- a/modules/inventory/qs-inventory/server.lua +++ b/modules/inventory/qs-inventory/server.lua @@ -233,4 +233,12 @@ Inventory.GetImagePath = function(item) return imagePath or "https://avatars.githubusercontent.com/u/47620135" end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['qs-inventory']:OpenInventory(src, target) +end + return Inventory \ No newline at end of file diff --git a/modules/inventory/tgiann-inventory/server.lua b/modules/inventory/tgiann-inventory/server.lua index 1e38751..fadb24c 100644 --- a/modules/inventory/tgiann-inventory/server.lua +++ b/modules/inventory/tgiann-inventory/server.lua @@ -229,4 +229,13 @@ Inventory.GetItem = function(src, item, metadata) return item end +Inventory.OpenPlayerInventory = function(src, target) + assert(src, "OpenPlayerInventory: src is required") + if not target then + target = src + end + exports['tgiann-inventory']:OpenInventoryById(src, target) +end + + return Inventory \ No newline at end of file diff --git a/modules/target/ox_target/client.lua b/modules/target/ox_target/client.lua index ad0367a..3437cac 100644 --- a/modules/target/ox_target/client.lua +++ b/modules/target/ox_target/client.lua @@ -155,13 +155,13 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, heading, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) local target = ox_target:addSphereZone({ coords = coords, radius = radius, name = name, - debug = targetDebug, + debug = targetDebug or debug, options = options }) table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() }) diff --git a/modules/target/qb-target/client.lua b/modules/target/qb-target/client.lua index 158ff0d..0851023 100644 --- a/modules/target/qb-target/client.lua +++ b/modules/target/qb-target/client.lua @@ -170,11 +170,11 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) qb_target:AddCircleZone(name, coords, radius, { name = name, - debugPoly = targetDebug, + debugPoly = targetDebug or debug, }, { options = options, distance = options.distance or 1.5, diff --git a/modules/target/sleepless_interact/client.lua b/modules/target/sleepless_interact/client.lua index b7c6882..95e6375 100644 --- a/modules/target/sleepless_interact/client.lua +++ b/modules/target/sleepless_interact/client.lua @@ -146,13 +146,13 @@ end ---@param coords table ---@param radius number ---@param options table -Target.AddSphereZone = function(name, coords, radius, heading, options) +Target.AddSphereZone = function(name, coords, radius, options, debug) options = Target.FixOptions(options) local target = sleepless_interact:addSphereZone({ coords = coords, radius = radius, name = name, - debug = targetDebug, + debug = targetDebug or debug, options = options }) table.insert(targetZones, { name = name, id = target, creator = GetInvokingResource() })