chore: refractor

This commit is contained in:
2026-01-08 22:58:58 +02:00
parent da7de7b08a
commit 2c41f40151
49 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,58 @@
--!native
--!optimize 2
local ML = {}
type modContext = {
name: string,
description: string,
ns: string,
author: {string},
init: typeof(function()end)
}
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Shared = ReplicatedStorage:WaitForChild("Shared")
local ModsFolder = ReplicatedStorage:WaitForChild("Mods")
function ML.loadModsS()
print("[SSModLoader] Loading Mods")
for _, m in pairs(ModsFolder:GetChildren()) do
local success, reason = pcall(function()
-- ignore type err
local mod: modContext = require(m)
mod.init()
print(`[SSModLoader] Loaded {mod.name} ({mod.ns}) by {table.concat(mod.author,", ")}`)
end)
if not success then
warn(`[CSModLoader] Error loading {m.Name}: {reason}`)
end
end
end
function ML.loadModsC(onProgress: ((number, number, Instance, boolean) -> ())?)
print("[CSModLoader] Loading Mods")
local mods = ModsFolder:GetChildren()
local total = #mods
for i, m in ipairs(mods) do
local success, reason = pcall(function()
-- ignore type err
local mod: modContext = require(m)
mod.init()
print(`[CSModLoader] Loaded {mod.name} ({mod.ns}) by {table.concat(mod.author,", ")}`)
end)
if not success then
warn(`[CSModLoader] Error loading {m.Name}: {reason}`)
end
if onProgress then
pcall(function()
onProgress(i, total, m, success)
end)
end
end
end
return ML