diff --git a/sourcemap.json b/sourcemap.json index 082a80f..ed45e3d 100644 --- a/sourcemap.json +++ b/sourcemap.json @@ -1 +1 @@ -{"name":"ElevatorGame","className":"DataModel","filePaths":["default.project.json"],"children":[{"name":"ReplicatedFirst","className":"ReplicatedFirst","children":[{"name":"intro","className":"LocalScript","filePaths":["src/load\\intro\\init.client.lua"],"children":[{"name":"IntroGui","className":"ModuleScript","filePaths":["src/load\\intro\\IntroGui.lua"]}]}]},{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"Algebra","className":"ModuleScript","filePaths":["src/shared\\Algebra.lua"]},{"name":"Client","className":"Folder","children":[{"name":"Camera","className":"ModuleScript","filePaths":["src/shared\\Client\\Camera.lua"]},{"name":"KeyBinds","className":"ModuleScript","filePaths":["src/shared\\Client\\KeyBinds.lua"]}]},{"name":"Delta","className":"ModuleScript","filePaths":["src/shared\\Delta.lua"]},{"name":"Enums","className":"ModuleScript","filePaths":["src/shared\\Enums.lua"]},{"name":"Server","className":"Folder","children":[{"name":"holder","className":"ModuleScript","filePaths":["src/shared\\Server\\holder.lua"]}]},{"name":"String","className":"ModuleScript","filePaths":["src/shared\\String.lua"]},{"name":"Tween","className":"ModuleScript","filePaths":["src/shared\\Tween.lua"]}]},{"name":"ServerScriptService","className":"ServerScriptService","children":[{"name":"rapid-Server","className":"Actor","children":[{"name":"main","className":"Script","filePaths":["src/server\\main\\init.server.lua"],"children":[{"name":"EditorEntities","className":"ModuleScript","filePaths":["src/server\\main\\EditorEntities.lua"]},{"name":"Elevators","className":"Folder","children":[{"name":"Buttons","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Buttons.lua"]},{"name":"Floors","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Floors.lua"]},{"name":"Lanterns","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Lanterns.lua"]},{"name":"Mover","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Mover.lua"]},{"name":"Otis1960","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\init.lua"],"children":[{"name":"Doors","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\Doors.lua"]},{"name":"Leveling","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\Leveling.lua"]},{"name":"MovingObjects","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\MovingObjects.lua"]}]},{"name":"TractionRopes","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\TractionRopes.lua"]}]},{"name":"Lighting","className":"ModuleScript","filePaths":["src/server\\main\\Lighting\\init.lua"]},{"name":"Map","className":"Folder","children":[{"name":"LightSwitches","className":"ModuleScript","filePaths":["src/server\\main\\Map\\LightSwitches.lua"]},{"name":"Prompts","className":"ModuleScript","filePaths":["src/server\\main\\Map\\Prompts.lua"]}]},{"name":"StarterPlayer","className":"ModuleScript","filePaths":["src/server\\main\\StarterPlayer.lua"]},{"name":"Tags","className":"ModuleScript","filePaths":["src/server\\main\\Tags.lua"]},{"name":"Workspace","className":"ModuleScript","filePaths":["src/server\\main\\Workspace.lua"]}]}]}]},{"name":"StarterPlayer","className":"StarterPlayer","children":[{"name":"StarterCharacterScripts","className":"StarterCharacterScripts","children":[{"name":"rapid-CharacterRoot","className":"Actor","children":[{"name":"Client","className":"LocalScript","filePaths":["src/client/Character\\Client\\init.client.lua"],"children":[{"name":"Actions","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Actions.lua"]},{"name":"Camera","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Camera\\init.lua"],"children":[{"name":"Bobbing","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Camera\\Bobbing.lua"]}]},{"name":"Humanoid","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Humanoid.lua"]},{"name":"HumanoidRootPart","className":"ModuleScript","filePaths":["src/client/Character\\Client\\HumanoidRootPart.lua"]},{"name":"SpineKinematics","className":"ModuleScript","filePaths":["src/client/Character\\Client\\SpineKinematics.lua"]}]},{"name":"Server","className":"Script","filePaths":["src/client/Character\\Server\\init.server.lua"],"children":[{"name":"Actions","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Actions.lua"]},{"name":"Flashlight","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Flashlight.lua"]},{"name":"Shadows","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Shadows.lua"]},{"name":"SpineKinematics","className":"ModuleScript","filePaths":["src/client/Character\\Server\\SpineKinematics.lua"]}]}]}]},{"name":"StarterPlayerScripts","className":"StarterPlayerScripts","children":[{"name":"rapid-PlayerRoot","className":"Actor","children":[{"name":"Player","className":"LocalScript","filePaths":["src/client/Player\\init.client.lua"],"children":[{"name":"CoreGuis","className":"ModuleScript","filePaths":["src/client/Player\\CoreGuis.lua"]},{"name":"GuiService","className":"ModuleScript","filePaths":["src/client/Player\\GuiService.lua"]},{"name":"Mouse","className":"ModuleScript","filePaths":["src/client/Player\\Mouse.lua"]},{"name":"UI","className":"Folder","children":[{"name":"Crosshair","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Crosshair.lua"]},{"name":"Health","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Health.lua"]},{"name":"Vignette","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Vignette.lua"]}]}]}]}]}]}]} \ No newline at end of file +{"name":"ElevatorGame","className":"DataModel","filePaths":["default.project.json"],"children":[{"name":"ReplicatedFirst","className":"ReplicatedFirst","children":[{"name":"intro","className":"LocalScript","filePaths":["src/load\\intro\\init.client.lua"],"children":[{"name":"IntroGui","className":"ModuleScript","filePaths":["src/load\\intro\\IntroGui.lua"]}]}]},{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"Algebra","className":"ModuleScript","filePaths":["src/shared\\Algebra.lua"]},{"name":"Client","className":"Folder","children":[{"name":"Camera","className":"ModuleScript","filePaths":["src/shared\\Client\\Camera.lua"]},{"name":"KeyBinds","className":"ModuleScript","filePaths":["src/shared\\Client\\KeyBinds.lua"]}]},{"name":"Delta","className":"ModuleScript","filePaths":["src/shared\\Delta.lua"]},{"name":"Enums","className":"ModuleScript","filePaths":["src/shared\\Enums.lua"]},{"name":"Server","className":"Folder","children":[{"name":"holder","className":"ModuleScript","filePaths":["src/shared\\Server\\holder.lua"]}]},{"name":"String","className":"ModuleScript","filePaths":["src/shared\\String.lua"]},{"name":"Tween","className":"ModuleScript","filePaths":["src/shared\\Tween.lua"]}]},{"name":"ServerScriptService","className":"ServerScriptService","children":[{"name":"rapid-Server","className":"Actor","children":[{"name":"main","className":"Script","filePaths":["src/server\\main\\init.server.lua"],"children":[{"name":"EditorEntities","className":"ModuleScript","filePaths":["src/server\\main\\EditorEntities.lua"]},{"name":"Elevators","className":"Folder","children":[{"name":"Buttons","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Buttons.lua"]},{"name":"Floors","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Floors.lua"]},{"name":"Lanterns","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Lanterns.lua"]},{"name":"Mover","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Mover.lua"]},{"name":"Otis1960","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\init.lua"],"children":[{"name":"Doors","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\Doors.lua"]},{"name":"Leveling","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\Leveling.lua"]},{"name":"MovingObjects","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\Otis1960\\MovingObjects.lua"]}]},{"name":"TractionRopes","className":"ModuleScript","filePaths":["src/server\\main\\Elevators\\TractionRopes.lua"]}]},{"name":"Lighting","className":"ModuleScript","filePaths":["src/server\\main\\Lighting\\init.lua"]},{"name":"Map","className":"Folder","children":[{"name":"Interactions","className":"Folder","children":[{"name":"LightSwitches","className":"ModuleScript","filePaths":["src/server\\main\\Map\\Interactions\\LightSwitches.lua"]}]},{"name":"Prompts","className":"ModuleScript","filePaths":["src/server\\main\\Map\\Prompts.lua"]}]},{"name":"StarterPlayer","className":"ModuleScript","filePaths":["src/server\\main\\StarterPlayer.lua"]},{"name":"Tags","className":"ModuleScript","filePaths":["src/server\\main\\Tags.lua"]},{"name":"Workspace","className":"ModuleScript","filePaths":["src/server\\main\\Workspace.lua"]}]}]}]},{"name":"StarterPlayer","className":"StarterPlayer","children":[{"name":"StarterCharacterScripts","className":"StarterCharacterScripts","children":[{"name":"rapid-CharacterRoot","className":"Actor","children":[{"name":"Client","className":"LocalScript","filePaths":["src/client/Character\\Client\\init.client.lua"],"children":[{"name":"Actions","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Actions.lua"]},{"name":"Camera","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Camera\\init.lua"],"children":[{"name":"Bobbing","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Camera\\Bobbing.lua"]}]},{"name":"Humanoid","className":"ModuleScript","filePaths":["src/client/Character\\Client\\Humanoid.lua"]},{"name":"HumanoidRootPart","className":"ModuleScript","filePaths":["src/client/Character\\Client\\HumanoidRootPart.lua"]},{"name":"SpineKinematics","className":"ModuleScript","filePaths":["src/client/Character\\Client\\SpineKinematics.lua"]}]},{"name":"Server","className":"Script","filePaths":["src/client/Character\\Server\\init.server.lua"],"children":[{"name":"Actions","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Actions.lua"]},{"name":"Flashlight","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Flashlight.lua"]},{"name":"Shadows","className":"ModuleScript","filePaths":["src/client/Character\\Server\\Shadows.lua"]},{"name":"SpineKinematics","className":"ModuleScript","filePaths":["src/client/Character\\Server\\SpineKinematics.lua"]}]}]}]},{"name":"StarterPlayerScripts","className":"StarterPlayerScripts","children":[{"name":"rapid-PlayerRoot","className":"Actor","children":[{"name":"Player","className":"LocalScript","filePaths":["src/client/Player\\init.client.lua"],"children":[{"name":"CoreGuis","className":"ModuleScript","filePaths":["src/client/Player\\CoreGuis.lua"]},{"name":"GuiService","className":"ModuleScript","filePaths":["src/client/Player\\GuiService.lua"]},{"name":"Mouse","className":"ModuleScript","filePaths":["src/client/Player\\Mouse.lua"]},{"name":"UI","className":"Folder","children":[{"name":"Crosshair","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Crosshair.lua"]},{"name":"Health","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Health.lua"]},{"name":"Vignette","className":"ModuleScript","filePaths":["src/client/Player\\UI\\Vignette.lua"]}]}]}]}]}]}]} \ No newline at end of file diff --git a/src/load/intro/IntroGui.lua b/src/load/intro/IntroGui.lua index 436936c..e71892a 100644 --- a/src/load/intro/IntroGui.lua +++ b/src/load/intro/IntroGui.lua @@ -4,7 +4,39 @@ --Not a good idea to call modules from other services here ---Who said UI on here cant look like a web design lole, +type RotationMatrix = { + Ixx: number, + Ixy: number, + Iyx: number, + Iyy: number, + Izx: number, + Izy: number +} + +type Scalar = { + Distance: number, + Center: Vector2, + Rotation: number +} + +type Stepped = RBXScriptConnection + +type GuiDependencies = { + IntroGui: ScreenGui, + Frame: Frame, + FrameGradient: UIGradient, + TextShadow: TextLabel, + ShadowGradient: UIGradient, + FrameworkText: TextLabel, + SandboxText: TextLabel, + DeveloperText: TextLabel, + Xframe: Frame, + Yframe: Frame, + Zframe: Frame, + Xframe_text: TextLabel, + Yframe_text: TextLabel, + Zframe_text: TextLabel, +} local RS = game:GetService("RunService") local Storage = game:GetService("ReplicatedStorage") @@ -12,101 +44,138 @@ local TS = game:GetService("TestService") local LoadingFun = true -local function GuiDependencies(IntroGui: ScreenGui) +local function GuiDependencies(IntroGui: ScreenGui): GuiDependencies IntroGui.Enabled = true - local Frame = IntroGui:WaitForChild("Frame") - local Viewport = Frame:WaitForChild("ViewportFrame") + local Frame = IntroGui:WaitForChild("Frame") :: Frame - local FrameGradient = Frame:WaitForChild("UIGradient") - local TextShadow = Frame:WaitForChild("TextShadow") - local FrameworkText = Frame:WaitForChild("Framework") - local SandboxText = Frame:WaitForChild("Sandbox") - local DeveloperText = Frame:WaitForChild("Developer") - local ShadowGradient = TextShadow:WaitForChild("UIGradient") + 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 ViewportCamera = Instance.new("Camera") - ViewportCamera.FieldOfView = 50 - ViewportCamera.Parent = Viewport - Viewport.CurrentCamera = ViewportCamera + local Xframe = Frame:WaitForChild("X") :: Frame + local Yframe = Frame:WaitForChild("Y") :: Frame + local Zframe = Frame:WaitForChild("Z") :: Frame - local GL_Cube = Viewport:WaitForChild("GL_Cube") + local Xframe_text = Frame:WaitForChild("X_text") :: TextLabel + local Yframe_text = Frame:WaitForChild("Y_text") :: TextLabel + local Zframe_text = Frame:WaitForChild("Z_text") :: TextLabel return { IntroGui = IntroGui, Frame = Frame, - Viewport = Viewport, - ViewportCamera = ViewportCamera, - GL_Cube = GL_Cube, FrameGradient = FrameGradient, TextShadow = TextShadow, ShadowGradient = ShadowGradient, FrameworkText = FrameworkText, SandboxText = SandboxText, - DeveloperText = DeveloperText + DeveloperText = DeveloperText, + Xframe = Xframe, + Yframe = Yframe, + Zframe = Zframe, + Xframe_text = Xframe_text, + Yframe_text = Yframe_text, + Zframe_text = Zframe_text, } end -type GUIs = typeof(GuiDependencies) -type Stepped = RBXScriptConnection - -local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs) --We can now access the framework +local function GUI_LoadFinish(Stepped: Stepped, Gui: GuiDependencies) --We can now access the framework --Image if we had HTML and CSS... local Tween = require(Storage:WaitForChild("Tween")) - local EaseStyle = Enum.EasingStyle.Linear - - local FrameTween_Constructor = Tween.constructor(TweenInfo.new(1, EaseStyle), Gui.Frame, { + local FrameTween_Constructor = Tween.constructor(TweenInfo.new(1, Enum.EasingStyle.Linear), Gui.Frame, { BackgroundTransparency = 1 }) - local DeveloperTween_Constructor = Tween.constructor(TweenInfo.new(1, EaseStyle), Gui.DeveloperText, { + local DeveloperTween_Constructor = Tween.constructor(TweenInfo.new(1, Enum.EasingStyle.Linear), Gui.DeveloperText, { TextTransparency = 1 }) - local ViewportFrame_Constructor = Tween.constructor(TweenInfo.new(3, EaseStyle), Gui.Viewport, { - Position = UDim2.fromScale(0.5, 2) --Guaranteed off screen - }) - FrameTween_Constructor:Start() + local FrameTween = FrameTween_Constructor:Start() DeveloperTween_Constructor:Start() - local ViewportTween = ViewportFrame_Constructor:Start() --The longest tween --Text deleting effect task.spawn(function() - local sandbox_text_len = #Gui.SandboxText.Text - - for i = sandbox_text_len, 1, -1 do --"A sandbox experience" has the longest text - local rhpid_text_len = #Gui.FrameworkText.Text - - Gui.SandboxText.Text = Gui.SandboxText.Text:sub(1,i-1) - if rhpid_text_len ~= 0 then - Gui.FrameworkText.Text = Gui.FrameworkText.Text:sub(1,i-1) + for n: number = #Gui.SandboxText.Text, 1, -1 do --"A sandbox experience" has the longest text + Gui.SandboxText.Text = Gui.SandboxText.Text:sub(1,n-1) + if #Gui.FrameworkText.Text ~= 0 then + Gui.FrameworkText.Text = Gui.FrameworkText.Text:sub(1,n-1) Gui.TextShadow.Text = Gui.FrameworkText.Text --heh hack end task.wait(.05) end end) - ViewportTween.Completed:Wait() + FrameTween.Completed:Wait() Stepped:Disconnect() Gui.IntroGui:Destroy() --We dont need the intro gui anymore end -type GL_Cube = Instance -type GL_Side = Instance +local function RotationMatrix(X: number, Y: number, Z: number): RotationMatrix + return { + Ixx = math.cos(Z)*math.cos(X)-math.sin(Z)*math.sin(X)*math.sin(Y); + Ixy = math.cos(Z)*math.sin(X)*math.sin(Y)+math.sin(Z)*math.cos(X); + Iyx = -math.cos(Z)*math.sin(X)-math.sin(Z)*math.cos(X)*math.sin(Y); + Iyy = math.cos(Z)*math.cos(X)*math.sin(Y)-math.sin(Z)*math.sin(X); + Izx = -math.sin(Z)*math.cos(Y); + Izy = math.cos(Z)*math.sin(Y) + } +end + +local function Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar + return { + Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2)); + Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2); + Rotation = math.deg(math.atan2(Y1-Y2,X1-X2)) + } +end + +local Size = 300 +local WorldSize = 3 return function(IntroGui: ScreenGui, load_elapse_start: number) local Gui = GuiDependencies(IntroGui) - Gui.ViewportCamera.CFrame = CFrame.lookAt(Gui.GL_Cube.Position-Vector3.new(3,-2.5,5), Gui.GL_Cube.Position) + local Stepped = RS.Stepped:Connect(function(Delta: number, dt: number) + local ScreenD = workspace.CurrentCamera.ViewportSize + local CenterX = ScreenD.X/2 + local CenterY = ScreenD.Y/1.4 - local Cube_CF = Gui.GL_Cube.CFrame - local Stepped = RS.Stepped:Connect(function(delta, dt) - --Magic number heaven - local d2 = delta*10 - Gui.FrameGradient.Rotation=d2 - Gui.ShadowGradient.Rotation=d2*4 + local mX = Delta/1.5 + local mY = Delta/1.5 + local mZ = -7.65 + + local RMatrix = RotationMatrix(mX,mY,mZ) + local X = {Size*RMatrix.Ixx, Size*RMatrix.Ixy} + local Y = {Size*RMatrix.Iyx, Size*RMatrix.Iyy} + local Z = {Size*RMatrix.Izx, Size*RMatrix.Izy} + + local AXIS_R_3DScalar_X = Scalar(CenterX+X[1],CenterY+X[2],CenterX,CenterY) + local AXIS_R_3DScalar_Y = Scalar(CenterX+Y[1],CenterY+Y[2],CenterX,CenterY) + local AXIS_R_3DScalar_Z = Scalar(CenterX+Z[1],CenterY+Z[2],CenterX,CenterY) - Gui.GL_Cube.CFrame = Cube_CF*CFrame.Angles(math.rad(100*math.cos(delta/8)), 0, delta/2) + Gui.Xframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_X.Distance, WorldSize) + Gui.Xframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_X.Center.X, AXIS_R_3DScalar_X.Center.Y) + Gui.Xframe.Rotation = AXIS_R_3DScalar_X.Rotation + + Gui.Xframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_X.Center.X, AXIS_R_3DScalar_X.Center.Y) + Gui.Xframe_text.Rotation = Gui.Xframe.Rotation + + Gui.Yframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_Y.Distance, WorldSize) + Gui.Yframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_Y.Center.X, AXIS_R_3DScalar_Y.Center.Y) + Gui.Yframe.Rotation = AXIS_R_3DScalar_Y.Rotation + + Gui.Yframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_Y.Center.X, AXIS_R_3DScalar_Y.Center.Y) + Gui.Yframe_text.Rotation = Gui.Yframe.Rotation + + Gui.Zframe.Size = UDim2.fromOffset(AXIS_R_3DScalar_Z.Distance, WorldSize) + Gui.Zframe.Position = UDim2.fromOffset(AXIS_R_3DScalar_Z.Center.X, AXIS_R_3DScalar_Z.Center.Y) + Gui.Zframe.Rotation = AXIS_R_3DScalar_Z.Rotation + + Gui.Zframe_text.Position = UDim2.fromOffset(AXIS_R_3DScalar_Z.Center.X, AXIS_R_3DScalar_Z.Center.Y) + Gui.Zframe_text.Rotation = Gui.Zframe.Rotation end) task.spawn(function() diff --git a/src/load/intro/init.client.lua b/src/load/intro/init.client.lua index 498e900..4d6db3f 100644 --- a/src/load/intro/init.client.lua +++ b/src/load/intro/init.client.lua @@ -8,7 +8,7 @@ local ReplicatedFirst = game:GetService("ReplicatedFirst") local Players = game:GetService("Players") local Storage = game:GetService("ReplicatedStorage") -local DisabledInStudio = game:GetService("RunService"):IsStudio() +local DisabledInStudio = false local IntroGui = nil local function LoadedBind() @@ -21,6 +21,8 @@ local function LoadedBind() end local function LoadingIntroGUI() + ReplicatedFirst:RemoveDefaultLoadingScreen() + local RunIntroGui = require(script:WaitForChild("IntroGui")) local Player = Players.LocalPlayer @@ -46,6 +48,4 @@ if not DisabledInStudio then LoadingIntroGUI() end -LoadedBind() - -ReplicatedFirst:RemoveDefaultLoadingScreen() +LoadedBind() \ No newline at end of file diff --git a/src/server/main/Map/LightSwitches.lua b/src/server/main/Map/Interactions/LightSwitches.lua similarity index 89% rename from src/server/main/Map/LightSwitches.lua rename to src/server/main/Map/Interactions/LightSwitches.lua index 2f48615..225edd6 100644 --- a/src/server/main/Map/LightSwitches.lua +++ b/src/server/main/Map/Interactions/LightSwitches.lua @@ -2,7 +2,7 @@ --!native --!strict -local MapDir = script.Parent +local MapDir = script.Parent.Parent local MainDir = MapDir.Parent local Storage = game:GetService("ReplicatedStorage") @@ -19,7 +19,7 @@ type Impl_Constructor = { __index: Impl_Constructor, constructor: Constructor_Fun, --Class functions - Create: (self: ClassConstructor) -> (), + Init: (self: ClassConstructor) -> (), } & Impl_Static_Props type Impl_Static_Props = { @@ -38,8 +38,6 @@ Lights.__index = Lights Lights.SwitchAnimationTime = .1 -local LightSwitchTween = TweenModule.constructor(TweenInfo.new(Lights.SwitchAnimationTime, Enum.EasingStyle.Linear)) - function Lights.constructor(LightSwitches) return setmetatable({ LightSwitches = LightSwitches @@ -65,6 +63,8 @@ local function ToggleSwitchLight(EnabledState: boolean, LightObject: BasePart, L end end +local LightSwitchTween = TweenModule.constructor(TweenInfo.new(Lights.SwitchAnimationTime, Enum.EasingStyle.Linear)) + local function SwitchAnimation(EnabledState: boolean, LightProperties: LightProperties) local Switch = LightProperties.Switch @@ -85,7 +85,7 @@ end Guide for lights with toggable switches: TODO ]] -function Lights:Create() +function Lights:Init() for _, LightProperties in self.LightSwitches do if LightProperties.Prompt and LightProperties.Switch then local Prompt = PromptsConstructor.constructor(LightProperties.Prompt, LightProperties.Switch) @@ -104,7 +104,7 @@ function Lights:Create() end end) else - warn(`Prompt failed`) + warn(`LightSwitch hook failed, a required field is missing:\n-----\nColorDeactivated = {LightProperties.ColorDeactivated}\nColorActivated = {LightProperties.ColorActivated}\nPrompt = {LightProperties.Prompt}\nLights = {LightProperties.Lights}\n-----`) end end end diff --git a/src/server/main/Tags.lua b/src/server/main/Tags.lua index 52958b5..3ed72b8 100644 --- a/src/server/main/Tags.lua +++ b/src/server/main/Tags.lua @@ -77,7 +77,6 @@ export type InteractablesTree = { LightSwitches: LightSwitchTree } - export type ButtonsTree = { Landing: ButtonProperties, Car: ButtonProperties, @@ -237,7 +236,7 @@ function Tags:__Interactables() if InteractType == Enums.Interactables.LightSwitch then local ptr = Interactables.LightSwitches[InteractObjectLocation] local itype = type(Inst) == "table" - local Switch = itype and (Inst :: {Instance})[1] or Inst :: Instance + local Switch = (itype and (Inst :: {Instance})[1] or Inst :: Instance) :: BasePart if itype then warn(`2 or more light switch tags were present under the same name, using the first index. "{TagName}". This feature is not implemented yet`) end @@ -249,6 +248,7 @@ function Tags:__Interactables() Prompt.HoldDuration = Tags.MaxLightSwitchHoldDuration Prompt.Parent = Attachment local ClickSound = Instance.new("Sound") :: Sound + ClickSound.Volume = .1 ClickSound.SoundId = Tags.LightSwitchActivateSoundId ClickSound.Parent = Switch @@ -281,7 +281,7 @@ function Tags:__Interactables() ptr.Lights = Inst else ptr.Lights = {} - table.insert(ptr.Lights :: {Instance}, Inst) + table.insert(ptr.Lights :: {BasePart}, Inst :: BasePart) end end end diff --git a/src/server/main/init.server.lua b/src/server/main/init.server.lua index 7bf313f..e9cbb3b 100644 --- a/src/server/main/init.server.lua +++ b/src/server/main/init.server.lua @@ -7,7 +7,12 @@ local ShowEditorEntities = game:GetService("RunService"):IsServer() local Storage = game:GetService("ReplicatedStorage") local Enums = require(Storage:WaitForChild("Enums")) -local Elevators = script:WaitForChild("Elevators") +local Elevators = script:WaitForChild("Elevators") +local Maps = script:WaitForChild("Map") + +local Interactions = Maps:WaitForChild("Interactions") +local LightSwitches = require(Interactions:WaitForChild("LightSwitches")) + local Otis1960_Module = require(Elevators:WaitForChild("Otis1960")) local TagsModule = require(script:WaitForChild("Tags")) @@ -30,6 +35,10 @@ Workspace_Stuff() local Interactables = TagsConstructor:__Interactables() print("[DEBUG] Interactables=", Interactables) +--Interactables +local LightSwitchesConstructor = LightSwitches.constructor(Interactables.LightSwitches) +LightSwitchesConstructor:Init() + --Start the elevators local Buttons = TagsConstructor:__ElevatorButtons() print("[DEBUG] Buttons=", Buttons) diff --git a/src/shared/Algebra.lua b/src/shared/Algebra.lua index 70d924c..feb678f 100644 --- a/src/shared/Algebra.lua +++ b/src/shared/Algebra.lua @@ -7,16 +7,52 @@ type EaseFunction = (n: number) -> number type LinearFunction = (a: number, b: number, t: number) -> number +export type RotationMatrix = { + Ixx: number, + Ixy: number, + Iyx: number, + Iyy: number, + Izx: number, + Izy: number +} + +export type Scalar = { + Distance: number, + Center: Vector2, + Rotation: number +} + export type Math = { Linear: LinearFunction, InOutBack: EaseFunction, OutBounce: EaseFunction, InQuad: EaseFunction, + RotationMatrix: (X: number, Y: number, Z: number) -> RotationMatrix, + Scalar: (X1: number, Y1: number, X2: number, Y2: number) -> Scalar } local Math = {} :: Math ---Google straight up gives wrong/bad math +function Math.RotationMatrix(X: number, Y: number, Z: number): RotationMatrix + return { + Ixx = math.cos(Z)*math.cos(X)-math.sin(Z)*math.sin(X)*math.sin(Y); + Ixy = math.cos(Z)*math.sin(X)*math.sin(Y)+math.sin(Z)*math.cos(X); + Iyx = -math.cos(Z)*math.sin(X)-math.sin(Z)*math.cos(X)*math.sin(Y); + Iyy = math.cos(Z)*math.cos(X)*math.sin(Y)-math.sin(Z)*math.sin(X); + Izx = -math.sin(Z)*math.cos(Y); + Izy = math.cos(Z)*math.sin(Y) + } +end + +function Math.Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar + return { + Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2)); + Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2); + Rotation = math.deg(math.atan2(Y1-Y2,X1-X2)) + } +end + +--My versions function Math.Linear(a,b,t) return a-a*t+b*t end