]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix a bug with shotgun secondary where it would give up the swing before it actually...
authorSamual <samual@xonotic.org>
Fri, 30 Sep 2011 20:00:18 +0000 (16:00 -0400)
committerSamual <samual@xonotic.org>
Fri, 30 Sep 2011 20:00:18 +0000 (16:00 -0400)
qcsrc/client/hook.qc
qcsrc/server/w_shotgun.qc

index 4971fa3aa1705a126428729db0e2804ea6a65742..e27dcaa67b671f434d71524c7852770793336ea2 100644 (file)
@@ -216,6 +216,7 @@ void Draw_GrapplingHook()
 void Remove_GrapplingHook()
 {
        sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM);
+       print("hook was removed at ", vtos(self.origin), "\n");
 }
 
 void Ent_ReadHook(float bIsNew, float type)
index f84f22e8b80a5475753603b40c8fc6a460a220d6..58ac58f080fdc1a26c987456d5b6fe5c8c067237 100644 (file)
@@ -60,11 +60,11 @@ void shotgun_meleethink (void)
        
        // calculate swing percentage based on time
        meleetime = autocvar_g_balance_shotgun_secondary_melee_time * W_WeaponRateFactor();
-       swing = bound(0, (self.cnt + meleetime - time) / meleetime, 1);
+       swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
        f = ((1 - swing) * autocvar_g_balance_shotgun_secondary_melee_traces);
        
        // check to see if we can still continue, otherwise give up now
-       if(time >= self.cnt + meleetime || (self.realowner.deadflag != DEAD_NO && autocvar_g_balance_shotgun_secondary_melee_no_doubleslap))
+       if((self.realowner.deadflag != DEAD_NO) && autocvar_g_balance_shotgun_secondary_melee_no_doubleslap)
        {
                remove(self);
                return;
@@ -122,9 +122,18 @@ void shotgun_meleethink (void)
                }
        }
        
-       // set up next frame 
-       self.swing_prev = i;
-       self.nextthink = time;
+       if(time >= self.cnt + meleetime)
+       {
+               // melee is finished
+               remove(self);
+               return;
+       }
+       else
+       {
+               // set up next frame 
+               self.swing_prev = i;
+               self.nextthink = time;
+       }
 }
 
 void W_Shotgun_Attack2 (void)