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,14 +223,16 @@ function SWEP:Think()
local eyeang = ply:EyeAngles()
eyeang.x = 0
if insidestep and viewmodel:GetCycle() <= 0.1 and GetConVar("Beatrun_QuakeJump"):GetBool() then
if SERVER then
ply:EmitSound("quakejump.mp3", 100, 100, 0.2)
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
ply:EmitSound("quakejump.mp3", 100, 100, 0.2)
end
ply.QuakeJumping = true
self:SetQuakeJumping(true)
end
ply.QuakeJumping = true
self:SetQuakeJumping(true)
end
if not ismoving and not ply:Crouching() then

View file

@ -1,6 +1,8 @@
local quakejump = CreateConVar("Beatrun_QuakeJump", 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})
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 ply = LocalPlayer()
@ -309,6 +311,14 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
activewep:SetSideStep(true)
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))
@ -324,6 +334,14 @@ hook.Add("SetupMove", "MESetupMove", function(ply, mv, cmd)
activewep:SetSideStep(true)
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))
@ -424,4 +442,15 @@ if CLIENT then
ArmInterrupt("doorbash")
LocalPlayer():CLViewPunch(Angle(1.5, -0.75, 0))
end)
end
if SERVER then
concommand.Add(
"Beatrun_ResetFriction",
function()
for _, ply in ipairs(player.GetAll()) do
ply:SetFriction(1)
end
end
)
end