Skip to content

Commit

Permalink
Update AtomServer_OOP.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyRBLX11 committed Nov 24, 2024
1 parent 32b85ff commit 46072f9
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/Atom/AtomModuleContents/AtomServer_OOP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local Components : Folder = AtomRoot.Components
local Packages = AtomRoot:WaitForChild("Packages")

-- Overwrite Functions
local ModuleLoader = require(script.Parent.Utils.ModuleLoader) -- Needed for custom require.
-- local ModuleLoader = require(script.Parent.Utils.ModuleLoader) -- Needed for custom require.
--[[local function require(Directory:Instance, ScriptName:string)
return ModuleLoader:require(Directory, ScriptName)
end ]] -- Removed while I try fix the Intellisense issues it causes.
Expand All @@ -33,23 +33,24 @@ function SubTick()
return tick() / 2
end

local ByteNet = require(Packages.ByteNet)
-- local ByteNet = require(Packages.ByteNet)
local GoodSignal = require(Packages.GoodSignal)
local Janitor = require(Packages.Janitor)
local Promise = require(Packages.Promise)
local ProfileService = require(Packages.ProfileService)
local Sourceesque = require(Packages.Sourceesque)
local Warp = require(Packages.Warp)
local Switch, case, default = unpack(require(Packages.Switch))
-- local ProfileService = require(Packages.ProfileService)
-- local Sourceesque = require(Packages.Sourceesque)
-- local Warp = require(Packages.Warp)
-- local Switch, case, default = unpack(require(Packages.Switch))

-- Make references for Repositories.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

local Remotes = AtomRoot.AtomRemotes

local onCompletedSignal = Instance.new("BindableEvent", Remotes.BindableEvents)
local onCompletedSignal = Instance.new("BindableEvent")
onCompletedSignal.Name = "onCompleted"
onCompletedSignal.Parent = Remotes.BindableEvents
local ErrorSignal = GoodSignal.new()

-- DRY Signal Handler.
Expand Down Expand Up @@ -97,8 +98,13 @@ Atom.Start()
]]
function AtomMain.Start()
if started then return Promise.reject("Atom has already started.") end
if _VERSION ~= "Luau" then ErrorSignal:Fire("Atom can't run on non Luau Runtimes.") return end
if started then
return Promise.reject("Atom has already started.")
end
if _VERSION ~= "Luau" then
ErrorSignal:Fire("Atom can't run on non Luau Runtimes.")
return
end

local StartTick = tick()
local StartSubTick = SubTick()
Expand All @@ -120,6 +126,7 @@ function AtomMain.Start()
local MaxFolderItterations = 4
local CurrentFolderItterations = 0
for i, v in ipairs(AtomRoot:GetChildren()) do
print(i)
if CurrentFolderItterations >= MaxFolderItterations then
break
end
Expand All @@ -130,6 +137,7 @@ function AtomMain.Start()
if v:IsA("Folder") then
if v:GetAttribute("Cleanable") ~= false then
for _, scriptObject in pairs(v:GetChildren()) do
scriptObject:Destroy()
InitJanitor:Add(v)
end
end
Expand Down Expand Up @@ -172,7 +180,10 @@ end

function AtomMain.GetService(ServiceName: string)
for i, v in ipairs(Services:GetChildren()) do
if v.ClassName ~= "ModuleScript" and v.Name ~= ServiceName then continue end
print(i)
if v.ClassName ~= "ModuleScript" and v.Name ~= ServiceName then
continue
end
return require(Services:WaitForChild(ServiceName))
end
end
Expand Down

0 comments on commit 46072f9

Please sign in to comment.