-REGISTER_WEAPON(CAMPINGRIFLE, w_campingrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "campingrifle", "campingrifle", "Sniper Rifle");
+REGISTER_WEAPON(SNIPERRIFLE, w_sniperrifle, IT_NAILS, 7, WEP_FLAG_NORMAL | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_MID, "campingrifle", "sniperrifle", "Sniper Rifle");
//* Manually operating the bolt means that all the power of the gas is used to propell the bullet. In this mode the bolt is prevented from moving backwards in response to the firing of the bullet.
//** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
//* Manually operating the bolt means that all the power of the gas is used to propell the bullet. In this mode the bolt is prevented from moving backwards in response to the firing of the bullet.
//** In fully automatic mode some of the gas is used to extract and reload the next cartrige, thus there is less power and range.
- maxbulls = min(maxbulls, floor(self.ammo_nails / min(autocvar_g_balance_campingrifle_primary_ammo, autocvar_g_balance_campingrifle_secondary_ammo)));
- if(self.campingrifle_bulletcounter > maxbulls || !autocvar_g_balance_campingrifle_magazinecapacity)
- self.campingrifle_bulletcounter = maxbulls;
- return (self.campingrifle_bulletcounter == maxbulls);
+ maxbulls = min(maxbulls, floor(self.ammo_nails / min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)));
+ if(self.sniperrifle_bulletcounter > maxbulls || !autocvar_g_balance_sniperrifle_magazinecapacity)
+ self.sniperrifle_bulletcounter = maxbulls;
+ return (self.sniperrifle_bulletcounter == maxbulls);
- self.campingrifle_bulletcounter = autocvar_g_balance_campingrifle_magazinecapacity;
- W_CampingRifle_CheckMaxBullets(TRUE);
- t = ATTACK_FINISHED(self) - autocvar_g_balance_campingrifle_reloadtime - 1;
+ self.sniperrifle_bulletcounter = autocvar_g_balance_sniperrifle_magazinecapacity;
+ W_SniperRifle_CheckMaxBullets(TRUE);
+ t = ATTACK_FINISHED(self) - autocvar_g_balance_sniperrifle_reloadtime - 1;
- if(self.ammo_nails < min(autocvar_g_balance_campingrifle_primary_ammo, autocvar_g_balance_campingrifle_secondary_ammo)) // when we get here, bulletcounter must be 0 or -1
+ if(self.ammo_nails < min(autocvar_g_balance_sniperrifle_primary_ammo, autocvar_g_balance_sniperrifle_secondary_ammo)) // when we get here, bulletcounter must be 0 or -1
sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);
sound (self, CHAN_WEAPON2, "weapons/campingrifle_reload.wav", VOL_BASE, ATTN_NORM);
- weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_campingrifle_reloadtime, W_CampingRifle_ReloadedAndReady);
+ weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_sniperrifle_reloadtime, W_SniperRifle_ReloadedAndReady);
-void W_CampingRifle_FireBullet(float pSpread, float pDamage, float pHeadshotAddedDamage, float pForce, float pSpeed, float pLifetime, float pAmmo, float deathtype, float pBulletConstant)
+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)
self.ammo_nails -= pAmmo;
if(deathtype & HITTYPE_SECONDARY)
{
if not(self.items & IT_UNLIMITED_WEAPON_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_campingrifle_secondary_damage + autocvar_g_balance_campingrifle_secondary_headshotaddeddamage);
+ 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);
- W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, "weapons/campingrifle_fire.wav", CHAN_WEAPON, autocvar_g_balance_campingrifle_primary_damage + autocvar_g_balance_campingrifle_primary_headshotaddeddamage);
+ W_SetupShot (self, autocvar_g_antilag_bullets && pSpeed >= autocvar_g_antilag_bullets, 2, "weapons/campingrifle_fire.wav", CHAN_WEAPON, autocvar_g_balance_sniperrifle_primary_damage + autocvar_g_balance_sniperrifle_primary_headshotaddeddamage);
pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 2000, 1);
- fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_campingrifle_secondary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
+ fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_sniperrifle_secondary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
- fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_campingrifle_primary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
+ fireBallisticBullet(w_shotorg, w_shotdir, pSpread, pSpeed, pLifetime, pDamage, pHeadshotAddedDamage / pDamage, pForce, deathtype, (autocvar_g_balance_sniperrifle_primary_tracer ? EF_RED : EF_BLUE), 1, pBulletConstant);
endFireBallisticBullet();
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);
endFireBallisticBullet();
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.campingrifle_bulletcounter = self.campingrifle_bulletcounter - 1;
- W_CampingRifle_CheckMaxBullets(TRUE);
+ self.sniperrifle_bulletcounter = self.sniperrifle_bulletcounter - 1;
+ W_SniperRifle_CheckMaxBullets(TRUE);
- W_CampingRifle_FireBullet(autocvar_g_balance_campingrifle_primary_spread, autocvar_g_balance_campingrifle_primary_damage, autocvar_g_balance_campingrifle_primary_headshotaddeddamage, autocvar_g_balance_campingrifle_primary_force, autocvar_g_balance_campingrifle_primary_speed, autocvar_g_balance_campingrifle_primary_lifetime, autocvar_g_balance_campingrifle_primary_ammo, WEP_CAMPINGRIFLE, autocvar_g_balance_campingrifle_primary_bulletconstant);
+ W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_primary_spread, autocvar_g_balance_sniperrifle_primary_damage, autocvar_g_balance_sniperrifle_primary_headshotaddeddamage, autocvar_g_balance_sniperrifle_primary_force, autocvar_g_balance_sniperrifle_primary_speed, autocvar_g_balance_sniperrifle_primary_lifetime, autocvar_g_balance_sniperrifle_primary_ammo, WEP_SNIPERRIFLE, autocvar_g_balance_sniperrifle_primary_bulletconstant);
- W_CampingRifle_FireBullet(autocvar_g_balance_campingrifle_secondary_spread, autocvar_g_balance_campingrifle_secondary_damage, autocvar_g_balance_campingrifle_secondary_headshotaddeddamage, autocvar_g_balance_campingrifle_secondary_force, autocvar_g_balance_campingrifle_secondary_speed, autocvar_g_balance_campingrifle_secondary_lifetime, autocvar_g_balance_campingrifle_secondary_ammo, WEP_CAMPINGRIFLE | HITTYPE_SECONDARY, autocvar_g_balance_campingrifle_secondary_bulletconstant);
+ W_SniperRifle_FireBullet(autocvar_g_balance_sniperrifle_secondary_spread, autocvar_g_balance_sniperrifle_secondary_damage, autocvar_g_balance_sniperrifle_secondary_headshotaddeddamage, autocvar_g_balance_sniperrifle_secondary_force, autocvar_g_balance_sniperrifle_secondary_speed, autocvar_g_balance_sniperrifle_secondary_lifetime, autocvar_g_balance_sniperrifle_secondary_ammo, WEP_SNIPERRIFLE | HITTYPE_SECONDARY, autocvar_g_balance_sniperrifle_secondary_bulletconstant);
-.void(void) campingrifle_bullethail_attackfunc;
-.float campingrifle_bullethail_frame;
-.float campingrifle_bullethail_animtime;
-.float campingrifle_bullethail_refire;
-void W_CampingRifle_BulletHail_Continue()
+.void(void) sniperrifle_bullethail_attackfunc;
+.float sniperrifle_bullethail_frame;
+.float sniperrifle_bullethail_animtime;
+.float sniperrifle_bullethail_refire;
+void W_SniperRifle_BulletHail_Continue()
return; // reloading, so we are done
sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing
af = ATTACK_FINISHED(self);
self.switchweapon = self.weapon;
ATTACK_FINISHED(self) = time;
print(ftos(self.ammo_nails), "\n");
return; // reloading, so we are done
sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing
af = ATTACK_FINISHED(self);
self.switchweapon = self.weapon;
ATTACK_FINISHED(self) = time;
print(ftos(self.ammo_nails), "\n");
- self.campingrifle_bullethail_attackfunc();
- weapon_thinkf(self.campingrifle_bullethail_frame, self.campingrifle_bullethail_animtime, W_CampingRifle_BulletHail_Continue);
+ self.sniperrifle_bullethail_attackfunc();
+ weapon_thinkf(self.sniperrifle_bullethail_frame, self.sniperrifle_bullethail_animtime, W_SniperRifle_BulletHail_Continue);
-void W_CampingRifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animtime, float refire)
+void W_SniperRifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animtime, float refire)
- self.campingrifle_bullethail_attackfunc = AttackFunc;
- self.campingrifle_bullethail_frame = fr;
- self.campingrifle_bullethail_animtime = animtime;
- self.campingrifle_bullethail_refire = refire;
- weapon_thinkf(fr, animtime, W_CampingRifle_BulletHail_Continue);
+ self.sniperrifle_bullethail_attackfunc = AttackFunc;
+ self.sniperrifle_bullethail_frame = fr;
+ self.sniperrifle_bullethail_animtime = animtime;
+ self.sniperrifle_bullethail_refire = refire;
+ weapon_thinkf(fr, animtime, W_SniperRifle_BulletHail_Continue);
- if(bot_aim(autocvar_g_balance_campingrifle_primary_speed, 0, autocvar_g_balance_campingrifle_primary_lifetime, TRUE))
+ if(bot_aim(autocvar_g_balance_sniperrifle_primary_speed, 0, autocvar_g_balance_sniperrifle_primary_lifetime, TRUE))
- if(bot_aim(autocvar_g_balance_campingrifle_secondary_speed, 0, autocvar_g_balance_campingrifle_secondary_lifetime, TRUE))
+ if(bot_aim(autocvar_g_balance_sniperrifle_secondary_speed, 0, autocvar_g_balance_sniperrifle_secondary_lifetime, TRUE))
- self.campingrifle_accumulator = bound(time - autocvar_g_balance_campingrifle_bursttime, self.campingrifle_accumulator, time);
+ self.sniperrifle_accumulator = bound(time - autocvar_g_balance_sniperrifle_bursttime, self.sniperrifle_accumulator, time);
- if (weapon_prepareattack_check(0, autocvar_g_balance_campingrifle_primary_refire))
- if (time >= self.campingrifle_accumulator + autocvar_g_balance_campingrifle_primary_burstcost)
+ if (weapon_prepareattack_check(0, autocvar_g_balance_sniperrifle_primary_refire))
+ if (time >= self.sniperrifle_accumulator + autocvar_g_balance_sniperrifle_primary_burstcost)
- weapon_prepareattack_do(0, autocvar_g_balance_campingrifle_primary_refire);
- W_CampingRifle_BulletHail(autocvar_g_balance_campingrifle_primary_bullethail, W_CampingRifle_Attack, WFRAME_FIRE1, autocvar_g_balance_campingrifle_primary_animtime, autocvar_g_balance_campingrifle_primary_refire);
- self.campingrifle_accumulator += autocvar_g_balance_campingrifle_primary_burstcost;
+ weapon_prepareattack_do(0, autocvar_g_balance_sniperrifle_primary_refire);
+ W_SniperRifle_BulletHail(autocvar_g_balance_sniperrifle_primary_bullethail, W_SniperRifle_Attack, WFRAME_FIRE1, autocvar_g_balance_sniperrifle_primary_animtime, autocvar_g_balance_sniperrifle_primary_refire);
+ self.sniperrifle_accumulator += autocvar_g_balance_sniperrifle_primary_burstcost;
- if (weapon_prepareattack_check(1, autocvar_g_balance_campingrifle_secondary_refire))
- if (time >= self.campingrifle_accumulator + autocvar_g_balance_campingrifle_secondary_burstcost)
+ 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_campingrifle_secondary_refire);
- W_CampingRifle_BulletHail(autocvar_g_balance_campingrifle_secondary_bullethail, W_CampingRifle_Attack2, WFRAME_FIRE2, autocvar_g_balance_campingrifle_secondary_animtime, autocvar_g_balance_campingrifle_primary_refire);
- self.campingrifle_accumulator += autocvar_g_balance_campingrifle_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;
- full = W_CampingRifle_CheckMaxBullets(TRUE);
- if(autocvar_g_balance_campingrifle_auto_reload_on_switch)
+ full = W_SniperRifle_CheckMaxBullets(TRUE);
+ if(autocvar_g_balance_sniperrifle_auto_reload_on_switch)
- self.campingrifle_accumulator = time - autocvar_g_balance_campingrifle_bursttime;
- self.campingrifle_bulletcounter = autocvar_g_balance_campingrifle_magazinecapacity;
- W_CampingRifle_CheckMaxBullets(FALSE);
+ self.sniperrifle_accumulator = time - autocvar_g_balance_sniperrifle_bursttime;
+ self.sniperrifle_bulletcounter = autocvar_g_balance_sniperrifle_magazinecapacity;
+ W_SniperRifle_CheckMaxBullets(FALSE);