mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-28 12:53:02 +05:00
Properly rework kickglitch for fucking real
This commit is contained in:
parent
f61e6e344d
commit
222fe216ff
1 changed files with 54 additions and 2 deletions
|
@ -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)
|
||||
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")
|
Loading…
Reference in a new issue