5 void W_OverkillRocketPropelledChainsaw_Explode(entity this, entity directhitentity)
7 this.event_damage = func_null;
8 this.takedamage = DAMAGE_NO;
10 RadiusDamage(this, this.realowner, WEP_CVAR_PRI(okrpc, damage), WEP_CVAR_PRI(okrpc, edgedamage), WEP_CVAR_PRI(okrpc, radius), NULL, NULL, WEP_CVAR_PRI(okrpc, force), this.projectiledeathtype, this.weaponentity_fld, directhitentity);
15 void W_OverkillRocketPropelledChainsaw_Explode_think(entity this)
17 W_OverkillRocketPropelledChainsaw_Explode(this, NULL);
20 void W_OverkillRocketPropelledChainsaw_Touch (entity this, entity toucher)
22 if(WarpZone_Projectile_Touch(this, toucher))
26 W_OverkillRocketPropelledChainsaw_Explode(this, toucher);
29 void W_OverkillRocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, .entity weaponentity, vector hitloc, vector force)
34 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
35 return; // g_projectiles_damage says to halt
37 this.health = this.health - damage;
40 W_PrepareExplosionByDamage(this, attacker, W_OverkillRocketPropelledChainsaw_Explode_think);
43 void W_OverkillRocketPropelledChainsaw_Think(entity this)
51 float myspeed = vlen(this.velocity);
52 float myspeed_accel = myspeed * sys_frametime;
53 vector mydir = normalize(this.velocity);
55 tracebox(this.origin, this.mins, this.maxs, this.origin + mydir * (2 * myspeed_accel), MOVE_NORMAL, this);
56 if(IS_PLAYER(trace_ent))
57 Damage(trace_ent, this, this.realowner, WEP_CVAR_PRI(okrpc, damage2), this.projectiledeathtype, this.weaponentity_fld, this.origin, normalize(this.origin - trace_ent.origin) * WEP_CVAR_PRI(okrpc, force));
59 this.velocity = mydir * (myspeed + (WEP_CVAR_PRI(okrpc, speedaccel) * sys_frametime));
61 UpdateCSQCProjectile(this);
62 this.nextthink = time;
65 void W_OverkillRocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity weaponentity)
67 entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor);
68 entity flash = spawn ();
70 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(okrpc, ammo), weaponentity);
71 W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okrpc, damage), WEP_OVERKILL_RPC.m_id);
72 Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
73 PROJECTILE_MAKETRIGGER(missile);
75 missile.owner = missile.realowner = actor;
76 missile.bot_dodge = true;
77 missile.bot_dodgerating = WEP_CVAR_PRI(okrpc, damage) * 2;
79 missile.takedamage = DAMAGE_YES;
80 missile.damageforcescale = WEP_CVAR_PRI(okrpc, damageforcescale);
81 missile.health = WEP_CVAR_PRI(okrpc, health);
82 missile.event_damage = W_OverkillRocketPropelledChainsaw_Damage;
83 missile.damagedbycontents = true;
84 IL_PUSH(g_damagedbycontents, missile);
85 set_movetype(missile, MOVETYPE_FLY);
87 missile.projectiledeathtype = WEP_OVERKILL_RPC.m_id;
88 missile.weaponentity_fld = weaponentity;
89 setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
91 setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
92 W_SetupProjVelocity_Basic(missile, WEP_CVAR_PRI(okrpc, speed), 0);
94 settouch(missile, W_OverkillRocketPropelledChainsaw_Touch);
96 setthink(missile, W_OverkillRocketPropelledChainsaw_Think);
97 missile.cnt = time + WEP_CVAR_PRI(okrpc, lifetime);
98 missile.nextthink = time;
99 missile.flags = FL_PROJECTILE;
100 IL_PUSH(g_projectiles, missile);
101 IL_PUSH(g_bot_dodge, missile);
103 CSQCProjectile(missile, true, PROJECTILE_RPC, false);
105 setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below
106 SUB_SetFade (flash, time, 0.1);
107 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
108 W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
110 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
113 METHOD(OverkillRocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
115 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, WEP_CVAR_PRI(okrpc, speed), 0, WEP_CVAR_PRI(okrpc, lifetime), false);
118 METHOD(OverkillRocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
120 if ((WEP_CVAR_SEC(okrpc, refire_type) == 1) && (fire & 2) && (time >= actor.jump_interval))
122 // Secondary uses it's own refire timer if refire_type is 1.
123 actor.jump_interval = time + WEP_CVAR_SEC(okrpc, refire) * W_WeaponRateFactor(actor);
124 BLASTER_SECONDARY_ATTACK(okrpc, actor, weaponentity);
125 if ((actor.(weaponentity).wframe == WFRAME_IDLE) ||
126 (actor.(weaponentity).wframe == WFRAME_FIRE2))
128 // Set secondary fire animation.
130 actor.(weaponentity).wframe = WFRAME_FIRE2;
131 a = actor.(weaponentity).anim_fire2;
132 a.z *= g_weaponratefactor;
133 FOREACH_CLIENT(true, LAMBDA(
134 if (it == actor || (IS_SPEC(it) && it.enemy == actor))
136 wframe_send(it, actor.(weaponentity), a, true);
139 animdecide_setaction(actor, ANIMACTION_SHOOT, true);
142 if (WEP_CVAR(okrpc, reload_ammo) && actor.(weaponentity).clip_load < WEP_CVAR_PRI(okrpc, ammo))
145 thiswep.wr_reload(thiswep, actor, weaponentity);
148 if (fire & 1) // Primary attack
150 if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(okrpc, refire)))
154 W_OverkillRocketPropelledChainsaw_Attack(thiswep, actor, weaponentity);
155 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(okrpc, animtime), w_ready);
158 if ((fire & 2) && (WEP_CVAR_SEC(okrpc, refire_type) == 0)) // Secondary attack
160 if (!weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_SEC(okrpc, refire)))
164 BLASTER_SECONDARY_ATTACK(okrpc, actor, weaponentity);
165 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(okrpc, animtime), w_ready);
169 METHOD(OverkillRocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
171 float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_PRI(okrpc, ammo);
172 ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_RPC.m_id]) >= WEP_CVAR_PRI(okrpc, ammo);
176 METHOD(OverkillRocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
178 float ammo_amount = GetResourceAmount(actor, thiswep.ammo_type) >= WEP_CVAR_SEC(okrpc, ammo);
179 ammo_amount += actor.(weaponentity).(weapon_load[WEP_OVERKILL_RPC.m_id]) >= WEP_CVAR_SEC(okrpc, ammo);
183 METHOD(OverkillRocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
185 W_Reload(actor, weaponentity, WEP_CVAR_PRI(okrpc, ammo), SND_RELOAD);
188 METHOD(OverkillRocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
190 if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
191 return WEAPON_OVERKILL_RPC_SUICIDE_SPLASH;
193 return WEAPON_OVERKILL_RPC_SUICIDE_DIRECT;
196 METHOD(OverkillRocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
198 if(w_deathtype & HITTYPE_SECONDARY)
199 return WEAPON_BLASTER_MURDER;
200 else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
201 return WEAPON_OVERKILL_RPC_MURDER_SPLASH;
203 return WEAPON_OVERKILL_RPC_MURDER_DIRECT;
210 METHOD(OverkillRocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor))
213 org2 = w_org + w_backoff * 12;
214 pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
216 sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);