]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_crylink.qc
Merge branch 'master' into mirceakitsune/universal_reload_system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_crylink.qc
index 604efbe1c1cd5ac3b0b83e5ae08b6ffa3786c6b8..d45edbbed7bc58bc2962eb0cb9af48b186569936 100644 (file)
@@ -9,6 +9,7 @@ REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLA
 .entity queuenext;
 .entity queueprev;
 
+// weapon load persistence, for weapons that support reloading
 .float crylink_load;
 
 void W_Crylink_SetAmmoCounter()
@@ -583,6 +584,7 @@ void spawnfunc_weapon_crylink (void)
 
 float w_crylink(float req)
 {
+       float ammo_amount;
        if (req == WR_AIM)
        {
                if (random() < 0.10)
@@ -652,17 +654,6 @@ float w_crylink(float req)
                                }
                        }
                }
-        if(self.wish_reload)
-        {
-            if(self.switchweapon == self.weapon)
-            {
-                if(self.weaponentity.state == WS_READY)
-                {
-                    self.wish_reload = 0;
-                    W_Crylink_Reload();
-                }
-            }
-        }
        }
        else if (req == WR_PRECACHE)
        {
@@ -672,6 +663,7 @@ float w_crylink(float req)
                precache_sound ("weapons/crylink_fire.wav");
                precache_sound ("weapons/crylink_fire2.wav");
                precache_sound ("weapons/crylink_linkjoin.wav");
+               precache_sound ("weapons/reload.wav");
        }
        else if (req == WR_SETUP)
        {
@@ -684,10 +676,9 @@ float w_crylink(float req)
                if(self.crylink_lastgroup && self.crylink_waitrelease)
                        return TRUE;
 
-               if(autocvar_g_balance_crylink_reload_ammo)
-                       return self.crylink_load >= autocvar_g_balance_crylink_primary_ammo;
-               else
-                       return self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo;
+               ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_primary_ammo;
+               ammo_amount += (autocvar_g_balance_crylink_reload_ammo && self.crylink_load >= autocvar_g_balance_crylink_primary_ammo);
+               return ammo_amount;
        }
        else if (req == WR_CHECKAMMO2)
        {
@@ -695,10 +686,18 @@ float w_crylink(float req)
                if(self.crylink_lastgroup && self.crylink_waitrelease)
                        return TRUE;
 
-               if(autocvar_g_balance_crylink_reload_ammo)
-                       return self.crylink_load >= autocvar_g_balance_crylink_secondary_ammo;
-               else
-                       return self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo;
+               ammo_amount = self.ammo_cells >= autocvar_g_balance_crylink_secondary_ammo;
+               ammo_amount += (autocvar_g_balance_crylink_reload_ammo && self.crylink_load >= autocvar_g_balance_crylink_secondary_ammo);
+               return ammo_amount;
+       }
+       else if (req == WR_RESETPLAYER)
+       {
+               // all weapons must be fully loaded when we spawn
+               self.crylink_load = autocvar_g_balance_crylink_reload_ammo;
+       }
+       else if (req == WR_RELOAD)
+       {
+               W_Crylink_Reload();
        }
        return TRUE;
 };
@@ -730,20 +729,16 @@ float w_crylink(float req)
        }
        else if (req == WR_SUICIDEMESSAGE)
        {
-               w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink";
+               w_deathtypestring = _("%s succeeded at self-destructing themself with the Crylink");
        }
        else if (req == WR_KILLMESSAGE)
        {
                if(w_deathtype & HITTYPE_BOUNCE)
-                       w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be)
+                       w_deathtypestring = _("%s could not hide from %s's Crylink"); // unchecked: SPLASH (SECONDARY can't be)
                else if(w_deathtype & HITTYPE_SPLASH)
-                       w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY
+                       w_deathtypestring = _("%s was too close to %s's Crylink"); // unchecked: SECONDARY
                else
-                       w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY
-       }
-       else if (req == WR_RELOAD)
-       {
-               W_Crylink_Reload();
+                       w_deathtypestring = _("%s took a close look at %s's Crylink"); // unchecked: SECONDARY
        }
        return TRUE;
 }