void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
{
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(mortar, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
gren.angles = vectoangles(gren.velocity);
gren.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, gren);
+ IL_PUSH(g_bot_dodge, gren);
if(WEP_CVAR_PRI(mortar, type) == 0 || WEP_CVAR_PRI(mortar, type) == 2)
CSQCProjectile(gren, true, PROJECTILE_GRENADE, true);
{
entity gren;
- W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo));
+ W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(mortar, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage));
w_shotdir = v_forward; // no TrueAim for grenades please
gren.angles = vectoangles(gren.velocity);
gren.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, gren);
+ IL_PUSH(g_bot_dodge, gren);
if(WEP_CVAR_SEC(mortar, type) == 0 || WEP_CVAR_SEC(mortar, type) == 2)
CSQCProjectile(gren, true, PROJECTILE_GRENADE, true);
if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
{
bool nadefound = false;
- entity nade;
- for(nade = NULL; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
+ IL_EACH(g_projectiles, it.realowner == actor && it.classname == "grenade",
{
- if(!nade.gl_detonate_later)
+ if(!it.gl_detonate_later)
{
- nade.gl_detonate_later = true;
+ it.gl_detonate_later = true;
nadefound = true;
}
- }
+ });
if(nadefound)
sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
}
}
}
}
-METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor))
+METHOD(Mortar, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
{
float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
ammo_amount += actor.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
return ammo_amount;
}
-METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor))
+METHOD(Mortar, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
{
float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
ammo_amount += actor.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);