mirror of
https://github.com/jimathy/jim_bridge.git
synced 2026-08-16 21:46:03 +01:00
make cache timeout optional
This commit is contained in:
@@ -369,6 +369,7 @@ for script, data in pairs(invWeightTable) do
|
|||||||
if checkExists(script) then
|
if checkExists(script) then
|
||||||
if script == Exports.QBInv and GetResourceState(Exports.JPRInv):find("start") then goto skip end
|
if script == Exports.QBInv and GetResourceState(Exports.JPRInv):find("start") then goto skip end
|
||||||
|
|
||||||
|
while GetResourceState(script) ~= "started" do Wait(100) print("Waiting for script start") end
|
||||||
local attempts = data.fallback or { data }
|
local attempts = data.fallback or { data }
|
||||||
local lookup, used, err
|
local lookup, used, err
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ if IsDuplicityVersion() then
|
|||||||
local timeout = GetGameTimer() + 900000 -- 15 minutes max wait (had to up this from 2 minutes because of slow servers)
|
local timeout = GetGameTimer() + 900000 -- 15 minutes max wait (had to up this from 2 minutes because of slow servers)
|
||||||
|
|
||||||
-- Wait until jim_bridge is started and export is available
|
-- Wait until jim_bridge is started and export is available
|
||||||
while not cache and GetGameTimer() < timeout do
|
while not cache and (timeout and GetGameTimer() < timeout) do
|
||||||
if GetResourceState("jim_bridge"):find("start") then
|
if GetResourceState("jim_bridge"):find("start") then
|
||||||
local success, result = pcall(function()
|
local success, result = pcall(function()
|
||||||
return exports["jim_bridge"]:GetSharedData()
|
return exports["jim_bridge"]:GetSharedData()
|
||||||
@@ -49,7 +49,7 @@ if IsDuplicityVersion() then
|
|||||||
Wait(100)
|
Wait(100)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not cache then
|
if timeout and not cache then
|
||||||
print("^1ERROR^7: ^2jim_bridge export not available after timeout^7.")
|
print("^1ERROR^7: ^2jim_bridge export not available after timeout^7.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user