Skip to content

Commit 92021e2

Browse files
committed
fix(client/groups): require data on startup
for slow machines my beloved <3
1 parent 5704436 commit 92021e2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

client/groups.lua

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
local jobs, gangs
2-
3-
local function refreshCache()
4-
local groups = lib.callback.await('qbx_core:server:getGroups')
5-
jobs = groups.jobs
6-
gangs = groups.gangs
7-
end
1+
local jobs = require 'shared.jobs'
2+
local gangs = require 'shared.gangs'
83

94
---@return table<string, Job>
105
function GetJobs()
11-
if not jobs then refreshCache() end
126
return jobs
137
end
148

159
exports('GetJobs', GetJobs)
1610

1711
---@return table<string, Gang>
1812
function GetGangs()
19-
if not gangs then refreshCache() end
2013
return gangs
2114
end
2215

@@ -25,7 +18,6 @@ exports('GetGangs', GetGangs)
2518
---@param name string
2619
---@return Job?
2720
function GetJob(name)
28-
if not jobs then refreshCache() end
2921
return jobs[name]
3022
end
3123

@@ -34,7 +26,6 @@ exports('GetJob', GetJob)
3426
---@param name string
3527
---@return Gang?
3628
function GetGang(name)
37-
if not gangs then refreshCache() end
3829
return gangs[name]
3930
end
4031

@@ -47,3 +38,7 @@ end)
4738
RegisterNetEvent('qbx_core:client:onGangUpdate', function(gangName, gang)
4839
gangs[gangName] = gang
4940
end)
41+
42+
local groups = lib.callback.await('qbx_core:server:getGroups')
43+
jobs = groups.jobs
44+
gangs = groups.gangs

0 commit comments

Comments
 (0)