mirror of
https://github.com/unixtensor/Roblox-Elevator-Game.git
synced 2025-12-15 22:01:54 +00:00
Actor support
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
local Character = script.Parent
|
||||
local Character = script.Parent.Parent
|
||||
local preprocessor = {}
|
||||
|
||||
type CharacterSharedFolder = Folder
|
||||
|
||||
function preprocessor.CharacterShared(): CharacterSharedFolder
|
||||
return script.Parent:WaitForChild("shared")
|
||||
return Character:WaitForChild("shared")
|
||||
end
|
||||
|
||||
_G.include = function(this: LuaSourceContainer, FunName: string, ...)
|
||||
@@ -17,6 +17,8 @@ _G.include = function(this: LuaSourceContainer, FunName: string, ...)
|
||||
end
|
||||
|
||||
local Storage = game:GetService("ReplicatedStorage")
|
||||
local RS = game:GetService("RunService") :: RunService
|
||||
|
||||
local ClientStorage = Storage:WaitForChild("Client")
|
||||
local LoadCompleted = ClientStorage:WaitForChild("LoadingComplete")
|
||||
|
||||
@@ -31,6 +33,7 @@ local CameraModule = require(script:WaitForChild("Camera"))
|
||||
local CrouchModule = require(script:WaitForChild("Crouch"))
|
||||
local HumanoidModule = require(script:WaitForChild("Humanoid"))
|
||||
local SpineModule = require(script:WaitForChild("SpineKinematics"))
|
||||
local FlashlightModule = require(script:WaitForChild("Flashlight"))
|
||||
local BindModule = require(ClientStorage:WaitForChild("KeyBinds"))
|
||||
|
||||
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
|
||||
@@ -41,33 +44,54 @@ local HRPSettings = HumanoidRPSettings.constructor(HumanoidRootPart)
|
||||
local CameraConsturctor = CameraModule.constructor(CurrentCamera, HumanoidRootPart, Humanoid)
|
||||
local HumanoidSettings = HumanoidModule.constructor(Humanoid)
|
||||
local SpineMovement = SpineModule.constructor(CurrentCamera)
|
||||
local Flashlight = FlashlightModule.constructor()
|
||||
|
||||
local Walking = 10/2 --10 is default
|
||||
local ClientBindMap = BindModule.constructor(false)
|
||||
|
||||
local function ClientCharacterBinds()
|
||||
local CrouchConstructor = CrouchModule.constructor(Humanoid)
|
||||
local BindMap = BindModule.constructor()
|
||||
|
||||
--Crouch
|
||||
BindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
||||
ClientBindMap:AddInputBegan({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
||||
CrouchConstructor:Crouch(10)
|
||||
end)
|
||||
BindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
||||
ClientBindMap:AddInputEnded({Enum.KeyCode.RightControl, Enum.KeyCode.LeftControl}, function()
|
||||
CrouchConstructor:Stand(5)
|
||||
end)
|
||||
--Walk
|
||||
BindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
||||
ClientBindMap:AddInputBegan({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
||||
HumanoidSettings:SetWalkSpeed(Walking)
|
||||
end)
|
||||
BindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
||||
ClientBindMap:AddInputEnded({Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift}, function()
|
||||
HumanoidSettings:SetWalkSpeed(10)
|
||||
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:SetJumpHeight()
|
||||
HRPSettings:DisableRobloxSounds()
|
||||
CameraConsturctor:EnableBobbing()
|
||||
SpineMovement:Enable()
|
||||
|
||||
ClientCharacterBinds()
|
||||
ClientCharacterBinds()
|
||||
Crosshair3DVelocity_Effect()
|
||||
FlashlightToggle()
|
||||
Reference in New Issue
Block a user