]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/w_uzi.qc
Do the ammo maths at the beginning again, more correct and safe
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_uzi.qc
index 8681c204cdd5009f9bff4ed89c96d177de7d4e1b..ebeedc2ec632b3f4fa3a8d40ffa085c5753be978 100644 (file)
@@ -95,9 +95,6 @@ void UziFlash()
 
 void W_Uzi_Attack (float deathtype)
 {
-       if(autocvar_g_balance_uzi_reload_ammo && self.clip_load <= 0)
-               return; // reloading, so we are done
-
        W_SetupShot (self, autocvar_g_antilag_bullets && autocvar_g_balance_uzi_speed >= autocvar_g_antilag_bullets, 0, "weapons/uzi_fire.wav", CHAN_WEAPON, ((self.misc_bulletcounter == 1) ? autocvar_g_balance_uzi_first_damage : autocvar_g_balance_uzi_sustained_damage));
        if (!g_norecoil)
        {
@@ -152,6 +149,18 @@ void uzi_fire1_02()
 void uzi_mode1_fire_auto()
 {
        float uzi_spread;
+
+       // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
+       if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
+       {
+               if(autocvar_g_balance_uzi_reload_ammo)
+               {
+                       self.clip_load -= autocvar_g_balance_uzi_sustained_ammo;
+                       self.uzi_load = self.clip_load;
+               }
+               else
+                       self.ammo_nails -= autocvar_g_balance_uzi_sustained_ammo;
+       }
        
        if (self.BUTTON_ATCK)
                weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_uzi_sustained_refire, uzi_mode1_fire_auto);
@@ -189,18 +198,6 @@ void uzi_mode1_fire_auto()
        
        if (autocvar_g_casings >= 2) // casing code
                SpawnCasing (((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
-
-       // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
-       if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
-       {
-               if(autocvar_g_balance_uzi_reload_ammo)
-               {
-                       self.clip_load -= autocvar_g_balance_uzi_sustained_ammo;
-                       self.uzi_load = self.clip_load;
-               }
-               else
-                       self.ammo_nails -= autocvar_g_balance_uzi_sustained_ammo;
-       }
 }
 
 void uzi_mode1_fire_burst()