2025-01-09 00:11:53 +02:00
|
|
|
Bridge = {}
|
2025-01-08 06:33:31 -05:00
|
|
|
|
2025-01-09 19:06:33 +02:00
|
|
|
function Bridge.RegisterModule(moduleName, moduleTable)
|
2025-01-09 00:11:53 +02:00
|
|
|
if not moduleTable then
|
2025-02-06 04:16:00 -05:00
|
|
|
if BridgeSharedConfig.DebugLevel ~= 0 then
|
|
|
|
|
print("^6 No moduleTable provided for module: ", moduleName, "^0")
|
|
|
|
|
end
|
2025-01-09 00:11:53 +02:00
|
|
|
return
|
|
|
|
|
end
|
2025-01-09 15:59:17 +02:00
|
|
|
|
2025-05-09 19:06:50 -05:00
|
|
|
local wrappedModule = Bridge[moduleName] or {}
|
2025-02-05 17:42:50 -06:00
|
|
|
if type(moduleTable) == 'function' then
|
2025-05-16 21:54:33 -05:00
|
|
|
Bridge[moduleName] = moduleTable
|
2025-02-24 14:03:48 -06:00
|
|
|
exports(moduleName, moduleTable)
|
2025-02-05 17:42:50 -06:00
|
|
|
return
|
|
|
|
|
end
|
2025-01-09 19:06:33 +02:00
|
|
|
for functionName, func in pairs(moduleTable) do
|
|
|
|
|
wrappedModule[functionName] = func
|
2025-01-09 10:57:51 +02:00
|
|
|
end
|
2025-02-06 04:16:00 -05:00
|
|
|
if BridgeSharedConfig.DebugLevel ~= 0 then
|
|
|
|
|
print("^2 Registering module:", moduleName, "^0")
|
|
|
|
|
end
|
2025-08-28 12:47:40 -04:00
|
|
|
-- remove __ENV as its not present in luajit at all from what ive read. Good find guys :P
|
2025-01-09 19:06:33 +02:00
|
|
|
Bridge[moduleName] = wrappedModule
|
2025-02-24 14:03:48 -06:00
|
|
|
|
|
|
|
|
exports(moduleName, function()
|
|
|
|
|
return wrappedModule
|
|
|
|
|
end)
|
|
|
|
|
|
2025-02-05 17:42:50 -06:00
|
|
|
TriggerEvent("Bridge:Refresh", moduleName, wrappedModule)
|
2025-01-08 06:33:31 -05:00
|
|
|
end
|
2025-02-05 17:42:50 -06:00
|
|
|
exports("RegisterModule", Bridge.RegisterModule)
|
2025-01-08 06:33:31 -05:00
|
|
|
|
2025-02-05 17:42:50 -06:00
|
|
|
function Bridge.RegisterModuleFunction(moduleName, functionName, func)
|
2025-05-13 00:23:01 -04:00
|
|
|
assert(moduleName and functionName and func, string.format("Bridge.RegisterModuleFunction(%s, %s, %s) - Invalid arguments", moduleName, functionName, func))
|
2025-02-05 17:42:50 -06:00
|
|
|
Bridge[moduleName] = Bridge[moduleName] or {}
|
|
|
|
|
Bridge[moduleName][functionName] = func
|
|
|
|
|
TriggerEvent("Bridge:Refresh", moduleName, Bridge[moduleName])
|
|
|
|
|
end
|
|
|
|
|
|
2025-01-09 00:11:53 +02:00
|
|
|
Bridge.RegisterModule("Framework", Framework)
|
2025-06-30 21:31:06 -04:00
|
|
|
Bridge.RegisterModule("BossMenu", BossMenu)
|
2025-01-09 19:06:33 +02:00
|
|
|
Bridge.RegisterModule("Inventory", Inventory)
|
2025-01-09 00:11:53 +02:00
|
|
|
Bridge.RegisterModule("Notify", Notify)
|
2025-04-28 10:21:03 -04:00
|
|
|
Bridge.RegisterModule("HelpText", HelpText)
|
2025-01-09 00:11:53 +02:00
|
|
|
Bridge.RegisterModule("Clothing", Clothing)
|
|
|
|
|
Bridge.RegisterModule("Doorlock", Doorlock)
|
|
|
|
|
Bridge.RegisterModule("Phone", Phone)
|
2025-02-05 17:42:50 -06:00
|
|
|
Bridge.RegisterModule("Dispatch", Dispatch)
|
2025-03-09 05:49:05 -04:00
|
|
|
Bridge.RegisterModule("Shops", Shops)
|
2025-04-15 07:06:57 -04:00
|
|
|
Bridge.RegisterModule("Housing", Housing)
|
2025-05-09 23:05:44 -05:00
|
|
|
Bridge.RegisterModule("Version", Version)
|
2025-02-05 17:42:50 -06:00
|
|
|
Bridge.RegisterModule("Require", Require)
|
2025-06-15 03:51:14 -04:00
|
|
|
Bridge.RegisterModule("Skills", Skills)
|
2025-05-09 19:06:50 -05:00
|
|
|
|
2025-05-13 00:23:01 -04:00
|
|
|
for k, v in pairs(cLib) do
|
|
|
|
|
if v then
|
|
|
|
|
Bridge.RegisterModule(k, v)
|
2025-05-09 19:06:50 -05:00
|
|
|
end
|
2025-05-13 00:23:01 -04:00
|
|
|
end
|
2025-01-09 15:59:17 +02:00
|
|
|
|
|
|
|
|
exports('Bridge', function()
|
|
|
|
|
return Bridge
|
|
|
|
|
end)
|
|
|
|
|
|
2025-02-05 17:42:50 -06:00
|
|
|
if not IsDuplicityVersion() then goto client end
|
2025-05-09 23:05:44 -05:00
|
|
|
Bridge.RegisterModule('Version', Version)
|
2025-07-25 02:51:14 -05:00
|
|
|
Bridge.RegisterModule('Banking', Banking)
|
2025-02-05 17:42:50 -06:00
|
|
|
|
2025-01-09 15:59:17 +02:00
|
|
|
if IsDuplicityVersion() then return end
|
2025-02-05 17:42:50 -06:00
|
|
|
::client::
|
|
|
|
|
|
2025-01-10 16:36:20 -05:00
|
|
|
Bridge.RegisterModule("Fuel", Fuel)
|
|
|
|
|
Bridge.RegisterModule("Input", Input)
|
2025-02-23 20:03:00 -05:00
|
|
|
Bridge.RegisterModule("ProgressBar", ProgressBar)
|
2025-03-03 01:34:22 -05:00
|
|
|
Bridge.RegisterModule("VehicleKey", VehicleKey)
|
|
|
|
|
Bridge.RegisterModule("Weather", Weather)
|
2025-02-05 17:42:50 -06:00
|
|
|
|
2025-01-16 01:59:53 -05:00
|
|
|
Bridge.RegisterModule("Target", Target)
|
|
|
|
|
Bridge.RegisterModule("Menu", Menu)
|
2026-08-18 00:13:37 -07:00
|
|
|
Bridge.RegisterModule("Dialogue", Dialogue)
|