]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Reload if we don't have ammo for a certain attack. Prevents situations in which you...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 22 Jan 2011 02:03:52 +0000 (04:03 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 22 Jan 2011 02:03:52 +0000 (04:03 +0200)
qcsrc/server/w_crylink.qc
qcsrc/server/w_electro.qc
qcsrc/server/w_fireball.qc
qcsrc/server/w_grenadelauncher.qc
qcsrc/server/w_hlac.qc
qcsrc/server/w_minelayer.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/w_sniperrifle.qc
qcsrc/server/w_uzi.qc

index 604efbe1c1cd5ac3b0b83e5ae08b6ffa3786c6b8..4a9ab41d31c974078936ff7cc74e3e449b57be8f 100644 (file)
@@ -373,6 +373,13 @@ void W_Crylink_Attack (void)
        vector forward, right, up;
        float maxdmg;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < autocvar_g_balance_crylink_primary_ammo)
+       {
+               W_Crylink_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -485,6 +492,13 @@ void W_Crylink_Attack2 (void)
        local entity proj, prevproj, firstproj;
        float maxdmg;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_crylink_reload_ammo && self.clip_load < autocvar_g_balance_crylink_secondary_ammo)
+       {
+               W_Crylink_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index c4cd72689843646e50a916b660850d4fc7215131..bbcdc06df39d9fd16e4f47f53ed6b803e18eb1ea 100644 (file)
@@ -164,6 +164,13 @@ void W_Electro_Attack()
 {
        local entity proj;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_electro_reload_ammo && self.clip_load < autocvar_g_balance_electro_primary_ammo)
+       {
+               W_Electro_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -211,6 +218,13 @@ void W_Electro_Attack2()
 {
        local entity proj;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_electro_reload_ammo && self.clip_load < autocvar_g_balance_electro_secondary_ammo)
+       {
+               W_Electro_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index e0f0748f4725b29b6153334bf4ecc71a1a74f8f6..4465aae9cacf3e454a3014292390cdea68c54c9d 100644 (file)
@@ -252,6 +252,13 @@ void W_Fireball_Attack1_Frame1()
 
 void W_Fireball_Attack1_Frame0()
 {
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_fireball_reload_ammo && self.clip_load < autocvar_g_balance_fireball_primary_ammo)
+       {
+               W_Fireball_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -313,6 +320,13 @@ void W_Fireball_Attack2()
        vector f_diff;
        float c;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_fireball_reload_ammo && self.clip_load < autocvar_g_balance_fireball_secondary_ammo)
+       {
+               W_Fireball_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index ddd5eacf499e4b5c4b071eccc9ae217565302c83..23312b9141bdf7cd5c9de35e5b05fb98af3b4a2f 100644 (file)
@@ -215,6 +215,13 @@ void W_Grenade_Attack (void)
 {
        local entity gren;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_grenadelauncher_reload_ammo && self.clip_load < autocvar_g_balance_grenadelauncher_primary_ammo)
+       {
+               W_GrenadeLauncher_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -272,6 +279,13 @@ void W_Grenade_Attack2 (void)
 {
        local entity gren;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_grenadelauncher_reload_ammo && self.clip_load < autocvar_g_balance_grenadelauncher_secondary_ammo)
+       {
+               W_GrenadeLauncher_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index 3a5ff0717cb203d313ca57929b1190cb7642950d..b07570b950a8ac4963fef70b076661e252f135c0 100644 (file)
@@ -76,6 +76,13 @@ void W_HLAC_Attack (void)
        local entity missile;
     float spread;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < autocvar_g_balance_hlac_primary_ammo)
+       {
+               W_HLAC_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -177,6 +184,13 @@ void W_HLAC_Attack2 (void)
 {
     float i;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_hlac_reload_ammo && self.clip_load < autocvar_g_balance_hlac_secondary_ammo)
+       {
+               W_HLAC_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index d46342ccc25d19c9c24cfc3ec914ba8e6cd620be..8efb7566cf23ffa3cc999d0f8cdfe2c4429e8a35 100644 (file)
@@ -268,6 +268,13 @@ void W_Mine_Attack (void)
                }
        }
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_minelayer_reload_ammo && self.clip_load < autocvar_g_balance_minelayer_ammo)
+       {
+               W_MineLayer_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index acf65a1f98dbb71582f0b71f8597293dc998a970..f38076deb2928a0baad8ce88aec0658b1e884999 100644 (file)
@@ -69,6 +69,13 @@ void W_Shotgun_Attack (void)
        float   bulletconstant;
        local entity flash;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo)
+       {
+               W_Shotgun_Reload();
+               return;
+       }
+
        ammoamount = autocvar_g_balance_shotgun_primary_ammo;
        bullets = autocvar_g_balance_shotgun_primary_bullets;
        d = autocvar_g_balance_shotgun_primary_damage;
index 826aa8d8dce435f4dfc474974482e34aebe5b2b5..454e1db7a4e32d165a39877bff65aa29351c9e9a 100644 (file)
@@ -63,6 +63,13 @@ void W_SniperRifle_Reload()
 
 void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant)
 {
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_sniperrifle_reload_ammo && self.clip_load < autocvar_g_balance_sniperrifle_primary_ammo)
+       {
+               W_SniperRifle_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
index a02175884d9f9dd1c76272e2586ffede03600e18..10390188d3e1bd63b8c6842c571bb4d1d4ec10cb 100644 (file)
@@ -150,6 +150,13 @@ void uzi_mode1_fire_auto()
 {
        float uzi_spread;
 
+       // if there's not enough ammo for this attack (but we still have the weapon), reload
+       if(autocvar_g_balance_uzi_reload_ammo && self.clip_load < max(autocvar_g_balance_uzi_sustained_ammo, autocvar_g_balance_uzi_first_ammo))
+       {
+               W_UZI_Reload();
+               return;
+       }
+
        // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
@@ -268,6 +275,13 @@ float w_uzi(float req)
                                        return FALSE;
                                }
 
+                               // if there's not enough ammo for this attack (but we still have the weapon), reload
+                               if(autocvar_g_balance_uzi_reload_ammo && self.clip_load < autocvar_g_balance_uzi_burst_ammo)
+                               {
+                                       W_UZI_Reload();
+                                       return;
+                               }
+
                                // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
                                if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
                                {