- METHOD(Electro, wr_aim, void(entity thiswep))
- {
- self.BUTTON_ATCK = self.BUTTON_ATCK2 = false;
- if(vlen(self.origin-self.enemy.origin) > 1000) { self.bot_secondary_electromooth = 0; }
- if(self.bot_secondary_electromooth == 0)
- {
- float shoot;
-
- if(WEP_CVAR_PRI(electro, speed))
- shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
- else
- shoot = bot_aim(1000000, 0, 0.001, false);
-
- if(shoot)
- {
- self.BUTTON_ATCK = true;
- if(random() < 0.01) self.bot_secondary_electromooth = 1;
- }
- }
- else
- {
- if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
- {
- self.BUTTON_ATCK2 = true;
- if(random() < 0.03) self.bot_secondary_electromooth = 0;
- }
- }
- }
- METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
- {
- if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
- {
- float ammo_amount = 0;
- if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
- ammo_amount = 1;
- if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
- ammo_amount += 1;
-
- if(!ammo_amount)
- {
- thiswep.wr_reload(thiswep, actor, weaponentity);
- return;
- }
- }
-
- if(fire & 1)
- {
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
- {
- W_Electro_Attack_Bolt(thiswep);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
- }
- }
- else if(fire & 2)
- {
- if(time >= actor.electro_secondarytime)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
- {
- W_Electro_Attack_Orb(thiswep);
- actor.electro_count = WEP_CVAR_SEC(electro, count);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
- actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor();
- }
- }
- }
- METHOD(Electro, wr_checkammo1, bool(entity thiswep))
- {
- float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
- return ammo_amount;
- }
- METHOD(Electro, wr_checkammo2, bool(entity thiswep))
- {
- float ammo_amount;
- if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
- }
- else
- {
- ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
- ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
- }
- return ammo_amount;
- }
- METHOD(Electro, wr_resetplayer, void(entity thiswep))
- {
- self.electro_secondarytime = time;
- }
- METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
- {
- W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
- }
- METHOD(Electro, wr_suicidemessage, int(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- return WEAPON_ELECTRO_SUICIDE_ORBS;
- else
- return WEAPON_ELECTRO_SUICIDE_BOLT;
- }
- METHOD(Electro, wr_killmessage, int(entity thiswep))
- {
- if(w_deathtype & HITTYPE_SECONDARY)
- {
- return WEAPON_ELECTRO_MURDER_ORBS;
- }
- else
- {
- if(w_deathtype & HITTYPE_BOUNCE)
- return WEAPON_ELECTRO_MURDER_COMBO;
- else
- return WEAPON_ELECTRO_MURDER_BOLT;
- }
- }
+METHOD(Electro, wr_aim, void(entity thiswep, entity actor))
+{
+ PHYS_INPUT_BUTTON_ATCK(actor) = PHYS_INPUT_BUTTON_ATCK2(actor) = false;
+ if(vdist(actor.origin - actor.enemy.origin, >, 1000)) { actor.bot_secondary_electromooth = 0; }
+ if(actor.bot_secondary_electromooth == 0)
+ {
+ float shoot;
+
+ if(WEP_CVAR_PRI(electro, speed))
+ shoot = bot_aim(actor, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false);
+ else
+ shoot = bot_aim(actor, 1000000, 0, 0.001, false);
+
+ if(shoot)
+ {
+ PHYS_INPUT_BUTTON_ATCK(actor) = true;
+ if(random() < 0.01) actor.bot_secondary_electromooth = 1;
+ }
+ }
+ else
+ {
+ if(bot_aim(actor, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true))
+ {
+ PHYS_INPUT_BUTTON_ATCK2(actor) = true;
+ if(random() < 0.03) actor.bot_secondary_electromooth = 0;
+ }
+ }
+}
+METHOD(Electro, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
+{
+ if(autocvar_g_balance_electro_reload_ammo) // forced reload // WEAPONTODO
+ {
+ float ammo_amount = 0;
+ if(actor.clip_load >= WEP_CVAR_PRI(electro, ammo))
+ ammo_amount = 1;
+ if(actor.clip_load >= WEP_CVAR_SEC(electro, ammo))
+ ammo_amount += 1;
+
+ if(!ammo_amount)
+ {
+ thiswep.wr_reload(thiswep, actor, weaponentity);
+ return;
+ }
+ }
+
+ if(fire & 1)
+ {
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(electro, refire)))
+ {
+ W_Electro_Attack_Bolt(thiswep, actor);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
+ }
+ }
+ else if(fire & 2)
+ {
+ if(time >= actor.electro_secondarytime)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(electro, refire)))
+ {
+ W_Electro_Attack_Orb(thiswep, actor);
+ actor.electro_count = WEP_CVAR_SEC(electro, count);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(electro, animtime), W_Electro_CheckAttack);
+ actor.electro_secondarytime = time + WEP_CVAR_SEC(electro, refire2) * W_WeaponRateFactor(actor);
+ }
+ }
+}
+METHOD(Electro, wr_checkammo1, bool(entity thiswep, entity actor))
+{
+ float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
+ return ammo_amount;
+}
+METHOD(Electro, wr_checkammo2, bool(entity thiswep, entity actor))
+{
+ float ammo_amount;
+ if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
+ {
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ }
+ else
+ {
+ ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
+ ammo_amount += actor.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
+ }
+ return ammo_amount;
+}
+METHOD(Electro, wr_resetplayer, void(entity thiswep, entity actor))
+{
+ actor.electro_secondarytime = time;
+}
+METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ W_Reload(actor, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND_RELOAD);
+}
+METHOD(Electro, wr_suicidemessage, Notification(entity thiswep))
+{
+ if(w_deathtype & HITTYPE_SECONDARY)
+ return WEAPON_ELECTRO_SUICIDE_ORBS;
+ else
+ return WEAPON_ELECTRO_SUICIDE_BOLT;
+}
+METHOD(Electro, wr_killmessage, Notification(entity thiswep))
+{
+ if(w_deathtype & HITTYPE_SECONDARY)
+ {
+ return WEAPON_ELECTRO_MURDER_ORBS;
+ }
+ else
+ {
+ if(w_deathtype & HITTYPE_BOUNCE)
+ return WEAPON_ELECTRO_MURDER_COMBO;
+ else
+ return WEAPON_ELECTRO_MURDER_BOLT;
+ }
+}