]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_shotgun.qc
Move load persistence floats back to their weapon files. That should be the last...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_shotgun.qc
index 569916a298e5cf3524a76b160dbd7f0abb11ad1a..7d515ddeea28c0857dadc25b817386fc4bd62a55 100644 (file)
@@ -3,6 +3,9 @@ REGISTER_WEAPON(SHOTGUN, w_shotgun, IT_SHELLS, 2, WEP_FLAG_NORMAL | WEP_TYPE_HIT
 #else
 #ifdef SVQC
 
+// weapon load persistence, for weapons that support reloading
+.float shotgun_load;
+
 void W_Shotgun_SetAmmoCounter()
 {
        // set clip_load to the weapon we have switched to, if the gun uses reloading
@@ -195,17 +198,6 @@ float w_shotgun(float req)
                                weapon_thinkf(WFRAME_FIRE1, 0, W_Shotgun_Attack2);
                        }
                }
-        if(self.wish_reload)
-        {
-            if(self.switchweapon == self.weapon)
-            {
-                if(self.weaponentity.state == WS_READY)
-                {
-                    self.wish_reload = 0;
-                    W_Shotgun_Reload();
-                }
-            }
-        }
        }
        else if (req == WR_PRECACHE)
        {
@@ -231,9 +223,14 @@ float w_shotgun(float req)
        }
        else if (req == WR_CHECKAMMO2)
        {
-               // melee attack must always be available
+               // melee attack is always available
                return TRUE;
        }
+       else if (req == WR_RESETPLAYER)
+       {
+               // all weapons must be fully loaded when we spawn
+               self.shotgun_load = autocvar_g_balance_shotgun_reload_ammo;
+       }
        else if (req == WR_RELOAD)
        {
                W_Shotgun_Reload();