#ifdef REGISTER_WEAPON
-REGISTER_WEAPON(ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "rl", "rocketlauncher", _("Rocket Launcher"))
+REGISTER_WEAPON(ROCKET_LAUNCHER, w_rlauncher, IT_ROCKETS, 9, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_HIGH, "rl", "rocketlauncher", _("Rocket Launcher"))
#else
#ifdef SVQC
.float rl_release;
.float rl_detonate_later;
-// weapon load persistence, for weapons that support reloading
-.float rocketlauncher_load;
-
-void W_RocketLauncher_SetAmmoCounter()
-{
- // set clip_load to the weapon we have switched to, if the gun uses reloading
- if(!autocvar_g_balance_rocketlauncher_reload_ammo)
- self.clip_load = 0; // also keeps crosshair ammo from displaying
- else
- {
- self.clip_load = self.rocketlauncher_load;
- self.clip_size = autocvar_g_balance_rocketlauncher_reload_ammo; // for the crosshair ammo display
- }
-}
-
-void W_RocketLauncher_ReloadedAndReady()
-{
- float t;
-
- // now do the ammo transfer
- self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
- while(self.clip_load < autocvar_g_balance_rocketlauncher_reload_ammo && self.ammo_rockets) // make sure we don't add more ammo than we have
- {
- self.clip_load += 1;
- self.ammo_rockets -= 1;
- }
- self.rocketlauncher_load = self.clip_load;
-
- t = ATTACK_FINISHED(self) - autocvar_g_balance_rocketlauncher_reload_time - 1;
- ATTACK_FINISHED(self) = t;
- w_ready();
-}
-
-void W_RocketLauncher_Reload()
-{
- // return if reloading is disabled for this weapon
- if(!autocvar_g_balance_rocketlauncher_reload_ammo)
- return;
-
- if(!W_ReloadCheck(self.ammo_rockets, autocvar_g_balance_rocketlauncher_ammo))
- return;
-
- float t;
-
- sound (self, CHAN_WEAPON2, "weapons/reload.wav", VOL_BASE, ATTN_NORM);
-
- t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_rocketlauncher_reload_time + 1;
- ATTACK_FINISHED(self) = t;
-
- weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_rocketlauncher_reload_time, W_RocketLauncher_ReloadedAndReady);
-
- self.old_clip_load = self.clip_load;
- self.clip_load = -1;
-}
-
void W_Rocket_Unregister()
{
if(self.owner && self.owner.lastrocket == self)
if(other.takedamage == DAMAGE_AIM)
if(other.classname == "player")
if(IsDifferentTeam(self.owner, other))
- if(IsFlying(other))
- AnnounceTo(self.owner, "airshot");
+ if(other.deadflag == DEAD_NO)
+ if(IsFlying(other))
+ AnnounceTo(self.owner, "airshot");
self.event_damage = SUB_Null;
self.takedamage = DAMAGE_NO;
local entity missile;
local entity flash;
- // 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_rocketlauncher_reload_ammo)
- {
- self.clip_load -= autocvar_g_balance_rocketlauncher_ammo;
- self.rocketlauncher_load = self.clip_load;
- }
- else
- self.ammo_rockets -= autocvar_g_balance_rocketlauncher_ammo;
- }
+ W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_rocketlauncher_ammo, autocvar_g_balance_rocketlauncher_reload_ammo);
W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', FALSE, 5, "weapons/rocket_fire.wav", CHAN_WEAPON, autocvar_g_balance_rocketlauncher_damage);
pointparticles(particleeffectnum("rocketlauncher_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
// count potential damage according to type of target
if (targ == self)
selfdamage = selfdamage + d;
- else if (targ.team == self.team && teams_matter)
+ else if (targ.team == self.team && teamplay)
teamdamage = teamdamage + d;
else if (bot_shouldattack(targ))
enemydamage = enemydamage + d;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
- if (teams_matter && self.team)
+ if (teamplay && self.team)
desirabledamage = desirabledamage - teamdamage;
missile = find(world, classname, "rocket");
else if (req == WR_THINK)
{
if(autocvar_g_balance_rocketlauncher_reload_ammo && self.clip_load < autocvar_g_balance_rocketlauncher_ammo) // forced reload
- W_RocketLauncher_Reload();
+ weapon_action(self.weapon, WR_RELOAD);
else
{
if (self.BUTTON_ATCK)
precache_sound ("weapons/rocket_det.wav");
precache_sound ("weapons/rocket_fire.wav");
precache_sound ("weapons/rocket_mode.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_ROCKET_LAUNCHER);
- W_RocketLauncher_SetAmmoCounter();
+ self.current_ammo = ammo_rockets;
self.rl_release = 1;
}
else if (req == WR_CHECKAMMO1)
{
if(autocvar_g_balance_rocketlauncher_reload_ammo)
{
- if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo && self.rocketlauncher_load < autocvar_g_balance_rocketlauncher_ammo)
+ if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo && self.weapon_load[WEP_ROCKET_LAUNCHER] < autocvar_g_balance_rocketlauncher_ammo)
ammo_amount = TRUE;
}
else if(self.ammo_rockets < autocvar_g_balance_rocketlauncher_ammo)
else if (req == WR_RESETPLAYER)
{
self.rl_release = 0;
-
- // all weapons must be fully loaded when we spawn
- self.rocketlauncher_load = autocvar_g_balance_rocketlauncher_reload_ammo;
}
else if (req == WR_RELOAD)
{
- W_RocketLauncher_Reload();
+ W_Reload(autocvar_g_balance_rocketlauncher_ammo, autocvar_g_balance_rocketlauncher_reload_ammo, autocvar_g_balance_rocketlauncher_reload_time, "weapons/reload.wav");
}
return TRUE;
};