1 #include "okshotgun.qh"
4 METHOD(OverkillShotgun, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
6 if (vdist(actor.origin - actor.enemy.origin, >, WEP_CVAR_PRI(okshotgun, bot_range)))
8 PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
12 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false);
16 METHOD(OverkillShotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
18 if ((WEP_CVAR_SEC(okshotgun, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
20 // Secondary uses it's own refire timer if refire_type is 1.
21 actor.jump_interval = time + WEP_CVAR_SEC(okshotgun, refire) * W_WeaponRateFactor(actor);
22 // Ugly hack to reuse the fire mode of the blaster.
23 makevectors(actor.v_angle);
24 Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
25 actor.(weaponentity).m_weapon = WEP_BLASTER;
29 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
30 WEP_CVAR_SEC(okshotgun, shotangle),
31 WEP_CVAR_SEC(okshotgun, damage),
32 WEP_CVAR_SEC(okshotgun, edgedamage),
33 WEP_CVAR_SEC(okshotgun, radius),
34 WEP_CVAR_SEC(okshotgun, force),
35 WEP_CVAR_SEC(okshotgun, speed),
36 WEP_CVAR_SEC(okshotgun, spread),
37 WEP_CVAR_SEC(okshotgun, delay),
38 WEP_CVAR_SEC(okshotgun, lifetime)
40 actor.(weaponentity).m_weapon = oldwep;
41 if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
42 (actor.(weaponentity).wframe == WFRAME_FIRE2))
44 // Set secondary fire animation.
46 actor.(weaponentity).wframe = WFRAME_FIRE2;
47 a = actor.(weaponentity).anim_fire2;
48 a.z *= g_weaponratefactor;
49 FOREACH_CLIENT(true, LAMBDA(
50 if (it == actor || (IS_SPEC(it) && it.enemy == actor))
52 wframe_send(it, actor.(weaponentity), a, true);
55 animdecide_setaction(actor, ANIMACTION_SHOOT, true);
58 if (WEP_CVAR(okshotgun, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okshotgun, ammo))
61 thiswep.wr_reload(thiswep, actor, weaponentity);
64 if (fire & 1) // Primary attack
66 if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okshotgun, animtime)))
70 W_Shotgun_Attack(thiswep, actor, weaponentity, true,
71 WEP_CVAR_PRI(okshotgun, ammo),
72 WEP_CVAR_PRI(okshotgun, damage),
73 WEP_CVAR_PRI(okshotgun, bullets),
74 WEP_CVAR_PRI(okshotgun, spread),
75 WEP_CVAR_PRI(okshotgun, solidpenetration),
76 WEP_CVAR_PRI(okshotgun, force));
77 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okshotgun, animtime), w_ready);
80 if ((fire & 2) && (WEP_CVAR_SEC(okshotgun, refire_type) == 0)) // Secondary attack
82 if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okshotgun, refire)))
86 // Ugly hack to reuse the fire mode of the blaster.
87 makevectors(actor.v_angle);
88 Weapon oldwep = actor.(weaponentity).m_weapon; // we can't avoid this hack
89 actor.(weaponentity).m_weapon = WEP_BLASTER;
93 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
94 WEP_CVAR_SEC(okshotgun, shotangle),
95 WEP_CVAR_SEC(okshotgun, damage),
96 WEP_CVAR_SEC(okshotgun, edgedamage),
97 WEP_CVAR_SEC(okshotgun, radius),
98 WEP_CVAR_SEC(okshotgun, force),
99 WEP_CVAR_SEC(okshotgun, speed),
100 WEP_CVAR_SEC(okshotgun, spread),
101 WEP_CVAR_SEC(okshotgun, delay),
102 WEP_CVAR_SEC(okshotgun, lifetime)
104 actor.(weaponentity).m_weapon = oldwep;
105 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okshotgun, animtime), w_ready);
109 METHOD(OverkillShotgun, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
111 float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okshotgun, ammo);
112 ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_SHOTGUN.m_id]) >= WEP_CVAR_PRI(okshotgun, ammo);
116 METHOD(OverkillShotgun, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
118 return true; // Blaster secondary is unlimited.
121 METHOD(OverkillShotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
123 W_Reload(actor, weaponentity, WEP_CVAR_PRI(okshotgun, ammo), SND_RELOAD); // WEAPONTODO
126 METHOD(OverkillShotgun, wr_suicidemessage, Notification(entity thiswep))
128 return WEAPON_THINKING_WITH_PORTALS;
131 METHOD(OverkillShotgun, wr_killmessage, Notification(entity thiswep))
133 if(w_deathtype & HITTYPE_SECONDARY)
134 return WEAPON_BLASTER_MURDER;
136 return WEAPON_SHOTGUN_MURDER;
143 METHOD(OverkillShotgun, wr_impacteffect, void(entity thiswep, entity actor))
145 vector org2 = w_org + w_backoff * 2;
146 pointparticles(EFFECT_SHOTGUN_IMPACT, org2, w_backoff * 1000, 1);
147 if(!w_issilent && time - actor.prevric > 0.25)
150 sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
151 actor.prevric = time;