From: Mircea Kitsune Date: Fri, 21 Jan 2011 15:53:58 +0000 (+0200) Subject: Fix more issues X-Git-Tag: xonotic-v0.5.0~309^2~7^2~159 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=746c49436d60a3d4e1f259fcbb14dc0e38178acb;p=xonotic%2Fxonotic-data.pk3dir.git Fix more issues --- diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index a92c642c7..84830d437 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -928,6 +928,13 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) f = weapon_action(wpn, WR_CHECKAMMO1); f = f + weapon_action(wpn, WR_CHECKAMMO2); + // don't switch away from reloadable weapons, even if we're out of ammo, since the + // weapon itself might still be loaded. The reload code takes care of the switching + entity e; + e = get_weaponinfo(self.weapon); + if(cvar(strcat("g_balance_", e.netname, "_reload_ammo"))) + f = 1; + // always allow selecting the Mine Layer if we placed mines, so that we can detonate them local entity mine; if(wpn == WEP_MINE_LAYER) diff --git a/qcsrc/server/w_shotgun.qc b/qcsrc/server/w_shotgun.qc index 643c3158a..6202b518b 100644 --- a/qcsrc/server/w_shotgun.qc +++ b/qcsrc/server/w_shotgun.qc @@ -84,7 +84,7 @@ void W_Shotgun_Attack (void) if not(self.items & IT_UNLIMITED_WEAPON_AMMO) { if(!autocvar_g_balance_shotgun_reload_ammo) - self.ammo_shells = self.ammo_shells - ammoamount; + self.ammo_shells -= ammoamount; else self.shotgun_load -= ammoamount; } @@ -222,10 +222,7 @@ float w_shotgun(float req) } else if (req == WR_CHECKAMMO1) { - if(autocvar_g_balance_shotgun_reload_ammo) - return self.shotgun_load >= autocvar_g_balance_shotgun_primary_ammo; - else - return self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo; + return self.ammo_shells >= autocvar_g_balance_shotgun_primary_ammo; } else if (req == WR_CHECKAMMO2) { diff --git a/qcsrc/server/w_sniperrifle.qc b/qcsrc/server/w_sniperrifle.qc index 5bd5d5fc6..c17f68344 100644 --- a/qcsrc/server/w_sniperrifle.qc +++ b/qcsrc/server/w_sniperrifle.qc @@ -61,12 +61,8 @@ 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 not(self.items & IT_UNLIMITED_WEAPON_AMMO) - { - if(!autocvar_g_balance_sniperrifle_reload_ammo) - self.ammo_nails -= pAmmo; - else - self.sniperrifle_load -= pAmmo; - } + if(!autocvar_g_balance_sniperrifle_reload_ammo) + self.ammo_nails -= pAmmo; if(deathtype & HITTYPE_SECONDARY) W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, "weapons/campingrifle_fire2.wav", CHAN_WEAPON, autocvar_g_balance_sniperrifle_secondary_damage + autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage); @@ -89,8 +85,14 @@ void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAdded if (autocvar_g_casings >= 2) 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); - - self.ammo_counter = self.ammo_counter - 1; + + if not(self.items & IT_UNLIMITED_WEAPON_AMMO) + { + if(!autocvar_g_balance_sniperrifle_reload_ammo) + self.ammo_nails -= 1; + else + self.sniperrifle_load -= 1; + } } void W_SniperRifle_Attack() @@ -233,7 +235,7 @@ float w_sniperrifle(float req) if(self.weaponentity.state == WS_READY) { self.wish_reload = 0; - W_SniperRifle_Reload(self.ammo_nails); + W_SniperRifle_Reload(); } } } @@ -254,17 +256,11 @@ float w_sniperrifle(float req) } else if (req == WR_CHECKAMMO1) { - if(autocvar_g_balance_sniperrifle_reload_ammo) - return self.sniperrifle_load >= autocvar_g_balance_sniperrifle_primary_ammo; - else - return self.ammo_nails >= autocvar_g_balance_sniperrifle_primary_ammo; + return self.ammo_nails >= autocvar_g_balance_sniperrifle_primary_ammo; } else if (req == WR_CHECKAMMO2) { - if(autocvar_g_balance_sniperrifle_reload_ammo) - return self.sniperrifle_load >= autocvar_g_balance_sniperrifle_secondary_ammo; - else - return self.ammo_nails >= autocvar_g_balance_sniperrifle_secondary_ammo; + return self.ammo_nails >= autocvar_g_balance_sniperrifle_secondary_ammo; } else if (req == WR_RELOAD) {