Skip to content

Commit

Permalink
Update Addons.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
gdr1461 authored Jul 3, 2024
1 parent cbc4a55 commit 109351c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Source/Addons.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export type GAdminAddons = {
__metatable: string,
__type: string,
__PackSystem: {[string]: ModuleScript},

SeparateAll: (self: GAdminAddons) -> (),
Separate: (self: GAdminAddons, Pack: Folder) -> (),

GetServerCommands: (self: GAdminAddons, NonRequired: boolean?) -> ModuleScript,
GetClientCommands: (self: GAdminAddons, NonRequired: boolean?) -> ModuleScript,
Expand All @@ -14,6 +18,13 @@ local Addons: GAdminAddons = getmetatable(Proxy)
Addons.__metatable = "[GAdmin Addons]: Metatable methods are restricted."
Addons.__type = "GAdmin Addons"

Addons.__PackSystem = {
ServerCommands = script.ServerCommands,
ClientCommands = script.ClientCommands,
Calls = script.Calls,
TopBars = script.TopBars
}

function Addons:__tostring()
return self.__type
end
Expand Down Expand Up @@ -43,4 +54,25 @@ function Addons:GetTopBars()
return script.TopBars
end

function Addons:SeparateAll()
for i, Package in ipairs(script.Packs:GetChildren()) do
self:Separate(Package)
end
end

function Addons:Separate(Pack)
for System, Parent in pairs(self.__PackSystem) do
local ModuleObject = Pack:FindFirstChild(System)
print(Pack.Name, System, ModuleObject)
if not ModuleObject then
continue
end

ModuleObject.Name = `[{Pack.Name}] {System}`
ModuleObject.Parent = Parent
end

Pack:Destroy()
end

return Proxy :: GAdminAddons

0 comments on commit 109351c

Please sign in to comment.