+#include "hagar.qh"
#ifndef IMPLEMENTATION
CLASS(Hagar, Weapon)
-/* ammotype */ ATTRIB(Hagar, ammo_field, .int, ammo_rockets)
-/* impulse */ ATTRIB(Hagar, impulse, int, 8)
+/* ammotype */ ATTRIB(Hagar, ammo_field, .int, ammo_rockets);
+/* impulse */ ATTRIB(Hagar, impulse, int, 8);
/* flags */ ATTRIB(Hagar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH);
/* rating */ ATTRIB(Hagar, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
/* color */ ATTRIB(Hagar, wpcolor, vector, '1 1 0.5');
/* modelname */ ATTRIB(Hagar, mdl, string, "hagar");
-#ifndef MENUQC
+#ifdef GAMEQC
/* model */ ATTRIB(Hagar, m_model, Model, MDL_HAGAR_ITEM);
#endif
/* crosshair */ ATTRIB(Hagar, w_crosshair, string, "gfx/crosshairhagar");
missile.damageforcescale = WEP_CVAR_PRI(hagar, damageforcescale);
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
+ IL_PUSH(g_damagedbycontents, missile);
settouch(missile, W_Hagar_Touch);
missile.use = W_Hagar_Explode_use;
missile.angles = vectoangles(missile.velocity);
missile.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, missile);
+ IL_PUSH(g_bot_dodge, missile);
missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
+ IL_PUSH(g_damagedbycontents, missile);
settouch(missile, W_Hagar_Touch2);
missile.cnt = 0;
missile.angles = vectoangles(missile.velocity);
missile.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, missile);
+ IL_PUSH(g_bot_dodge, missile);
missile.missile_flags = MIF_SPLASH;
CSQCProjectile(missile, true, PROJECTILE_HAGAR_BOUNCING, true);
missile.damageforcescale = WEP_CVAR_SEC(hagar, damageforcescale);
missile.event_damage = W_Hagar_Damage;
missile.damagedbycontents = true;
+ IL_PUSH(g_damagedbycontents, missile);
settouch(missile, W_Hagar_Touch); // not bouncy
missile.use = W_Hagar_Explode2_use;
missile.angles = vectoangles(missile.velocity);
missile.flags = FL_PROJECTILE;
IL_PUSH(g_projectiles, missile);
+ IL_PUSH(g_bot_dodge, missile);
CSQCProjectile(missile, true, PROJECTILE_HAGAR, true);
{
// loadable hagar secondary attack, must always run each frame
- if(time < game_starttime)
+ if(time < game_starttime || PS(actor).m_switchweapon != WEP_HAGAR)
return;
bool loaded = actor.hagar_load >= WEP_CVAR_SEC(hagar, load_max);
void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- if(!(fire & 1) || actor.hagar_load || actor.hagar_loadblock)
+ if(!(fire & 1) || actor.hagar_load || actor.hagar_loadblock || PS(actor).m_switchweapon != WEP_HAGAR)
{
w_ready(thiswep, actor, weaponentity, fire);
return;
}
}
}
-METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor))
+METHOD(Hagar, wr_gonethink, void(entity thiswep, entity actor, .entity weaponentity))
{
// we lost the weapon and want to prepare switching away
if(actor.hagar_load)
{
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- if(actor.(weaponentity).weaponname != WEP_HAGAR.mdl)
- continue; // only if it's a hagar (currently only way to detect)
- actor.(weaponentity).state = WS_READY;
- W_Hagar_Attack2_Load_Release(actor, weaponentity);
- }
+ actor.(weaponentity).state = WS_READY;
+ W_Hagar_Attack2_Load_Release(actor, weaponentity);
}
}
METHOD(Hagar, wr_setup, void(entity thiswep, entity actor))
{
actor.hagar_load = 0;
}
-METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor))
+METHOD(Hagar, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
{
// if we have any rockets loaded when we die, release them
if(actor.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
- {
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- if(actor.(weaponentity).weaponname != WEP_HAGAR.mdl)
- continue; // only if it's a hagar (currently only way to detect)
- W_Hagar_Attack2_Load_Release(actor, weaponentity);
- }
- }
+ W_Hagar_Attack2_Load_Release(actor, weaponentity);
}
METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
{