X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fw_sniperrifle.qc;h=f634993f5ad7ea6c2565c4e60eb7fc9b56f54aaf;hb=1629a11f384760133c497a31b909248f36a5792a;hp=6c2621f9f4c14025151984e8e0475918c75e5553;hpb=03914e08e75d005bef83e6999f07dbe08acd3718;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/w_sniperrifle.qc b/qcsrc/server/w_sniperrifle.qc index 6c2621f9f..f634993f5 100644 --- a/qcsrc/server/w_sniperrifle.qc +++ b/qcsrc/server/w_sniperrifle.qc @@ -10,17 +10,7 @@ REGISTER_WEAPON(SNIPERRIFLE, w_sniperrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_F void W_SniperRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant) { - // 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_sniperrifle_reload_ammo) - { - self.clip_load -= pAmmo; - self.weapon_load[WEP_SNIPERRIFLE] = self.clip_load; - } - else - self.ammo_nails -= pAmmo; - } + W_DecreaseAmmo(ammo_nails, pAmmo, autocvar_g_balance_sniperrifle_reload_ammo); 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); @@ -185,11 +175,12 @@ float w_sniperrifle(float req) precache_model ("models/weapons/h_campingrifle.iqm"); precache_sound ("weapons/campingrifle_fire.wav"); precache_sound ("weapons/campingrifle_fire2.wav"); - precache_sound ("weapons/reload.wav"); + //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else } else if (req == WR_SETUP) { weapon_setup(WEP_SNIPERRIFLE); + self.current_ammo = ammo_nails; } else if (req == WR_CHECKAMMO1) { @@ -209,7 +200,7 @@ float w_sniperrifle(float req) } else if (req == WR_RELOAD) { - W_Reload(ammo_nails, min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo), autocvar_g_balance_sniperrifle_reload_ammo, autocvar_g_balance_sniperrifle_reload_time, "weapons/reload.wav"); + W_Reload(min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo), autocvar_g_balance_sniperrifle_reload_ammo, autocvar_g_balance_sniperrifle_reload_time, "weapons/reload.wav"); } return TRUE; };