diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 65365a0..1001aa7 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -1021,22 +1021,6 @@ end function GM:PlayerDeath(pl, attacker) end -function GM:OnPlayerHitGround(pl, inwater, hitfloater, speed) - if inwater then return true end - - if pl:Team() == TEAM_UNDEAD then - if pl:GetZombieClassTable().NoFallDamage then return true end - - speed = math.max(0, speed - 200) - end - - if pl:Team() ~= TEAM_UNDEAD or not pl:GetZombieClassTable().NoFallSlowdown then - pl:RawCapLegDamage(CurTime() + math.min(2, speed * 0.0035)) - end - - return true -end - function GM:LastHuman(pl) if not IsValid(pl) then pl = nil end @@ -1241,17 +1225,43 @@ function GM:CalcViewTaunt(pl, origin, angles, fov, zclose, zfar) end local staggerdir = VectorRand():GetNormalized() +local BHopTime = 0 +local WasPressingJump = false + +local function PressingJump(cmd) + return bit.band(cmd:GetButtons(), IN_JUMP) ~= 0 +end + +local function DontPressJump(cmd) + cmd:SetButtons(cmd:GetButtons() - IN_JUMP) +end + function GM:_CreateMove(cmd) if MySelf:IsPlayingTaunt() and MySelf:Alive() then self:CreateMoveTaunt(cmd) return end - if MySelf:GetAntiBunnyHopTime() >= 2 or MySelf:GetLegDamage() >= 0.5 then - local buttons = cmd:GetButtons() - if bit.band(buttons, IN_JUMP) ~= 0 then - cmd:SetButtons(buttons - IN_JUMP) + -- Disables bunny hopping to an extent. + if MySelf:GetLegDamage() >= 0.5 then + if PressingJump(cmd) then + DontPressJump(cmd) end + elseif MySelf:OnGround() then + if CurTime() < BHopTime then + if PressingJump(cmd) then + DontPressJump(cmd) + WasPressingJump = true + end + elseif WasPressingJump then + if PressingJump(cmd) then + DontPressJump(cmd) + else + WasPressingJump = false + end + end + else + BHopTime = CurTime() + 0.065 end if MySelf:Team() == TEAM_HUMAN then diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua index 8fbbd59..8c7d471 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua @@ -205,21 +205,6 @@ function meta:GetLegDamage() return math.max(0, self.LegDamage - CurTime()) end -function meta:AddAntiBunnyHopTime(time) - self:SetAntiBunnyHopTime(math.max(CurTime(), self.ABHT) + time) -end - -function meta:SetAntiBunnyHopTime(time) - self.ABHT = math.min(CurTime() + 4.5, time) - --[[if SERVER then - self:UpdateAntiBunnyHopTime() - end]] -end - -function meta:GetAntiBunnyHopTime() - return math.max(0, self.ABHT - CurTime()) -end - function meta:WouldDieFrom(damage, hitpos) return self:Health() <= damage * GAMEMODE:GetZombieDamageScale(hitpos, self) end diff --git a/gamemodes/zombiesurvival/gamemode/shared.lua b/gamemodes/zombiesurvival/gamemode/shared.lua index 379473f..95c51bb 100644 --- a/gamemodes/zombiesurvival/gamemode/shared.lua +++ b/gamemodes/zombiesurvival/gamemode/shared.lua @@ -391,14 +391,10 @@ function GM:OnPlayerHitGround(pl, inwater, hitfloater, speed) if isundead then if pl:GetZombieClassTable().NoFallDamage then return true end - else + elseif SERVER then pl:PreventSkyCade() end - if speed > 100 then - pl:AddAntiBunnyHopTime(1) - end - if isundead then speed = math.max(0, speed - 200) end