Actor support

This commit is contained in:
2024-02-21 13:23:23 -05:00
parent ff16d8ceb3
commit e5f1a546b1
21 changed files with 284 additions and 73 deletions

View File

@@ -2,7 +2,6 @@
"name": "ElevatorGame", "name": "ElevatorGame",
"tree": { "tree": {
"$className": "DataModel", "$className": "DataModel",
"ReplicatedStorage": { "ReplicatedStorage": {
"$path": "src/shared" "$path": "src/shared"
}, },
@@ -12,17 +11,21 @@
"ReplicatedFirst": { "ReplicatedFirst": {
"$path": "src/load" "$path": "src/load"
}, },
"StarterPlayer": { "StarterPlayer": {
"StarterPlayerScripts": { "StarterPlayerScripts": {
"PlayerRoot -rapid": {
"$className": "Actor",
"Player": { "Player": {
"$path": "src/client/Player" "$path": "src/client/Player"
} }
}
}, },
"StarterCharacterScripts": { "StarterCharacterScripts": {
"CharacterRoot -rapid": {
"$className": "Actor",
"$path": "src/client/Character" "$path": "src/client/Character"
} }
} }
} }
}
} }

1
sourcemap.json Normal file
View File

@@ -0,0 +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":"AlgebraEasings","className":"ModuleScript","filePaths":["src/shared/AlgebraEasings.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":"Server","className":"Folder","children":[{"name":"holder","className":"ModuleScript","filePaths":["src/shared/Server/holder.lua"]}]},{"name":"String","className":"ModuleScript","filePaths":["src/shared/String.lua"]},{"name":"Tags","className":"ModuleScript","filePaths":["src/shared/Tags.lua"]},{"name":"Tween","className":"ModuleScript","filePaths":["src/shared/Tween.lua"]},{"name":"types","className":"Folder","children":[{"name":"class","className":"ModuleScript","filePaths":["src/shared/types/class.lua"]}]}]},{"name":"ServerScriptService","className":"ServerScriptService","children":[{"name":"Elevators","className":"Folder","children":[{"name":"Floors","className":"ModuleScript","filePaths":["src/server/Elevators/Floors.lua"]},{"name":"Leveling","className":"ModuleScript","filePaths":["src/server/Elevators/Leveling.lua"]},{"name":"Mover","className":"ModuleScript","filePaths":["src/server/Elevators/Mover.lua"]},{"name":"Otis1960","className":"Folder","children":[{"name":"Doors","className":"ModuleScript","filePaths":["src/server/Elevators/Otis1960/Doors.lua"]},{"name":"main","className":"Script","filePaths":["src/server/Elevators/Otis1960/main.server.lua"]}]}]},{"name":"Studio","className":"Script","filePaths":["src/server/Studio/init.server.lua"],"children":[{"name":"EditorEntities","className":"ModuleScript","filePaths":["src/server/Studio/EditorEntities.lua"]},{"name":"Lighting","className":"ModuleScript","filePaths":["src/server/Studio/Lighting/init.lua"],"children":[{"name":"Sky","className":"ModuleScript","filePaths":["src/server/Studio/Lighting/Sky.lua"]}]},{"name":"StarterPlayer","className":"ModuleScript","filePaths":["src/server/Studio/StarterPlayer.lua"]},{"name":"Workspace","className":"ModuleScript","filePaths":["src/server/Studio/Workspace.lua"]}]}]},{"name":"StarterPlayer","className":"StarterPlayer","children":[{"name":"StarterCharacterScripts","className":"StarterCharacterScripts","children":[{"name":"Client","className":"LocalScript","filePaths":["src/client/Character/Client/init.client.lua"],"children":[{"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":"Crouch","className":"ModuleScript","filePaths":["src/client/Character/Client/Crouch.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":"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":"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":"Vignette","className":"ModuleScript","filePaths":["src/client/Player/UI/Vignette.lua"]}]}]}]}]}]}

View File

@@ -0,0 +1,15 @@
local Flashlight = {}
Flashlight.__index = Flashlight
local CharacterShared = _G.include(script, "CharacterShared")
local FlashlightRemote = CharacterShared:WaitForChild("Flashlight")
function Flashlight.constructor()
return setmetatable({}, Flashlight)
end
function Flashlight:Toggle()
FlashlightRemote:FireServer()
end
return Flashlight

View File

@@ -18,4 +18,8 @@ function HumanoidRPSettings:DisableRobloxSounds()
end end
end end
function HumanoidRPSettings:Velocity()
return self.HumanoidRootPart:GetVelocityAtPosition(self.HumanoidRootPart.Position)
end
return HumanoidRPSettings return HumanoidRPSettings

View File

@@ -21,7 +21,7 @@ type struct_Spine = {
type CharacterSharedFolder = Folder type CharacterSharedFolder = Folder
function Spine.constructor(CurrentCamera: CurrentCamera) function Spine.constructor(CurrentCamera: CurrentCamera)
local self: struct_Spine = {} local self = {} :: struct_Spine
self.Remote = CharacterShared:WaitForChild("SpineStream") self.Remote = CharacterShared:WaitForChild("SpineStream")
self.CurrentCamera = CurrentCamera self.CurrentCamera = CurrentCamera
return setmetatable(self, Spine) return setmetatable(self, Spine)

View File

@@ -1,10 +1,10 @@
local Character = script.Parent local Character = script.Parent.Parent
local preprocessor = {} local preprocessor = {}
type CharacterSharedFolder = Folder type CharacterSharedFolder = Folder
function preprocessor.CharacterShared(): CharacterSharedFolder function preprocessor.CharacterShared(): CharacterSharedFolder
return script.Parent:WaitForChild("shared") return Character:WaitForChild("shared")
end end
_G.include = function(this: LuaSourceContainer, FunName: string, ...) _G.include = function(this: LuaSourceContainer, FunName: string, ...)
@@ -17,6 +17,8 @@ _G.include = function(this: LuaSourceContainer, FunName: string, ...)
end end
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService") :: RunService
local ClientStorage = Storage:WaitForChild("Client") local ClientStorage = Storage:WaitForChild("Client")
local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete") local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete")
@@ -31,6 +33,7 @@ local CameraModule = require(script:WaitForChild("Camera"))
local CrouchModule = require(script:WaitForChild("Crouch")) local CrouchModule = require(script:WaitForChild("Crouch"))
local HumanoidModule = require(script:WaitForChild("Humanoid")) local HumanoidModule = require(script:WaitForChild("Humanoid"))
local SpineModule = require(script:WaitForChild("SpineKinematics")) local SpineModule = require(script:WaitForChild("SpineKinematics"))
local FlashlightModule = require(script:WaitForChild("Flashlight"))
local BindModule = require(ClientStorage:WaitForChild("KeyBinds")) local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
@@ -41,29 +44,48 @@ local HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPart, Humanoid) local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPart, Humanoid)
local HumanoidSettings = HumanoidModule.constructor(Humanoid) local HumanoidSettings = HumanoidModule.constructor(Humanoid)
local SpineMovement = SpineModule.constructor(CurrentCamera) local SpineMovement = SpineModule.constructor(CurrentCamera)
local Flashlight = FlashlightModule.constructor()
local Walking = 10/2 --10 is default local Walking = 10/2 --10 is default
local ClientBindMap = BindModule.constructor(false)
local function ClientCharacterBinds() local function ClientCharacterBinds()
local CrouchConstructor = CrouchModule.constructor(Humanoid) local CrouchConstructor = CrouchModule.constructor(Humanoid)
local BindMap = BindModule.constructor()
--Crouch --Crouch
BindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function() ClientBindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Crouch(10) CrouchConstructor:Crouch(10)
end) end)
BindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function() ClientBindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
CrouchConstructor:Stand(5) CrouchConstructor:Stand(5)
end) end)
--Walk --Walk
BindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function() ClientBindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
HumanoidSettings:SetWalkSpeed(Walking) HumanoidSettings:SetWalkSpeed(Walking)
end) end)
BindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function() ClientBindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
HumanoidSettings:SetWalkSpeed(10) HumanoidSettings:SetWalkSpeed(10)
end) end)
end end
local function Crosshair3DVelocity_Effect(): RBXScriptSignal
local RootVelocity = ClientStorage:WaitForChild("RootVelocity") :: BindableEvent
local RootVelocitySteps = RS.Heartbeat:ConnectParallel(function(_dt)
RootVelocity:Fire(HRPSettings:Velocity())
end)
return RootVelocitySteps
end
local function FlashlightToggle()
ClientBindMap:AddInputBegan({Enum.KeyCode.F}, function()
Flashlight:Toggle()
end)
end
local function HealthChangeBind()
end
HumanoidSettings:SetWalkSpeed() HumanoidSettings:SetWalkSpeed()
HumanoidSettings:SetJumpHeight() HumanoidSettings:SetJumpHeight()
HRPSettings:DisableRobloxSounds() HRPSettings:DisableRobloxSounds()
@@ -71,3 +93,5 @@ CameraConsturctor:EnableBobbing()
SpineMovement:Enable() SpineMovement:Enable()
ClientCharacterBinds() ClientCharacterBinds()
Crosshair3DVelocity_Effect()
FlashlightToggle()

View File

@@ -0,0 +1,68 @@
local Flashlight = {}
Flashlight.__index = Flashlight
local Remote = Instance.new("RemoteEvent") :: RemoteEvent
Remote.Name = "Flashlight"
Remote.Parent = _G.include(script, "CharacterShared")
function Flashlight.constructor(Head: BasePart)
local FlashlightPart = Instance.new("Part") :: Part
FlashlightPart.Size = Vector3.new(.1,.1,.1)
FlashlightPart.CFrame = Head.CFrame+Vector3.yAxis
FlashlightPart.CanCollide = false
FlashlightPart.CastShadow = false
FlashlightPart.Transparency = 1
local SpotLight = Instance.new("SpotLight") :: SpotLight
SpotLight.Color = Color3.new(1,1,1)
SpotLight.Angle = 80
SpotLight.Range = 30
SpotLight.Brightness = 1
SpotLight.Shadows = true
SpotLight.Enabled = false
SpotLight.Parent = FlashlightPart
local Weld = Instance.new("WeldConstraint") :: WeldConstraint
Weld.Part0 = Head
Weld.Part1 = FlashlightPart
Weld.Parent = FlashlightPart
FlashlightPart.Anchored = false
FlashlightPart.Parent = Head
local ToggleSound = Instance.new("Sound") :: Sound
ToggleSound.SoundId = "rbxassetid://16454678462"
ToggleSound.Volume = .5
ToggleSound.Parent = Head
return setmetatable({
SpotLight = SpotLight,
ToggleSound = ToggleSound,
Remote = Remote
}, Flashlight)
end
local FlashlightEnabled = false
function Flashlight:On()
FlashlightEnabled = true
self.ToggleSound:Play()
self.SpotLight.Enabled = FlashlightEnabled
end
function Flashlight:Off()
FlashlightEnabled = false
self.ToggleSound:Play()
self.SpotLight.Enabled = FlashlightEnabled
end
function Flashlight:Toggle()
-- FlashlightEnabled = not FlashlightEnabled
if FlashlightEnabled then
self:Off()
else
self:On()
end
end
return Flashlight

View File

@@ -25,7 +25,7 @@ Remote.Name = "SpineStream"
Remote.Parent = _G.include(script, "CharacterShared") Remote.Parent = _G.include(script, "CharacterShared")
function Spine.constructor(Head: Head, UpperTorso: UpperTorso) function Spine.constructor(Head: Head, UpperTorso: UpperTorso)
local self: struct_Spine = {} local self = {} :: struct_Spine
self.Head = Head self.Head = Head
self.UpperTorso = UpperTorso self.UpperTorso = UpperTorso
self.Neck = Head:WaitForChild("Neck") self.Neck = Head:WaitForChild("Neck")

View File

@@ -1,4 +1,4 @@
local Character = script.Parent local Character = script.Parent.Parent
local preprocessor = {} local preprocessor = {}
--Create the character shared directory here --Create the character shared directory here
@@ -12,7 +12,7 @@ function preprocessor.CharacterShared(): CharacterSharedFolder
end end
_G.include = function(this: LuaSourceContainer, FunName: string, ...) _G.include = function(this: LuaSourceContainer, FunName: string, ...)
--its not extremely necessary to have security for the server-side --its not extremely necessary to have this security on the server-side
if this:IsDescendantOf(script) then --getfenv is being removed if this:IsDescendantOf(script) then --getfenv is being removed
local switch = preprocessor[FunName] local switch = preprocessor[FunName]
return type(switch) == "function" and switch(...) or switch return type(switch) == "function" and switch(...) or switch
@@ -25,6 +25,7 @@ local Players = game:GetService("Players")
local Shadows = require(script:WaitForChild("Shadows")) local Shadows = require(script:WaitForChild("Shadows"))
local SpineModule = require(script:WaitForChild("SpineKinematics")) local SpineModule = require(script:WaitForChild("SpineKinematics"))
local FlashlightModule = require(script:WaitForChild("Flashlight"))
local Head = Character:WaitForChild("Head") local Head = Character:WaitForChild("Head")
local UpperTorso = Character:WaitForChild("UpperTorso") local UpperTorso = Character:WaitForChild("UpperTorso")
@@ -33,6 +34,7 @@ local LocalPlayer = Players:GetPlayerFromCharacter(Character)
local CharacterShadows = Shadows.constructor(Character) local CharacterShadows = Shadows.constructor(Character)
local Spine = SpineModule.constructor(Head, UpperTorso) local Spine = SpineModule.constructor(Head, UpperTorso)
local Flashlight = FlashlightModule.constructor(Head)
CharacterShadows:off() --I plan having 2 player support and characters block a ton of light CharacterShadows:off() --I plan having 2 player support and characters block a ton of light
@@ -41,12 +43,27 @@ Character.DescendantAdded:Connect(function(Instance)
CharacterShadows:PartToggle(Instance, false) CharacterShadows:PartToggle(Instance, false)
end) end)
Spine.Remote.OnServerEvent:Connect(function(Messenger: Player, CameraPosition: Vector3, IsFirstPerson: boolean) Spine.Remote.OnServerEvent:Connect(function(Messenger: Player, CameraPosition: CFrame, IsFirstPerson: boolean)
if Messenger.UserId == LocalPlayer.UserId then if Messenger.UserId == LocalPlayer.UserId then
if Spine.Enabled then if Spine.Enabled then
Spine:Move(CameraPosition, IsFirstPerson) Spine:Move(CameraPosition, IsFirstPerson)
end
else else
warn("hacker") --reset
print("TODO reached -", script.Name..".lua")
end
end
end)
local FlashlightDebounce = false
Flashlight.Remote.OnServerEvent:Connect(function(Messenger: Player)
if Messenger.UserId == LocalPlayer.UserId then
if not FlashlightDebounce then
Flashlight:Toggle()
FlashlightDebounce = true
task.wait(.10)
FlashlightDebounce = false
end
end end
end) end)

View File

@@ -3,6 +3,9 @@ local CrosshairModule = {
} }
CrosshairModule.__index = CrosshairModule CrosshairModule.__index = CrosshairModule
local Storage = game:GetService("ReplicatedStorage")
local Easings = require(Storage:WaitForChild("AlgebraEasings"))
--Use a custom crosshair so we can do effects to it --Use a custom crosshair so we can do effects to it
type rbxassetid = string type rbxassetid = string
@@ -17,15 +20,24 @@ function CrosshairModule.constructor(PlayerGui: PlayerGui)
end end
function CrosshairModule:Enable() function CrosshairModule:Enable()
self.Screen.Enabled = true (self.Screen :: ScreenGui).Enabled = true
end end
function CrosshairModule:Disable() function CrosshairModule:Disable()
self.Screen.Enabled = false (self.Screen :: ScreenGui).Enabled = false
end end
function CrosshairModule:Change(ID: rbxassetid) function CrosshairModule:Change(ID: rbxassetid)
self.Icon.Image = ID or CrosshairModule.Icon (self.Icon :: ImageLabel).Image = ID or CrosshairModule.Icon
end
function CrosshairModule:Jump(RootVelocity: Vector3)
local X, Y = RootVelocity.X, RootVelocity.Y;
(self.Icon :: ImageLabel).Position = UDim2.fromScale(
Y>1 and Easings.Linear(.5,.5+(X/1000),.3) or .5,
math.clamp(.4, .5-(-Y/1000), .6)
)
end end
return CrosshairModule return CrosshairModule

View File

@@ -0,0 +1,34 @@
local HealthModule = {}
HealthModule.__index = HealthModule
function HealthModule.constructor(PlayerGui: PlayerGui)
local HealthGui = PlayerGui:WaitForChild("Health")
local Amount = HealthGui:WaitForChild("Amount")
return setmetatable({
HealthGui = HealthGui,
Amount = Amount
}, HealthGui)
end
function HealthModule:Enable()
HealthModule.Enabled = true
end
function HealthModule:Disable()
HealthModule.Enabled = false
end
function HealthModule:DisplayHealth(Amount: number)
self.Amount.Text = tostring(Amount)
if Amount <= 40 then
self.Amount.TextColor3 = Color3.fromRGB(255,238,0)
elseif Amount <= 20 then
self.Amount.TextColor3 = Color3.fromRGB(255,0,38)
else
self.Amount.TextColor3 = Color3.new(1,1,1)
end
end
return HealthModule

View File

@@ -1,11 +1,13 @@
local UI = script:WaitForChild("UI") local UI = script:WaitForChild("UI")
local CrosshairSettings = require(UI:WaitForChild("Crosshair")) local CrosshairSettings = require(UI:WaitForChild("Crosshair"))
local VignetteSettings = require(UI:WaitForChild("Vignette")) local VignetteSettings = require(UI:WaitForChild("Vignette"))
local HealthSettings = require(UI:WaitForChild("Health"))
local CoreGuis = require(script:WaitForChild("CoreGuis")) local CoreGuis = require(script:WaitForChild("CoreGuis"))
local Mouse = require(script:WaitForChild("Mouse")) local Mouse = require(script:WaitForChild("Mouse"))
local Players = game:GetService("Players") local Players = game:GetService("Players")
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService") :: RunService
local ClientStorage = Storage:WaitForChild("Client") local ClientStorage = Storage:WaitForChild("Client")
local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete") local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete")
@@ -33,7 +35,7 @@ local Crosshair = CrosshairSettings.constructor(PlayerGui)
--Keybinds --Keybinds
local function CameraBinds() local function CameraBinds()
local CameraBindMap = KeyBindsModule.constructor() local CameraBindMap = KeyBindsModule.constructor(false)
CameraBindMap:AddInputBegan({Enum.KeyCode.C, Enum.KeyCode.Z}, function() CameraBindMap:AddInputBegan({Enum.KeyCode.C, Enum.KeyCode.Z}, function()
Camera:ZoomIn(Vignette, Crosshair) Camera:ZoomIn(Vignette, Crosshair)
@@ -43,9 +45,21 @@ local function CameraBinds()
end) end)
end end
local function Crosshair3DEffect()
local RootVelocity = Instance.new("BindableEvent") :: BindableEvent
RootVelocity.Name = "RootVelocity"
RootVelocity.Parent = ClientStorage
RootVelocity.Event:Connect(function(RootVelocity: Vector3)
Crosshair:Jump(RootVelocity)
end)
end
CoreGuis:Off() CoreGuis:Off()
Camera:FirstPerson() Camera:FirstPerson()
Mouse:DisablePointer() Mouse:DisablePointer()
Crosshair:Enable() Crosshair:Enable()
HealthSettings:Enable()
CameraBinds() CameraBinds()
Crosshair3DEffect()

View File

@@ -7,7 +7,7 @@ local Storage = game:GetService("ReplicatedStorage")
local LoadingFun = true local LoadingFun = true
local function GuiDependencies(IntroGui: ScreenGui): typeof(GuiDependencies) local function GuiDependencies(IntroGui: ScreenGui)
IntroGui.Enabled = true IntroGui.Enabled = true
local Frame = IntroGui:WaitForChild("Frame") local Frame = IntroGui:WaitForChild("Frame")
@@ -86,11 +86,10 @@ local function GUI_LoadFinish(Stepped: Stepped, Gui: GUIs) --We can now access t
Gui.IntroGui:Destroy() --We dont need the intro gui anymore Gui.IntroGui:Destroy() --We dont need the intro gui anymore
end end
type GL_Cube = BasePart type GL_Cube = Instance
type GL_Side = BasePart type GL_Side = Instance
type LoadFinishedSignal = RBXScriptSignal
return function(IntroGui: ScreenGui, load_elapse_start: number): LoadFinishedSignal return function(IntroGui: ScreenGui, load_elapse_start: number)
local Gui = GuiDependencies(IntroGui) local Gui = GuiDependencies(IntroGui)
Gui.ViewportCamera.CFrame = CFrame.lookAt(Gui.GL_Cube.Position-Vector3.new(3,-2.5,5), Gui.GL_Cube.Position) Gui.ViewportCamera.CFrame = CFrame.lookAt(Gui.GL_Cube.Position-Vector3.new(3,-2.5,5), Gui.GL_Cube.Position)
@@ -114,7 +113,6 @@ return function(IntroGui: ScreenGui, load_elapse_start: number): LoadFinishedSig
if LoadingFun then if LoadingFun then
task.wait(math.max(0, 3-load_elapse)) --Only if you take longer than or exactly 3 seconds to load task.wait(math.max(0, 3-load_elapse)) --Only if you take longer than or exactly 3 seconds to load
end end
print(load_elapse) print(load_elapse)
GUI_LoadFinish(Stepped, Gui) GUI_LoadFinish(Stepped, Gui)
end) end)

View File

@@ -28,13 +28,13 @@ local function LoadingIntroGUI()
end end
local PlayerGui = Player:WaitForChild("PlayerGui") local PlayerGui = Player:WaitForChild("PlayerGui")
IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 10) IntroGui = PlayerGui:WaitForChild("rhpidframework_intro", 30)
if IntroGui then if IntroGui then
--Let the magic begin --Let the magic begin
RunIntroGui(IntroGui, load_elapse_start) RunIntroGui(IntroGui, load_elapse_start)
else else
warn("Waited 10 seconds for the intro gui without success") warn("Waited 30 seconds for the intro gui without success")
end end
end end

View File

@@ -2,17 +2,31 @@ local Floors = {}
Floors.__index = Floors Floors.__index = Floors
local Storage = game:GetService("ReplicatedStorage") local Storage = game:GetService("ReplicatedStorage")
local CS = game:GetService("CollectionService")
local Tags = require(Storage:WaitForChild("Tags")) local Tags = require(Storage:WaitForChild("Tags"))
function Floors.constructor(NumberOfFloors: number) function Floors.constructor(NumberOfFloors: number, Year: string)
return setmetatable({NumberOfFloors = NumberOfFloors}, Floors) local Floors = {}
for i: number = 1, NumberOfFloors do
local FloorTag_1 = CS:GetTagged(`ElevatorDoor_{Year}_Floor{tostring(i)}_1`)
local FloorTag_2 = CS:GetTagged(`ElevatorDoor_{Year}_Floor{tostring(i)}_2`)
if FloorTag_1 then
table.insert(Floors, FloorTag_1)
end
if FloorTag_2 then
table.insert(Floors, FloorTag_2)
end
end
return setmetatable({
NumberOfFloors = NumberOfFloors,
Floors = Floors
}, Floors)
end end
--NumberOfFloors syntax: ElevatorDoor_(year)_Floor(floors amount)_1/2 function Floors:GetFloor(Floor: number): Instance?
function Floors:GetFloors(Year: string)
for i: number = 1, self.NumberOfFloors do
end
end end
return Floors return Floors

View File

@@ -18,10 +18,11 @@ local Tags = require(Storage:WaitForChild("Tags"))
local Floor10_Door1 = Tags.ElevatorDoor_1960_Floor10_1 local Floor10_Door1 = Tags.ElevatorDoor_1960_Floor10_1
local Floor10_Door2 = Tags.ElevatorDoor_1960_Floor10_2 local Floor10_Door2 = Tags.ElevatorDoor_1960_Floor10_2
type DoorSensors = {
[string]: Instance
}
function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder) function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, ElevatorDoor2: BasePart, ElevatorDoorSensor: Folder)
type DoorSensors = {
[string]: BasePart
}
local DoorTween1 = Tween.constructor(nil, ElevatorDoor1) local DoorTween1 = Tween.constructor(nil, ElevatorDoor1)
local DoorTween2 = Tween.constructor(nil, ElevatorDoor2) local DoorTween2 = Tween.constructor(nil, ElevatorDoor2)
local DoorSensor: DoorSensors = { local DoorSensor: DoorSensors = {
@@ -29,7 +30,7 @@ function Doors.constructor(ElevatorBox: BasePart, ElevatorDoor1: BasePart, Eleva
End = ElevatorDoorSensor:WaitForChild("End") End = ElevatorDoorSensor:WaitForChild("End")
} }
local DoorClosingClick = Instance.new("Sound") local DoorClosingClick = Instance.new("Sound") :: Sound
DoorClosingClick.SoundId = "rbxassetid://16357740945" DoorClosingClick.SoundId = "rbxassetid://16357740945"
DoorClosingClick.Volume = .1 DoorClosingClick.Volume = .1
DoorClosingClick.Parent = ElevatorDoor2 DoorClosingClick.Parent = ElevatorDoor2
@@ -66,10 +67,10 @@ local function DoorsAnimationFloor(floor: number, opening: boolean?, activated_v
activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle, activated_via_censor and Enum.EasingStyle.Linear or Doors.ElevatorDoorStyle,
Enum.EasingDirection.InOut Enum.EasingDirection.InOut
), Floor10_Door2) ), Floor10_Door2)
local Door1Tween_Floor: Tween = Floor10_Door1:Start(nil, { local Door1Tween_Floor: Tween = DoorTween1:Start(nil, {
Position = opening and init_closed_door1 or init_opened_door1 Position = opening and init_closed_door1 or init_opened_door1
}) })
local Door2Tween_Floor: Tween = Floor10_Door2:Start(nil, { local Door2Tween_Floor: Tween = DoorTween2:Start(nil, {
Position = opening and init_closed_door1 or init_opened_door1 Position = opening and init_closed_door1 or init_opened_door1
}) })
@@ -79,8 +80,8 @@ end
local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boolean?) local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boolean?)
self.ElevatorBox.Anchored = true self.ElevatorBox.Anchored = true
local ElevatorDoor1_P = self.ElevatorDoor1.Position local ElevatorDoor1_P: Vector3 = self.ElevatorDoor1.Position
local ElevatorDoor2_P = self.ElevatorDoor2.Position local ElevatorDoor2_P: Vector3 = self.ElevatorDoor2.Position
local TweenTime = activated_via_censor and sensor_opening_speed or opening and opening_speed or Doors.ElevatorDoorTime local TweenTime = activated_via_censor and sensor_opening_speed or opening and opening_speed or Doors.ElevatorDoorTime
@@ -115,7 +116,7 @@ local function DoorsAnimation(self, opening: boolean?, activated_via_censor: boo
--Door clicking noise --Door clicking noise
task.delay(Doors.ElevatorDoorTime-.90, function() task.delay(Doors.ElevatorDoorTime-.90, function()
--is the door close enough to closing? --is the door close enough to closing?
if init_closed_door2.X-self.ElevatorDoor2.Position.X>5 then if (init_closed_door2 :: Vector3).X-self.ElevatorDoor2.Position.X>5 then
self.DoorClosingClick:Play() self.DoorClosingClick:Play()
end end
end) end)
@@ -140,12 +141,15 @@ for n: number = 1, #workspace_items do
end end
end end
function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal? type this = any --yeah,
local Step = nil type PossibleStepConnection = any
function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal
local Step: PossibleStepConnection = nil
if Doors.Sensors and Doors.Closed then if Doors.Sensors and Doors.Closed then
raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)} raycastParams.FilterDescendantsInstances = {self.ElevatorBox, table.unpack(RayIgnoring)}
Step = RS.Stepped:Connect(function(_delta, _dt) Step = (RS :: RunService).Stepped:Connect(function(_delta, _dt)
local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams) local DoorSensor = workspace:Raycast(self.DoorSensor.Start.Position, self.DoorSensor.End.Position, raycastParams)
if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then if DoorSensor and DoorSensor.Instance and DoorSensor.Instance:IsA("BasePart") then
@@ -153,7 +157,7 @@ function Doors:DetectSensorHit(DoorTween1, DoorTween2): RBXScriptSignal?
DoorTween1:Pause() DoorTween1:Pause()
DoorTween2:Pause() DoorTween2:Pause()
task.wait(1) --elevators irl have this delay task.wait(1) --elevators irl have this delay
DoorsAnimation(self, true, true) DoorsAnimation((self :: this), true, true)
-- DoorTween1:Destroy() -- DoorTween1:Destroy()
-- DoorTween2:Destroy() -- DoorTween2:Destroy()
end end

View File

@@ -1,23 +1,23 @@
local Elevator = script.Parent local Elevator = script.Parent
local Elevators = Elevator.Parent local Elevators = (Elevator :: Instance).Parent
local RS = game:GetService("ReplicatedStorage") local RS = game:GetService("ReplicatedStorage")
local Tags = require(RS:WaitForChild("Tags")) local Tags = require(RS:WaitForChild("Tags"))
local Leveling = require(Elevators:WaitForChild("Leveling")) local Leveling = require(Elevators:WaitForChild("Leveling"))
local Doors = require(Elevator:WaitForChild("Doors")) local Doors = require(Elevator:WaitForChild("Doors"))
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
local ElevatorBox_1960 = Tags.ElevatorMover_1960
local ElevatorBox = Tags.ElevatorMover_1960 :: BasePart
local ElevatorDoor1 = Tags.ElevatorDoor_1960_1 :: BasePart
local ElevatorDoor2 = Tags.ElevatorDoor_1960_2 :: BasePart
local ElevatorDoorSensor = Tags.ElevatorDoor_Sensor_1960 :: Folder
local ElevatorBox_1960: BasePart = Tags.ElevatorMover_1960
local ElevatorBoxStartPos = ElevatorBox_1960.Position local ElevatorBoxStartPos = ElevatorBox_1960.Position
local ElevatorMover = require(Elevators:WaitForChild("Mover"))
local _BoxAttachment, BoxAlignPosition, _BoxAlignOrientation = ElevatorMover(ElevatorBox_1960, ElevatorBoxStartPos) local _BoxAttachment, BoxAlignPosition, _BoxAlignOrientation = ElevatorMover(ElevatorBox_1960, ElevatorBoxStartPos)
local ElevatorBox: BasePart = Tags.ElevatorMover_1960
local ElevatorDoor1: BasePart = Tags.ElevatorDoor_1960_1
local ElevatorDoor2: BasePart = Tags.ElevatorDoor_1960_2
local ElevatorDoorSensor: Folder = Tags.ElevatorDoor_Sensor_1960
local ElevatorDoors = Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor) local ElevatorDoors = Doors.constructor(ElevatorBox, ElevatorDoor1, ElevatorDoor2, ElevatorDoorSensor)
local function MoveFloors(level: number) local function MoveFloors(level: number)
@@ -33,6 +33,8 @@ local function GoTo_Level(requested_level: number)
end end
end end
print("[DEBUG]: Tags:",Tags)
-- while true do -- while true do
-- task.wait(2) -- task.wait(2)
-- ElevatorDoors:Opening(true) -- ElevatorDoors:Opening(true)

View File

@@ -1,3 +1,3 @@
return function() return function()
workspace.Gravity = 150 workspace.Gravity = 50
end end

View File

@@ -1,14 +1,15 @@
--My versions --My versions
type EaseFunction = (n: number) -> number type EaseFunction = (n: number) -> number
type LinearFunction = (a: number, b: number, t: number) -> number
export type EasingStyles = { export type EasingStyles = {
Linear: EaseFunction, Linear: LinearFunction,
InOutBack: EaseFunction, InOutBack: EaseFunction,
OutBounce: EaseFunction OutBounce: EaseFunction
} }
local Ease: EasingStyles = {} local Ease = {} :: EasingStyles
--Google straight up gives wrong/bad math --Google straight up gives wrong/bad math
function Ease.Linear(a,b,t) function Ease.Linear(a,b,t)

View File

@@ -15,14 +15,14 @@ export type InputEnded = RBXScriptConnection
type CallbackFunction = () -> () type CallbackFunction = () -> ()
function BindLink.constructor() --Allow multiple bindings of the same keys, no overwrites function BindLink.constructor(gameProcessing: boolean) --Allow multiple bindings of the same keys, no overwrites
type BindConstructor = { type BindConstructor = {
BindMap: KeyBindMap, BindMap: KeyBindMap,
InputBegan: InputBegan, InputBegan: InputBegan,
InputEnded: InputEnded InputEnded: InputEnded
} }
local self: BindConstructor = {} local self = {} :: BindConstructor
self.BindMap = { self.BindMap = {
Began = {}, Began = {},
Ended = {} Ended = {}
@@ -30,7 +30,7 @@ function BindLink.constructor() --Allow multiple bindings of the same keys, no o
--Return these for convenience --Return these for convenience
self.InputBegan = UIS.InputBegan:Connect(function(input, gameProcessedEvent) self.InputBegan = UIS.InputBegan:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then if gameProcessing and gameProcessedEvent or not gameProcessedEvent then
local switch = self.BindMap.Began[input.KeyCode] local switch = self.BindMap.Began[input.KeyCode]
if switch then if switch then
switch() switch()
@@ -40,7 +40,7 @@ function BindLink.constructor() --Allow multiple bindings of the same keys, no o
end end
end) end)
self.InputEnded = UIS.InputEnded:Connect(function(input, gameProcessedEvent) self.InputEnded = UIS.InputEnded:Connect(function(input, gameProcessedEvent)
if not gameProcessedEvent then if gameProcessing and gameProcessedEvent or not gameProcessedEvent then
local switch = self.BindMap.Ended[input.KeyCode] local switch = self.BindMap.Ended[input.KeyCode]
if switch then if switch then
switch() switch()

View File

@@ -1,6 +1,6 @@
local CS = game:GetService("CollectionService") local CS = game:GetService("CollectionService")
local exports: {[string]: BasePart} = {} local exports: {[string]: Instance} = {}
local AllTags = CS:GetAllTags() local AllTags = CS:GetAllTags()
for i = 1, #AllTags do for i = 1, #AllTags do