From 222fe216ffd92950b3ac3a29e2ee5f1001b07a17 Mon Sep 17 00:00:00 2001 From: LostTrackpad Date: Tue, 18 Jun 2024 20:56:35 +0700 Subject: [PATCH] Properly rework kickglitch for fucking real --- .../gamemodes/beatrun/gamemode/sh/Melee.lua | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua index e304939..44d2e37 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua @@ -280,6 +280,9 @@ hook.Add("SetupMove", "Melee", function(ply, mv, cmd) mv:SetVelocity(vel) elseif kickglitch:GetBool() and not old_kickglitch:GetBool() then if SERVER then + local oldfriction = ply:GetFriction() + ply:SetFriction(0) + local platform = ents.Create("prop_physics") local pos = ply:GetPos() @@ -294,7 +297,12 @@ hook.Add("SetupMove", "Melee", function(ply, mv, cmd) local phys = platform:GetPhysicsObject() phys:EnableMotion(false) - timer.Simple(0.3, function() SafeRemoveEntity(platform) end) + ply:SetNWBool("KickglitchWindowActive", true) + timer.Simple(0.3, function() + ply:SetNWBool("KickglitchWindowActive", false) + ply:SetFriction(oldfriction) + SafeRemoveEntity(platform) + end) end ParkourEvent("jumpslow", ply) @@ -313,4 +321,48 @@ hook.Add("SetupMove", "Melee", function(ply, mv, cmd) if ply:GetMeleeTime() ~= 0 then MeleeThink(ply, mv, cmd) end -end) \ No newline at end of file +end) + +--hook.Add("Finishmove", "ProperKickglitch", function(ply, mv, cmd) +-- if !kickglitchwindow then return end +-- +-- if mv:KeyDown(IN_JUMP) then +-- print("dis shit got called") +-- local speedboost = ply:EyeAngles():Forward() * (32 * 0.06858125) +-- +-- local vel = mv:GetVelocity() +-- vel.z = 300 +-- mv:SetVelocity(vel + speedboost) +-- end +--end) + +hook.Add("KeyPress", "KickglitchFR", function(ply, key) + --if !kickglitchwindow then return end + if key == IN_JUMP and ply:GetNWBool("KickglitchWindowActive", false) and !GetConVar("Beatrun_OldKickGlitch"):GetBool() then + hook.Add("FinishMove", "KickglitchApply", function(ply,mv,cmd) + if !ply:Alive() then + else + local forward = ply:EyeAngles() + forward.y, forward.r = math.Round(forward.y), math.Round(forward.r) -- Prediction is better if math.Round is used on angles + forward.p = 0 + forward = forward:Forward() + local speedboost = forward * (4 / 0.06858125) + --print(speedboost) + + --print("--") + + --print(mv:GetVelocity()) + local vel = mv:GetVelocity() + vel = vel + speedboost + --print("--") + --print(vel) + vel.z = 300 + mv:SetVelocity(vel) + end + hook.Remove("FinishMove", "KickglitchApply") + end) + ply:SetNWBool("KickglitchWindowActive", false) + end +end) + +hook.Remove("SetupMove", "ProperKickglitch") \ No newline at end of file