Permalink
Browse files

TTT: Added lag compensation to the crowbar's secondary attack

This prevents the animation being played while no push occurred.
  • Loading branch information...
1 parent c928b11 commit 61108d93a638cac63ef78f6124c17eef5025f9ce @Bo98 Bo98 committed Apr 30, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 garrysmod/gamemodes/terrortown/entities/weapons/weapon_zm_improvised.lua
@@ -220,6 +220,10 @@ function SWEP:SecondaryAttack()
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextSecondaryFire( CurTime() + 0.1 )
+ if self.Owner.LagCompensation then
+ self.Owner:LagCompensation(true)
+ end
+
local tr = self.Owner:GetEyeTrace(MASK_SHOT)
if tr.Hit and IsValid(tr.Entity) and tr.Entity:IsPlayer() and (self.Owner:EyePos() - tr.HitPos):Length() < 100 then
@@ -242,6 +246,10 @@ function SWEP:SecondaryAttack()
self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay )
end
+
+ if self.Owner.LagCompensation then
+ self.Owner:LagCompensation(false)
+ end
end
function SWEP:GetClass()

0 comments on commit 61108d9

Please sign in to comment.