Actor support 2 and inheritance

This commit is contained in:
2024-02-21 21:07:46 -05:00
parent e5f1a546b1
commit 92743349e5
5 changed files with 29 additions and 6 deletions

View File

@@ -13,7 +13,7 @@
}, },
"StarterPlayer": { "StarterPlayer": {
"StarterPlayerScripts": { "StarterPlayerScripts": {
"PlayerRoot -rapid": { "rapid-PlayerRoot": {
"$className": "Actor", "$className": "Actor",
"Player": { "Player": {
"$path": "src/client/Player" "$path": "src/client/Player"
@@ -21,7 +21,7 @@
} }
}, },
"StarterCharacterScripts": { "StarterCharacterScripts": {
"CharacterRoot -rapid": { "rapid-CharacterRoot": {
"$className": "Actor", "$className": "Actor",
"$path": "src/client/Character" "$path": "src/client/Character"
} }

View File

@@ -1,4 +1,5 @@
local CrouchModule = { local CrouchModule = {
IsCrouching = false,
StandHeight = 2.1, StandHeight = 2.1,
CrouchHeight = .6, CrouchHeight = .6,
WalkSpeedMultiplier = 6, WalkSpeedMultiplier = 6,
@@ -23,6 +24,7 @@ function CrouchModule:Crouch(StandingWalkSpeed: number)
HipHeight = CrouchModule.CrouchHeight, HipHeight = CrouchModule.CrouchHeight,
WalkSpeed = math.max(1, StandingWalkSpeed-CrouchModule.WalkSpeedMultiplier) WalkSpeed = math.max(1, StandingWalkSpeed-CrouchModule.WalkSpeedMultiplier)
}, Easing) }, Easing)
CrouchModule.IsCrouching = true
end end
function CrouchModule:Stand(CrouchingWalkSpeed: number) function CrouchModule:Stand(CrouchingWalkSpeed: number)
@@ -32,6 +34,7 @@ function CrouchModule:Stand(CrouchingWalkSpeed: number)
HipHeight = CrouchModule.StandHeight, HipHeight = CrouchModule.StandHeight,
WalkSpeed = math.max(1, CrouchingWalkSpeed+CrouchModule.WalkSpeedMultiplier) WalkSpeed = math.max(1, CrouchingWalkSpeed+CrouchModule.WalkSpeedMultiplier)
}, Easing) }, Easing)
CrouchModule.IsCrouching = false
end end
return CrouchModule return CrouchModule

View File

@@ -0,0 +1,23 @@
local Sneak = {
IsSneaking = false,
Walk = 10,
Sneaking = 10/2 --10 is default
}
Sneak.__index = Sneak
function Sneak.constructor(HumanoidSettingsInherent, Humanoid: Humanoid)
return setmetatable({
Humanoid = Humanoid,
HumanoidSettingsInherent = HumanoidSettingsInherent
}, Sneak)
end
function Sneak:Enable()
self.HumanoidSettingsInherent:SetWalkSpeed(Sneak.Sneaking)
end
function Sneak:Disable()
self.HumanoidSettingsInherent:SetWalkSpeed(Sneak.Walk)
end
return Sneak

View File

@@ -32,9 +32,7 @@ function Spine:Enable()
task.spawn(function() task.spawn(function()
while Spine.Running do while Spine.Running do
local IsFirstPerson = Player.CameraMode == Enum.CameraMode.LockFirstPerson self.Remote:FireServer(self.CurrentCamera.CFrame, Player.CameraMode == Enum.CameraMode.LockFirstPerson)
self.Remote:FireServer(self.CurrentCamera.CFrame, IsFirstPerson)
Delta:time() Delta:time()
end end
end) end)

View File

@@ -46,7 +46,6 @@ local HumanoidSettings = HumanoidModule.constructor(Humanoid)
local SpineMovement = SpineModule.constructor(CurrentCamera) local SpineMovement = SpineModule.constructor(CurrentCamera)
local Flashlight = FlashlightModule.constructor() local Flashlight = FlashlightModule.constructor()
local Walking = 10/2 --10 is default
local ClientBindMap = BindModule.constructor(false) local ClientBindMap = BindModule.constructor(false)
local function ClientCharacterBinds() local function ClientCharacterBinds()