diff --git a/src/client/Character/init.lua b/src/client/Character/init.lua index af60d0a..cdb0fdf 100644 --- a/src/client/Character/init.lua +++ b/src/client/Character/init.lua @@ -3,8 +3,11 @@ --!strict type CharacterSharedFolder = Folder +type Character = Model type TCP = RemoteEvent +type include = (this: LuaSourceContainer, FunName: string, ...T) -> T + local CharacterModule = {} CharacterModule.__index = CharacterModule @@ -13,25 +16,29 @@ local Storage = game:GetService("ReplicatedStorage") local ClientStorage = Storage:WaitForChild("Client") :: Folder -local preprocessor = {} -local CharacterShared: Folder +local function client_preprocessor(Character: Character): (include, CharacterSharedFolder) + local preprocessor = {} + local CharacterShared = Character:WaitForChild("shared") :: CharacterSharedFolder -function preprocessor.CharacterShared(): CharacterSharedFolder - return CharacterShared -end - -_G.include = function(this: LuaSourceContainer, FunName: string, ...) - if this:IsDescendantOf(script) then --getfenv is being removed - local switch = preprocessor[FunName] - return type(switch) == "function" and switch(...) or switch - else - warn(`Preprocessor append failed "{FunName}"`, debug.traceback()) - return nil + function preprocessor.CharacterShared(): CharacterSharedFolder + return CharacterShared end + + _G.include = function(this: LuaSourceContainer, FunName: string, ...: T) + if this:IsDescendantOf(script) then --getfenv is being removed + local switch = preprocessor[FunName] + return type(switch) == "function" and switch(...) or switch + else + warn(`Preprocessor append failed "{FunName}"`, debug.traceback()) + return nil + end + end + + return _G.include, CharacterShared end function CharacterModule.constructor(Character) - CharacterShared = Character:WaitForChild("shared") + local _, CharacterShared = client_preprocessor(Character) local HumanoidRPSettings = require(script:WaitForChild("HumanoidRootPart")) local CameraModule = require(script:WaitForChild("Camera")) @@ -52,6 +59,11 @@ function CharacterModule.constructor(Character) self.HumanoidSettings = HumanoidModule.constructor(Humanoid) self.SpineMovement = SpineModule.constructor(self.CurrentCamera) + pcall(table.clear, _G) + pcall(table.freeze, _G) + pcall(table.clear, shared) + pcall(table.freeze, shared) + return setmetatable(self, CharacterModule) end @@ -120,6 +132,4 @@ function CharacterModule:EnableSpineMovement() self.SpineMovement:Enable() end -_G.include = nil - return CharacterModule \ No newline at end of file diff --git a/src/load/intro/IntroGui.lua b/src/load/intro/IntroGui.lua index 40cd4f1..d815037 100644 --- a/src/load/intro/IntroGui.lua +++ b/src/load/intro/IntroGui.lua @@ -19,8 +19,6 @@ type Scalar = { Rotation: number } -type Stepped = RBXScriptConnection - type GuiDependencies = { IntroGui: ScreenGui, Frame: Frame, @@ -52,14 +50,14 @@ local function GuiDependencies(IntroGui: ScreenGui): GuiDependencies local Frame = IntroGui:WaitForChild("Frame") :: Frame - local FrameGradient = Frame:WaitForChild("UIGradient") :: UIGradient - local TextShadow = Frame:WaitForChild("TextShadow") :: TextLabel - local FrameworkText = Frame:WaitForChild("Framework") :: TextLabel - local SandboxText = Frame:WaitForChild("Sandbox") :: TextLabel - local DeveloperText = Frame:WaitForChild("Developer") :: TextLabel + local FrameGradient = Frame:WaitForChild("UIGradient") :: UIGradient + local TextShadow = Frame:WaitForChild("TextShadow") :: TextLabel + local FrameworkText = Frame:WaitForChild("Framework") :: TextLabel + local SandboxText = Frame:WaitForChild("Sandbox") :: TextLabel + local DeveloperText = Frame:WaitForChild("Developer") :: TextLabel local ShadowGradient = TextShadow:WaitForChild("UIGradient") :: UIGradient - local Quaternions = Frame:WaitForChild("Quaternions") :: ImageLabel - local TaylorSeries = Frame:WaitForChild("TaylorSeries") :: ImageLabel + local Quaternions = Frame:WaitForChild("Quaternions") :: ImageLabel + local TaylorSeries = Frame:WaitForChild("TaylorSeries") :: ImageLabel local Xframe = Frame:WaitForChild("X") :: Frame local Yframe = Frame:WaitForChild("Y") :: Frame @@ -92,7 +90,7 @@ end local Size = 300 local WorldSize = 3 -local function GUI_LoadFinish(Stepped: Stepped, Gui: GuiDependencies) --We can now access the framework +local function GUI_LoadFinish(Gui: GuiDependencies) --We can now access the framework --Image if we had HTML and CSS... local Tween = require(Storage:WaitForChild("Tween")) @@ -141,7 +139,6 @@ local function GUI_LoadFinish(Stepped: Stepped, Gui: GuiDependencies) --We can n end) FrameTween.Completed:Wait() - Stepped:Disconnect() Gui.IntroGui:Destroy() --We dont need the intro gui anymore script.Parent:Destroy() end @@ -206,7 +203,7 @@ end return function(IntroGui: ScreenGui, load_elapse_start: number) local Gui = GuiDependencies(IntroGui) - local Stepped = RS.Stepped:Connect(function(Delta: number, _dt: number) + RS.Stepped:Connect(function(Delta: number, _dt: number) UI_3D_Rotation(Gui, Delta) end) @@ -224,6 +221,6 @@ return function(IntroGui: ScreenGui, load_elapse_start: number) TS:Message("Load elapse: "..tostring(load_elapse), game) - GUI_LoadFinish(Stepped, Gui) + GUI_LoadFinish(Gui) end) end \ No newline at end of file diff --git a/src/server/main/Characters/init.lua b/src/server/main/Characters/init.lua index 3c4d37f..fc09039 100644 --- a/src/server/main/Characters/init.lua +++ b/src/server/main/Characters/init.lua @@ -11,13 +11,6 @@ local Dir = script.Parent local Character = Dir.Parent local preprocessor = {} ---Production-- ---if not RS:IsStudio() then - task.wait() - Dir.Parent = nil ---end --- - --Create the character shared directory here local CharacterShared = Instance.new("Folder") CharacterShared.Name = "shared"