]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_seeker.qc
Merge branch 'master' into mirceakitsune/universal_reload_system
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_seeker.qc
index b1cde626a0e74218028075eb035439e72cb8f5d2..9e02e2eca0895d117c8092c27137b8c0b4f329cd 100644 (file)
@@ -5,6 +5,9 @@ REGISTER_WEAPON(SEEKER, w_seeker, IT_ROCKETS, 8, WEP_FLAG_NORMAL | WEP_TYPE_SPLA
 //.float proxytime; = autoswitch
 //.float tl; = wait
 
+// weapon load persistence, for weapons that support reloading
+.float seeker_load;
+
 void W_Seeker_SetAmmoCounter()
 {
        // set clip_load to the weapon we have switched to, if the gun uses reloading
@@ -492,6 +495,8 @@ void spawnfunc_weapon_seeker (void)
 
 float w_seeker(float req)
 {
+       float ammo_amount;
+
        if (req == WR_AIM)
                self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, 20, FALSE);
 
@@ -517,18 +522,6 @@ float w_seeker(float req)
                                weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_flac_animtime, w_ready);
                        }
                }
-
-        if(self.wish_reload)
-        {
-            if(self.switchweapon == self.weapon)
-            {
-                if(self.weaponentity.state == WS_READY)
-                {
-                    self.wish_reload = 0;
-                    W_Seeker_Reload();
-                }
-            }
-        }
        }
        else if (req == WR_PRECACHE)
        {
@@ -547,17 +540,20 @@ float w_seeker(float req)
        }
        else if (req == WR_CHECKAMMO1)
        {
-               if(autocvar_g_balance_seeker_reload_ammo)
-                       return self.clip_load >= autocvar_g_balance_seeker_tag_ammo + autocvar_g_balance_seeker_missile_ammo;
-               else
-                       return self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo + autocvar_g_balance_seeker_missile_ammo;
+               ammo_amount = self.ammo_cells >= autocvar_g_balance_seeker_missile_ammo;
+               ammo_amount += (autocvar_g_balance_seeker_reload_ammo && self.seeker_load >= autocvar_g_balance_seeker_missile_ammo);
+               return ammo_amount;
        }
        else if (req == WR_CHECKAMMO2)
        {
-               if(autocvar_g_balance_seeker_reload_ammo)
-                       return self.clip_load >= autocvar_g_balance_seeker_flac_ammo;
-               else
-                       return self.ammo_rockets >= autocvar_g_balance_seeker_flac_ammo;
+               ammo_amount = self.ammo_cells >= autocvar_g_balance_seeker_flac_ammo;
+               ammo_amount += (autocvar_g_balance_seeker_reload_ammo && self.seeker_load >= autocvar_g_balance_seeker_flac_ammo);
+               return ammo_amount;
+       }
+       else if (req == WR_RESETPLAYER)
+       {
+               // all weapons must be fully loaded when we spawn
+               self.seeker_load = autocvar_g_balance_seeker_reload_ammo;
        }
        else if (req == WR_RELOAD)
        {
@@ -635,13 +631,13 @@ float w_seeker(float req)
                precache_sound("weapons/tag_impact.wav");
        }
        else if (req == WR_SUICIDEMESSAGE)
-               w_deathtypestring = "%s played with tiny rockets";
+               w_deathtypestring = _("%s played with tiny rockets");
        else if (req == WR_KILLMESSAGE)
        {
                if(w_deathtype & HITTYPE_SECONDARY)
-                       w_deathtypestring = "%s ran into %s's flac";
+                       w_deathtypestring = _("%s ran into %s's flac");
                else
-                       w_deathtypestring = "%s was tagged by %s";
+                       w_deathtypestring = _("%s was tagged by %s");
        }
        return TRUE;
 }