From 24aa6bdc6ba0b926339296f77195e30db04cbb5c Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 30 Sep 2018 21:06:52 +1000 Subject: [PATCH] If arc's beam direction is the same as shot direction, snap it, reduces bandwidth usage when standing still --- qcsrc/common/weapons/weapon/arc.qc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index e78e10a36..c9d12fa67 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -322,7 +322,10 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), min(WEP_CVAR(arc, beam_maxangle) / angle, 1) ); - this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); + if(vdist(this.beam_dir - w_shotdir, <, 0.01)) + this.beam_dir = w_shotdir; + else + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } else { @@ -332,7 +335,10 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), 1 ); - this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); + if(vdist(this.beam_dir - w_shotdir, <, 0.01)) + this.beam_dir = w_shotdir; + else + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } // network information: beam direction -- 2.39.2