2025-02-05 17:42:50 -06:00
|
|
|
loadedModules = {}
|
|
|
|
|
|
|
|
|
|
function Require(modulePath, resourceName)
|
|
|
|
|
if resourceName and type(resourceName) ~= "string" then
|
2025-05-16 21:54:33 -05:00
|
|
|
resourceName = GetInvokingResource()
|
2025-02-05 17:42:50 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not resourceName then
|
|
|
|
|
resourceName = "community_bridge"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local id = resourceName .. ":" .. modulePath
|
|
|
|
|
if loadedModules[id] then
|
|
|
|
|
return loadedModules[id]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local file = LoadResourceFile(resourceName, modulePath)
|
|
|
|
|
if not file then
|
|
|
|
|
error("Error loading file [" .. id .. "]")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local chunk, loadErr = load(file, id)
|
|
|
|
|
if not chunk then
|
|
|
|
|
error("Error wrapping module [" .. id .. "] Message: " .. loadErr)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local success, result = pcall(chunk)
|
|
|
|
|
if not success then
|
|
|
|
|
error("Error executing module [" .. id .. "] Message: " .. result)
|
|
|
|
|
end
|
|
|
|
|
loadedModules[id] = result
|
|
|
|
|
return result
|
|
|
|
|
end
|
|
|
|
|
|
2025-05-11 00:47:33 -05:00
|
|
|
|
|
|
|
|
|
2025-05-13 00:23:01 -04:00
|
|
|
cLib = {
|
|
|
|
|
Require = Require,
|
|
|
|
|
}
|
2025-02-05 17:42:50 -06:00
|
|
|
|
2025-05-13 00:23:01 -04:00
|
|
|
exports('cLib', cLib)
|
2025-02-05 17:42:50 -06:00
|
|
|
|
|
|
|
|
if not IsDuplicityVersion() then goto client end
|
|
|
|
|
|
2025-03-30 21:06:58 -05:00
|
|
|
cLib.Logs = Logs or Require("lib/logs/server/logs.lua")
|
2025-09-03 04:06:31 -05:00
|
|
|
cLib.Entity = ServerEntity or Require("lib/entities/server/server_entity.lua")
|
|
|
|
|
|
|
|
|
|
-- Depricated
|
|
|
|
|
cLib.ServerEntity = cLib.Entity
|
|
|
|
|
|
2025-02-05 17:42:50 -06:00
|
|
|
if IsDuplicityVersion() then return cLib end
|
|
|
|
|
::client::
|
|
|
|
|
|
2025-03-30 21:06:58 -05:00
|
|
|
cLib.Placeable = Placeable or Require("lib/placers/client/object_placer.lua")
|
|
|
|
|
cLib.Utility = Utility or Require("lib/utility/client/utility.lua")
|
2025-08-21 00:09:54 -05:00
|
|
|
cLib.Point = Point or Require("lib/points/client/points.lua")
|
2025-09-03 04:06:31 -05:00
|
|
|
cLib.Entity = ClientEntity or Require("lib/entities/client/client_entity.lua")
|
|
|
|
|
|
|
|
|
|
-- Deprecated
|
|
|
|
|
cLib.ClientEntity = cLib.Entity
|
2025-05-12 00:58:25 -05:00
|
|
|
|
2026-08-18 00:13:37 -07:00
|
|
|
return cLib
|