Update main.lua

This commit is contained in:
Lorraxs 2024-03-28 23:44:07 +07:00
parent e42f1f006b
commit fc8a4f4587

View File

@ -42,23 +42,25 @@ function Main:Init()
o.playerServerId = GetPlayerServerId(o.playerId) o.playerServerId = GetPlayerServerId(o.playerId)
o:Thread1() o:Thread1()
else else
o.ClientImpls = {} if Config.ClientLazyLoad then
for k, v in pairs(Config.EnableModules) do o.ClientImpls = {}
if v then for k, v in pairs(Config.EnableModules) do
local path = "client/impl/" .. k .. ".impl.lua" if v then
local source = LoadResourceFile(ResourceName, path) local path = "client/impl/" .. k .. ".impl.lua"
if source == nil then local source = LoadResourceFile(ResourceName, path)
self:LogWarning("Failed to load %s", path) if source == nil then
else self:LogWarning("Failed to load %s", path)
--[[ self:LogInfo("Loading %s", path) else
self:LogInfo("Loaded %s", source) ]] --[[ self:LogInfo("Loading %s", path)
o.ClientImpls[k] = source self:LogInfo("Loaded %s", source) ]]
o.ClientImpls[k] = source
end
end end
end end
lib.callback.register(ResourceName .. ":getClientImpl", function(source, implName)
return o.ClientImpls[implName]
end)
end end
lib.callback.register(ResourceName .. ":getClientImpl", function(source, implName)
return o.ClientImpls[implName]
end)
end end
o:Exports() o:Exports()
o:RegisterCommands() o:RegisterCommands()