]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_shotgun.qc
fix antispam of hitsounds; fix shotgun and electro refire times with weapon rate...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_shotgun.qc
index d9bb056ee6c6c8e65678509ba6c4ff1b91041411..d9d717ecdeb6d3165d2c2109d74b55917f756b19 100644 (file)
@@ -56,9 +56,12 @@ void shotgun_meleethink (void)
        vector angle;
        angle = v_forward;
 
+       float meleetime;
+       meleetime = autocvar_g_balance_shotgun_secondary_melee_time * W_WeaponRateFactor();
+
        // perform trace
        float f;
-       f = (self.cnt + autocvar_g_balance_shotgun_secondary_melee_time - time) / autocvar_g_balance_shotgun_secondary_melee_time * 2 - 1;
+       f = (self.cnt + meleetime - time) / meleetime * 2 - 1;
        vector targpos;
        targpos = self.owner.origin + self.owner.view_ofs + angle * autocvar_g_balance_shotgun_secondary_melee_range + v_right * f * autocvar_g_balance_shotgun_secondary_melee_swing + v_up * f * autocvar_g_balance_shotgun_secondary_melee_swing;
 
@@ -74,7 +77,7 @@ void shotgun_meleethink (void)
                Damage (trace_ent, self.owner, self.owner, autocvar_g_balance_shotgun_secondary_damage * min(1, f + 1), WEP_SHOTGUN | HITTYPE_SECONDARY , self.owner.origin + self.owner.view_ofs, force);
                remove(self);
        }
-       else if(time >= self.cnt + autocvar_g_balance_shotgun_secondary_melee_time) // missed, remove ent
+       else if(time >= self.cnt + meleetime) // missed, remove ent
                remove(self);
        else // continue swinging the weapon in hope of hitting someone :)
                self.nextthink = time;
@@ -100,10 +103,10 @@ void spawnfunc_weapon_shotgun(); // defined in t_items.qc
 float w_shotgun(float req)
 {
        if (req == WR_AIM)
-               if(vlen(self.origin-self.enemy.origin)>200)
-                       self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
-               else
+               if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shotgun_secondary_melee_range)
                        self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
+               else
+                       self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
        else if (req == WR_THINK)
        {
                if (self.BUTTON_ATCK)