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:Thread1()
else
o.ClientImpls = {}
for k, v in pairs(Config.EnableModules) do
if v then
local path = "client/impl/" .. k .. ".impl.lua"
local source = LoadResourceFile(ResourceName, path)
if source == nil then
self:LogWarning("Failed to load %s", path)
else
--[[ self:LogInfo("Loading %s", path)
self:LogInfo("Loaded %s", source) ]]
o.ClientImpls[k] = source
if Config.ClientLazyLoad then
o.ClientImpls = {}
for k, v in pairs(Config.EnableModules) do
if v then
local path = "client/impl/" .. k .. ".impl.lua"
local source = LoadResourceFile(ResourceName, path)
if source == nil then
self:LogWarning("Failed to load %s", path)
else
--[[ self:LogInfo("Loading %s", path)
self:LogInfo("Loaded %s", source) ]]
o.ClientImpls[k] = source
end
end
end
lib.callback.register(ResourceName .. ":getClientImpl", function(source, implName)
return o.ClientImpls[implName]
end)
end
lib.callback.register(ResourceName .. ":getClientImpl", function(source, implName)
return o.ClientImpls[implName]
end)
end
o:Exports()
o:RegisterCommands()