Add extended long jump timing (optional)

This commit is contained in:
LostTrackpad 2024-06-15 16:56:40 +07:00
parent 3907207dc9
commit 9be0ee2c6b
2 changed files with 38 additions and 7 deletions

View file

@ -223,7 +223,8 @@ function SWEP:Think()
local eyeang = ply:EyeAngles() local eyeang = ply:EyeAngles()
eyeang.x = 0 eyeang.x = 0
if insidestep and viewmodel:GetCycle() <= 0.1 and GetConVar("Beatrun_QuakeJump"):GetBool() then if insidestep and GetConVar("Beatrun_QuakeJump"):GetBool() then
if (!GetConVar("Beatrun_QuakeJump_Timing"):GetBool() and viewmodel:GetCycle() <= 0.1) or ply:GetNWBool("Beatrun_ExtraQuakeJumpTiming") then
if SERVER then if SERVER then
ply:EmitSound("quakejump.mp3", 100, 100, 0.2) ply:EmitSound("quakejump.mp3", 100, 100, 0.2)
end end
@ -232,6 +233,7 @@ function SWEP:Think()
self:SetQuakeJumping(true) self:SetQuakeJumping(true)
end end
end
if not ismoving and not ply:Crouching() then if not ismoving and not ply:Crouching() then
ParkourEvent("jumpstill", ply) ParkourEvent("jumpstill", ply)

View file

@ -1,6 +1,8 @@
local quakejump = CreateConVar("Beatrun_QuakeJump", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) local quakejump = CreateConVar("Beatrun_QuakeJump", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
local sidestep = CreateConVar("Beatrun_SideStep", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) local sidestep = CreateConVar("Beatrun_SideStep", 1, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
local speed_limit = CreateConVar("Beatrun_SpeedLimit", 325, {FCVAR_REPLICATED, FCVAR_ARCHIVE}) local speed_limit = CreateConVar("Beatrun_SpeedLimit", 325, {FCVAR_REPLICATED, FCVAR_ARCHIVE})
beatrunquakejumptiming = CreateConVar("Beatrun_QuakeJump_Timing", 0, {FCVAR_REPLICATED, FCVAR_ARCHIVE}, "Quakejump extra timing window in engine ticks (default 66).")
-- This NEEDS to be accessible from runnerhands' code.
local function Hardland(jt) local function Hardland(jt)
local ply = LocalPlayer() local ply = LocalPlayer()
@ -309,6 +311,14 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
activewep:SetSideStep(true) activewep:SetSideStep(true)
mv:SetVelocity(cmd:GetViewAngles():Right() * -(speed_limit:GetInt() * 1.8)) mv:SetVelocity(cmd:GetViewAngles():Right() * -(speed_limit:GetInt() * 1.8))
if beatrunquakejumptiming:GetInt() != 0 then
ply:SetNWBool("Beatrun_ExtraQuakeJumpTiming", true)
ply:SetFriction(ply:GetFriction() * 0.01)
timer.Simple((engine.TickInterval() * beatrunquakejumptiming:GetInt()), function()
ply:SetFriction(ply:GetFriction() / 0.01)
ply:SetNWBool("Beatrun_ExtraQuakeJumpTiming", false)
end)
end
ply:ViewPunch(Angle(-3, 0, -4.5)) ply:ViewPunch(Angle(-3, 0, -4.5))
@ -324,6 +334,14 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
activewep:SetSideStep(true) activewep:SetSideStep(true)
mv:SetVelocity(cmd:GetViewAngles():Right() * (speed_limit:GetInt() * 1.8)) mv:SetVelocity(cmd:GetViewAngles():Right() * (speed_limit:GetInt() * 1.8))
if beatrunquakejumptiming:GetInt() != 0 then
ply:SetNWBool("Beatrun_ExtraQuakeJumpTiming", true)
ply:SetFriction(ply:GetFriction() * 0.01)
timer.Simple((engine.TickInterval() * beatrunquakejumptiming:GetInt()), function()
ply:SetFriction(ply:GetFriction() / 0.01)
ply:SetNWBool("Beatrun_ExtraQuakeJumpTiming", false)
end)
end
ply:ViewPunch(Angle(-3, 0, 4.5)) ply:ViewPunch(Angle(-3, 0, 4.5))
@ -425,3 +443,14 @@ if CLIENT then
LocalPlayer():CLViewPunch(Angle(1.5, -0.75, 0)) LocalPlayer():CLViewPunch(Angle(1.5, -0.75, 0))
end) end)
end end
if SERVER then
concommand.Add(
"Beatrun_ResetFriction",
function()
for _, ply in ipairs(player.GetAll()) do
ply:SetFriction(1)
end
end
)
end