4 spawnfunc(weapon_rpc) { weapon_defaultspawnfunc(this, WEP_RPC); }
6 void W_RocketPropelledChainsaw_Explode(entity this, entity directhitentity)
8 this.event_damage = func_null;
9 this.takedamage = DAMAGE_NO;
11 RadiusDamage (this, this.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), NULL, NULL, WEP_CVAR(rpc, force), this.projectiledeathtype, directhitentity);
16 void W_RocketPropelledChainsaw_Explode_think(entity this)
18 W_RocketPropelledChainsaw_Explode(this, NULL);
21 void W_RocketPropelledChainsaw_Touch (entity this, entity toucher)
23 if(WarpZone_Projectile_Touch(this, toucher))
27 W_RocketPropelledChainsaw_Explode(this, toucher);
30 void W_RocketPropelledChainsaw_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
35 if (!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1)) // no exceptions
36 return; // g_projectiles_damage says to halt
38 this.health = this.health - damage;
41 W_PrepareExplosionByDamage(this, attacker, W_RocketPropelledChainsaw_Explode_think);
44 void W_RocketPropelledChainsaw_Think(entity this)
52 this.cnt = vlen(this.velocity);
53 this.wait = this.cnt * sys_frametime;
54 this.pos1 = normalize(this.velocity);
56 tracebox(this.origin, this.mins, this.maxs, this.origin + this.pos1 * (2 * this.wait), MOVE_NORMAL, this);
57 if(IS_PLAYER(trace_ent))
58 Damage (trace_ent, this, this.realowner, WEP_CVAR(rpc, damage2), this.projectiledeathtype, this.origin, normalize(this.origin - other.origin) * WEP_CVAR(rpc, force));
60 this.velocity = this.pos1 * (this.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
62 UpdateCSQCProjectile(this);
63 this.nextthink = time;
66 void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor, .entity weaponentity)
68 entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(actor);
69 entity flash = spawn ();
71 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo));
72 W_SetupShot_ProjectileSize (actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage));
73 Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
74 PROJECTILE_MAKETRIGGER(missile);
76 missile.owner = missile.realowner = actor;
77 missile.bot_dodge = true;
78 missile.bot_dodgerating = WEP_CVAR(rpc, damage) * 2;
80 missile.takedamage = DAMAGE_YES;
81 missile.damageforcescale = WEP_CVAR(rpc, damageforcescale);
82 missile.health = WEP_CVAR(rpc, health);
83 missile.event_damage = W_RocketPropelledChainsaw_Damage;
84 missile.damagedbycontents = true;
85 set_movetype(missile, MOVETYPE_FLY);
87 missile.projectiledeathtype = WEP_RPC.m_id;
88 setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
90 setorigin(missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
91 W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
93 settouch(missile, W_RocketPropelledChainsaw_Touch);
95 setthink(missile, W_RocketPropelledChainsaw_Think);
96 missile.cnt = time + WEP_CVAR(rpc, lifetime);
97 missile.nextthink = time;
98 missile.flags = FL_PROJECTILE;
99 IL_PUSH(g_projectiles, missile);
101 CSQCProjectile(missile, true, PROJECTILE_RPC, false);
103 setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below
104 SUB_SetFade (flash, time, 0.1);
105 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
106 W_AttachToShotorg(actor, weaponentity, flash, '5 0 0');
107 missile.pos1 = missile.velocity;
109 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
112 METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor))
114 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
117 METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
119 if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
120 thiswep.wr_reload(thiswep, actor, weaponentity);
125 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire)))
127 W_RocketPropelledChainsaw_Attack(thiswep, actor, weaponentity);
128 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
139 METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep, entity actor))
141 float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
142 ammo_amount += actor.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
146 METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor))
151 METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
153 W_Reload(actor, weaponentity, WEP_CVAR(rpc, ammo), SND_RELOAD);
156 METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep))
158 if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
159 return WEAPON_RPC_SUICIDE_SPLASH;
161 return WEAPON_RPC_SUICIDE_DIRECT;
164 METHOD(RocketPropelledChainsaw, wr_killmessage, Notification(entity thiswep))
166 if(w_deathtype & HITTYPE_SECONDARY)
167 return WEAPON_BLASTER_MURDER;
168 else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
169 return WEAPON_RPC_MURDER_SPLASH;
171 return WEAPON_RPC_MURDER_DIRECT;
178 METHOD(RocketPropelledChainsaw, wr_impacteffect, void(entity thiswep, entity actor))
181 org2 = w_org + w_backoff * 12;
182 pointparticles(EFFECT_ROCKET_EXPLODE, org2, '0 0 0', 1);
184 sound(actor, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);