z
This commit is contained in:
parent
02a5f0d8af
commit
01155f838d
|
@ -34,13 +34,12 @@ shared_scripts {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
--[[ client_scripts {
|
client_scripts {
|
||||||
"client/classes/*",
|
"client/classes/*",
|
||||||
"client/impl/*"
|
"client/impl/*"
|
||||||
} ]]
|
}
|
||||||
server_script {
|
server_script {
|
||||||
'@oxmysql/lib/MySQL.lua',
|
'@oxmysql/lib/MySQL.lua',
|
||||||
"server/classes/*",
|
"server/classes/*",
|
||||||
"server/impl/*"
|
"server/impl/*"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
impl.lua
1
impl.lua
|
@ -292,6 +292,7 @@ function NewImpl(name)
|
||||||
local impl = Impl:extend({
|
local impl = Impl:extend({
|
||||||
name = name,
|
name = name,
|
||||||
config = Config[name] or {},
|
config = Config[name] or {},
|
||||||
|
implType = "impl"
|
||||||
})
|
})
|
||||||
main:RegisterImpl(name, impl)
|
main:RegisterImpl(name, impl)
|
||||||
return impl
|
return impl
|
||||||
|
|
14
main.lua
14
main.lua
|
@ -181,7 +181,7 @@ function Main:CheckValidImpl(name, impl)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Main:RegisterImpl(name, impl)
|
function Main:RegisterImpl(name, impl)
|
||||||
if Config.EnableModules[name] == nil or not Config.EnableModules[name].enabled then
|
if impl.implType == "impl" and (Config.EnableModules[name] == nil or not Config.EnableModules[name].enabled) then
|
||||||
self:LogWarning("Impl %s not enabled", name)
|
self:LogWarning("Impl %s not enabled", name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -225,25 +225,25 @@ function Main:InitImpl()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for name, impl in pairs(self.impls) do
|
for name, impl in pairs(self.impls) do
|
||||||
if Config.EnableModules[name] and Config.EnableModules[name].priority == 1 then
|
if impl.implType ~= "impl" or (Config.EnableModules[name] and Config.EnableModules[name].priority == 1) then
|
||||||
self.initializedImpls[name] = impl(self)
|
self.initializedImpls[name] = impl(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:LogInfo("All priority 1 initialized")
|
self:LogInfo("All priority 1 initialized")
|
||||||
for name, impl in pairs(self.initializedImpls) do
|
for name, impl in pairs(self.initializedImpls) do
|
||||||
if Config.EnableModules[name] and Config.EnableModules[name].priority == 1 then
|
if impl.implType ~= "impl" or (Config.EnableModules[name] and Config.EnableModules[name].priority == 1) then
|
||||||
impl:OnReady()
|
impl:OnReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
for name, impl in pairs(self.impls) do
|
for name, impl in pairs(self.impls) do
|
||||||
if Config.EnableModules[name] and Config.EnableModules[name].priority == 1 then
|
if impl.implType ~= "impl" or (Config.EnableModules[name] and Config.EnableModules[name].priority == 1) then
|
||||||
self.initializedImpls[name] = impl(self)
|
self.initializedImpls[name] = impl(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:LogInfo("All priority 1 initialized")
|
self:LogInfo("All priority 1 initialized")
|
||||||
for name, impl in pairs(self.initializedImpls) do
|
for name, impl in pairs(self.initializedImpls) do
|
||||||
if Config.EnableModules[name] and Config.EnableModules[name].priority == 1 then
|
if impl.implType ~= "impl" or (Config.EnableModules[name] and Config.EnableModules[name].priority == 1) then
|
||||||
impl:OnReady()
|
impl:OnReady()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -333,7 +333,7 @@ end
|
||||||
|
|
||||||
main = Main:Init()
|
main = Main:Init()
|
||||||
|
|
||||||
local origAddEventHandler = AddEventHandler
|
--[[ local origAddEventHandler = AddEventHandler
|
||||||
function AddEventHandler(eventName, ...)
|
function AddEventHandler(eventName, ...)
|
||||||
if RegisteredEvents[eventName] then
|
if RegisteredEvents[eventName] then
|
||||||
main:LogWarning("Event %s already registered. Removing", eventName)
|
main:LogWarning("Event %s already registered. Removing", eventName)
|
||||||
|
@ -351,7 +351,7 @@ function RegisterNetEvent(eventName, ...)
|
||||||
end
|
end
|
||||||
RegisteredEvents[eventName] = origRegisterNetEvent(eventName, ...)
|
RegisteredEvents[eventName] = origRegisterNetEvent(eventName, ...)
|
||||||
return RegisteredEvents[eventName]
|
return RegisteredEvents[eventName]
|
||||||
end
|
end ]]
|
||||||
|
|
||||||
Citizen.CreateThread(function()
|
Citizen.CreateThread(function()
|
||||||
while GetGameTimer() < main.lastTimeImplRegistered + 1000 do
|
while GetGameTimer() < main.lastTimeImplRegistered + 1000 do
|
||||||
|
|
Loading…
Reference in New Issue
Block a user