]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_sniperrifle.qc
make weapon death messages translatable
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_sniperrifle.qc
index 720ab8f82be4d9a79fe1e7a3d043ddec188e01ff..a03a9b6108491e565170634feba2b7940815a8ae 100644 (file)
@@ -1,5 +1,5 @@
 #ifdef REGISTER_WEAPON
-REGISTER_WEAPON(SNIPERRIFLE, w_sniperrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "campingrifle", "sniperrifle", "Sniper Rifle");
+REGISTER_WEAPON(SNIPERRIFLE, w_sniperrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "campingrifle", "sniperrifle", _("Sniper Rifle"))
 #else
 #ifdef SVQC
 //Sniper rifle Primary mode: manually operated bolt*, Secondary: full automatic**
@@ -212,9 +212,7 @@ float w_sniperrifle(float req)
        {
                if(self.sniperrifle_bulletcounter < 0) // forced reload (e.g. because interrupted)
                {
-                       if(self.switchweapon == self.weapon)
-                       if(self.weaponentity.state == WS_READY)
-                               W_SniperRifle_Reload();
+            self.wish_reload = 1;
                }
                else
                {
@@ -231,16 +229,32 @@ float w_sniperrifle(float req)
                        {       
                                if (autocvar_g_balance_sniperrifle_secondary)
                                {
-                                       if (weapon_prepareattack_check(1, autocvar_g_balance_sniperrifle_secondary_refire))
-                                       if (time >= self.sniperrifle_accumulator + autocvar_g_balance_sniperrifle_secondary_burstcost)
-                                       {
-                                               weapon_prepareattack_do(1, autocvar_g_balance_sniperrifle_secondary_refire);
-                                               W_SniperRifle_BulletHail(autocvar_g_balance_sniperrifle_secondary_bullethail, W_SniperRifle_Attack2, WFRAME_FIRE2, autocvar_g_balance_sniperrifle_secondary_animtime, autocvar_g_balance_sniperrifle_primary_refire);
-                                               self.sniperrifle_accumulator += autocvar_g_balance_sniperrifle_secondary_burstcost;
-                                       }
+                    if(autocvar_g_balance_sniperrifle_secondary_reload)
+                        self.wish_reload = 1;
+                    else
+                    {
+                        if (weapon_prepareattack_check(1, autocvar_g_balance_sniperrifle_secondary_refire))
+                        if (time >= self.sniperrifle_accumulator + autocvar_g_balance_sniperrifle_secondary_burstcost)
+                        {
+                            weapon_prepareattack_do(1, autocvar_g_balance_sniperrifle_secondary_refire);
+                            W_SniperRifle_BulletHail(autocvar_g_balance_sniperrifle_secondary_bullethail, W_SniperRifle_Attack2, WFRAME_FIRE2, autocvar_g_balance_sniperrifle_secondary_animtime, autocvar_g_balance_sniperrifle_primary_refire);
+                            self.sniperrifle_accumulator += autocvar_g_balance_sniperrifle_secondary_burstcost;
+                        }
+                    }
                                }
                        }
                }
+        if(self.wish_reload)
+        {
+            if(self.switchweapon == self.weapon)
+            {
+                if(self.weaponentity.state == WS_READY)
+                {
+                    self.wish_reload = 0;
+                    W_SniperRifle_Reload();
+                }
+            }
+        }
        }
        else if (req == WR_PRECACHE)
        {
@@ -266,7 +280,7 @@ float w_sniperrifle(float req)
                return self.ammo_nails >= autocvar_g_balance_sniperrifle_secondary_ammo;
        else if (req == WR_RELOAD)
        {
-               W_SniperRifle_Reload();
+        self.wish_reload = 1;
        }
        else if (req == WR_RESETPLAYER)
        {
@@ -304,32 +318,32 @@ float w_sniperrifle(float req)
        else if (req == WR_SUICIDEMESSAGE)
        {
                if(w_deathtype & HITTYPE_SECONDARY)
-                       w_deathtypestring = "%s shot themself automatically";
+                       w_deathtypestring = _("%s shot themself automatically");
                else
-                       w_deathtypestring = "%s sniped themself somehow";
+                       w_deathtypestring = _("%s sniped themself somehow");
        }
        else if (req == WR_KILLMESSAGE)
        {
                if(w_deathtype & HITTYPE_SECONDARY)
                {
                        if(w_deathtype & HITTYPE_BOUNCE)
-                               w_deathtypestring = "%s failed to hide from %s's bullet hail";
+                               w_deathtypestring = _("%s failed to hide from %s's bullet hail");
                        else
-                               w_deathtypestring = "%s died in %s's bullet hail";
+                               w_deathtypestring = _("%s died in %s's bullet hail");
                }
                else
                {
                        if(w_deathtype & HITTYPE_BOUNCE)
                        {
                                // TODO special headshot message here too?
-                               w_deathtypestring = "%s failed to hide from %s's rifle";
+                               w_deathtypestring = _("%s failed to hide from %s's rifle");
                        }
                        else
                        {
                                if(w_deathtype & HITTYPE_HEADSHOT)
-                                       w_deathtypestring = "%s got hit in the head by %s";
+                                       w_deathtypestring = _("%s got hit in the head by %s");
                                else
-                                       w_deathtypestring = "%s was sniped by %s";
+                                       w_deathtypestring = _("%s was sniped by %s");
                        }
                }
        }