]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_weaponsystem.qc
Merge remote-tracking branch 'origin/fruitiex/disable-shootanim'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_weaponsystem.qc
index 3fab35fc9e1ccd592e494150343ffe4b913a9721..4233e7d92d755b7651a60362f27080c192e888c7 100644 (file)
@@ -34,6 +34,10 @@ float W_WeaponRateFactor()
 
 void W_SwitchWeapon_Force(entity e, float w)
 {
+       // don't switch to another weapon if we're not allowed to
+       if(e.weapon_forbidchange)
+               return;
+
        e.cnt = e.switchweapon;
        e.switchweapon = w;
        e.selectweapon = w;
@@ -1253,15 +1257,21 @@ void weapon_thinkf(float fr, float t, void() func)
        self.weapon_think = func;
        //dprint("next ", ftos(self.weapon_nextthink), "\n");
 
+    // The shoot animation looks TERRIBLE without animation blending! Yay for moonwalking while shooting!
+    /*
        if (restartanim)
        if (t)
        if (!self.crouch) // shoot anim stands up, this looks bad
        {
                local vector anim;
-               anim = self.anim_shoot;
+               if(self.weapon == WEP_SHOTGUN && self.BUTTON_ATCK2)
+                       anim = self.anim_melee;
+               else
+                       anim = self.anim_shoot;
                anim_z = anim_y / (t + sys_frametime);
                setanim(self, anim, FALSE, TRUE, TRUE);
        }
+    */
 };
 
 void weapon_boblayer1(float spd, vector org)
@@ -1614,7 +1624,7 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 
 void W_DecreaseAmmo(.float ammo_type, float ammo_use, float ammo_reload)
 {
-       if(self.items & IT_UNLIMITED_WEAPON_AMMO)
+       if((self.items & IT_UNLIMITED_WEAPON_AMMO) && !ammo_reload)
                return;
 
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
@@ -1640,7 +1650,7 @@ void W_ReloadedAndReady()
        self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
 
        // if the gun uses no ammo, max out weapon load, else decrease ammo as we increase weapon load
-       if(!self.reload_ammo_min)
+       if(!self.reload_ammo_min || self.items & IT_UNLIMITED_WEAPON_AMMO)
                self.clip_load = self.reload_ammo_amount;
        else
        {
@@ -1692,6 +1702,7 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri
 
        // no ammo, so nothing to load
        if(!self.(self.current_ammo) && self.reload_ammo_min)
+       if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
                if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time)
                {
@@ -1733,4 +1744,4 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri
                self.clip_load = 0;
        self.old_clip_load = self.clip_load;
        self.clip_load = self.weapon_load[self.weapon] = -1;
-}
\ No newline at end of file
+}