mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-19 06:46:04 +01:00
adjust stash and store registration
This should fix the `jim_bridge` side of the reports of stores erroring when scripts starts
This commit is contained in:
@@ -2104,9 +2104,7 @@ end
|
|||||||
function openStash(data)
|
function openStash(data)
|
||||||
if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end
|
if (data.job or data.gang) and not jobCheck(data.job or data.gang) then return end
|
||||||
|
|
||||||
local p = promise.new()
|
local exploitCheck = triggerCallback(getScript()..":getRegisteredStashLocations", data.stash)
|
||||||
p:resolve(triggerCallback(getScript()..":getRegisteredStashLocations", data.stash))
|
|
||||||
local exploitCheck = Citizen.Await(p)
|
|
||||||
|
|
||||||
if not exploitCheck then
|
if not exploitCheck then
|
||||||
print("^3Warning^7: ^2This isn't a registered stash^1, refusing call^7")
|
print("^3Warning^7: ^2This isn't a registered stash^1, refusing call^7")
|
||||||
@@ -2351,19 +2349,23 @@ end
|
|||||||
--- )
|
--- )
|
||||||
--- ```
|
--- ```
|
||||||
function registerStash(name, label, slots, weight, owner, coords)
|
function registerStash(name, label, slots, weight, owner, coords)
|
||||||
if coords then
|
|
||||||
stashExploitCheck[name] = stashExploitCheck[name] or {}
|
-- ensure tables exist
|
||||||
stashExploitCheck[name][#stashExploitCheck[name]+1] = coords
|
stashExploitCheck = stashExploitCheck or {}
|
||||||
else
|
stashExploitCheck[name] = stashExploitCheck[name] or {}
|
||||||
print("^3Warning^7: ^1Stash ^4"..name.." ^1doesn^7'^1t have coords^7, ^1this is exploitable^7, ^1add coords to ^3regiterStash^7()")
|
|
||||||
end
|
|
||||||
for i = 1, #InvFunc do
|
for i = 1, #InvFunc do
|
||||||
local inv = InvFunc[i]
|
local inv = InvFunc[i]
|
||||||
if isStarted(inv.invName) then
|
if isStarted(inv.invName) then
|
||||||
inv.registerStash(name, label, slots, weight, owner, coords)
|
inv.registerStash(name, label, slots, weight, owner, coords)
|
||||||
return
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if coords then
|
||||||
|
stashExploitCheck[name][#stashExploitCheck[name]+1] = coords.xyz
|
||||||
|
else
|
||||||
|
print("^3Warning^7: ^1Stash ^4"..name.." ^1doesn^7'^1t have coords^7, ^1this is exploitable^7, ^1add coords to ^3regiterStash^7()")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if isServer() then
|
if isServer() then
|
||||||
@@ -2689,6 +2691,9 @@ end)
|
|||||||
--- ```
|
--- ```
|
||||||
function registerShop(name, label, items, society, coords)
|
function registerShop(name, label, items, society, coords)
|
||||||
local shopResource = ""
|
local shopResource = ""
|
||||||
|
-- ensure tables exist
|
||||||
|
shopExploitCheck = shopExploitCheck or {}
|
||||||
|
shopExploitCheck[name] = shopExploitCheck[name] or {}
|
||||||
|
|
||||||
for i = 1, #InvFunc do
|
for i = 1, #InvFunc do
|
||||||
local inv = InvFunc[i]
|
local inv = InvFunc[i]
|
||||||
@@ -2700,9 +2705,7 @@ function registerShop(name, label, items, society, coords)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- If received coords, pass them to distance check cache
|
-- If received coords, pass them to distance check cache
|
||||||
if coords and type(coords) == "vector3" then
|
if coords then
|
||||||
--print("Registered Shop Correctly")
|
|
||||||
shopExploitCheck[name] = shopExploitCheck[name] or {}
|
|
||||||
shopExploitCheck[name][#shopExploitCheck[name]+1] = coords
|
shopExploitCheck[name][#shopExploitCheck[name]+1] = coords
|
||||||
else
|
else
|
||||||
print("^3Warning^7: ^1Store ^4"..name.." ^1doesn^7'^1t have coords^7, ^1this is exploitable^7, ^1add coords to ^3regiterShop^7()")
|
print("^3Warning^7: ^1Store ^4"..name.." ^1doesn^7'^1t have coords^7, ^1this is exploitable^7, ^1add coords to ^3regiterShop^7()")
|
||||||
|
|||||||
Reference in New Issue
Block a user