This commit is contained in:
2024-04-20 16:46:10 -04:00
parent b82606d64c
commit 36625162a1
3 changed files with 36 additions and 36 deletions

View File

@@ -3,8 +3,11 @@
--!strict
type CharacterSharedFolder = Folder
type Character = Model
type TCP = RemoteEvent
type include<T> = (this: LuaSourceContainer, FunName: string, ...T) -> T
local CharacterModule = {}
CharacterModule.__index = CharacterModule
@@ -13,14 +16,15 @@ local Storage = game:GetService("ReplicatedStorage")
local ClientStorage = Storage:WaitForChild("Client") :: Folder
local preprocessor = {}
local CharacterShared: Folder
local function client_preprocessor<T>(Character: Character): (include<T>, CharacterSharedFolder)
local preprocessor = {}
local CharacterShared = Character:WaitForChild("shared") :: CharacterSharedFolder
function preprocessor.CharacterShared(): CharacterSharedFolder
function preprocessor.CharacterShared(): CharacterSharedFolder
return CharacterShared
end
end
_G.include = function(this: LuaSourceContainer, FunName: string, ...)
_G.include = function<T>(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
@@ -28,10 +32,13 @@ _G.include = function(this: LuaSourceContainer, FunName: string, ...)
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

View File

@@ -19,8 +19,6 @@ type Scalar = {
Rotation: number
}
type Stepped = RBXScriptConnection
type GuiDependencies = {
IntroGui: ScreenGui,
Frame: 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

View File

@@ -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"