add dependence config
This commit is contained in:
parent
60002cd92a
commit
b23905b279
|
@ -1,5 +1,7 @@
|
||||||
Config = {}
|
Config = {}
|
||||||
|
|
||||||
|
Config.Dependencies = {} -- Reqired resources loaded to start
|
||||||
|
|
||||||
Config.Settings = {
|
Config.Settings = {
|
||||||
locale = {}
|
locale = {}
|
||||||
}
|
}
|
||||||
|
|
14
main.lua
14
main.lua
|
@ -218,6 +218,15 @@ function Main:RegisterImpl(name, impl)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Main:InitImpl()
|
function Main:InitImpl()
|
||||||
|
if Config.Dependencies then
|
||||||
|
for k, v in ipairs(Config.Dependencies) do
|
||||||
|
local p = promise.new()
|
||||||
|
TriggerEvent(('%s:onReady'):format(v), function()
|
||||||
|
p:resolve()
|
||||||
|
end)
|
||||||
|
Citizen.Await(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
if not IsDuplicityVersion() then
|
if not IsDuplicityVersion() then
|
||||||
if Config.ClientLazyLoad then
|
if Config.ClientLazyLoad then
|
||||||
for k, v in pairs(Config.EnableModules) do
|
for k, v in pairs(Config.EnableModules) do
|
||||||
|
@ -342,8 +351,9 @@ function Main:Exports()
|
||||||
end
|
end
|
||||||
|
|
||||||
main = Main:Init()
|
main = Main:Init()
|
||||||
|
AddEventHandler(("%s:onReady"):format(GetCurrentResourceName()), function(handler)
|
||||||
AddEventHandler(("%s:onReady"):format(GetCurrentGameName()), function(handler)
|
local invokingResource = GetInvokingResource()
|
||||||
|
main:LogInfo(invokingResource)
|
||||||
main:ListenOnReady(handler)
|
main:ListenOnReady(handler)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user