4 /* function */ W_RocketPropelledChainsaw,
5 /* ammotype */ ammo_rockets,
7 /* flags */ WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_HIDDEN | WEP_FLAG_NORMAL | WEP_FLAG_CANCLIMB | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH | WEP_FLAG_SUPERWEAPON,
8 /* rating */ BOT_PICKUP_RATING_HIGH,
9 /* color */ '0.5 0.5 0',
10 /* modelname */ "ok_rl",
11 /* model */ MDL_RPC_ITEM,
12 /* simplemdl */ "foobar",
13 /* crosshair */ "gfx/crosshairrocketlauncher 0.7",
14 /* wepimg */ "weaponrpc",
16 /* wepname */ _("Rocket Propelled Chainsaw")
19 #define RPC_SETTINGS(w_cvar,w_prop) RPC_SETTINGS_LIST(w_cvar, w_prop, RPC, rpc)
20 #define RPC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
21 w_cvar(id, sn, NONE, ammo) \
22 w_cvar(id, sn, NONE, animtime) \
23 w_cvar(id, sn, NONE, damage) \
24 w_cvar(id, sn, NONE, damage2) \
25 w_cvar(id, sn, NONE, damageforcescale) \
26 w_cvar(id, sn, NONE, edgedamage) \
27 w_cvar(id, sn, NONE, force) \
28 w_cvar(id, sn, NONE, health) \
29 w_cvar(id, sn, NONE, lifetime) \
30 w_cvar(id, sn, NONE, radius) \
31 w_cvar(id, sn, NONE, refire) \
32 w_cvar(id, sn, NONE, speed) \
33 w_cvar(id, sn, NONE, speedaccel) \
34 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
35 w_prop(id, sn, float, reloading_time, reload_time) \
36 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
37 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
38 w_prop(id, sn, string, weaponreplace, weaponreplace) \
39 w_prop(id, sn, float, weaponstart, weaponstart) \
40 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
41 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
44 RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
49 void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC.m_id); }
51 void W_RocketPropelledChainsaw_Explode()
53 self.event_damage = func_null;
54 self.takedamage = DAMAGE_NO;
56 RadiusDamage (self, self.realowner, WEP_CVAR(rpc, damage), WEP_CVAR(rpc, edgedamage), WEP_CVAR(rpc, radius), world, world, WEP_CVAR(rpc, force), self.projectiledeathtype, other);
61 void W_RocketPropelledChainsaw_Touch (void)
63 if(WarpZone_Projectile_Touch())
67 W_RocketPropelledChainsaw_Explode();
70 void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
75 if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
76 return; // g_projectiles_damage says to halt
78 self.health = self.health - damage;
81 W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode);
84 void W_RocketPropelledChainsaw_Think()
92 self.cnt = vlen(self.velocity);
93 self.wait = self.cnt * sys_frametime;
94 self.pos1 = normalize(self.velocity);
96 tracebox(self.origin, self.mins, self.maxs, self.origin + self.pos1 * (2 * self.wait), MOVE_NORMAL, self);
97 if(IS_PLAYER(trace_ent))
98 Damage (trace_ent, self, self.realowner, WEP_CVAR(rpc, damage2), self.projectiledeathtype, self.origin, normalize(self.origin - other.origin) * WEP_CVAR(rpc, force));
100 self.velocity = self.pos1 * (self.cnt + (WEP_CVAR(rpc, speedaccel) * sys_frametime));
102 UpdateCSQCProjectile(self);
103 self.nextthink = time;
106 void W_RocketPropelledChainsaw_Attack (void)
108 entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self);
109 entity flash = spawn ();
111 W_DecreaseAmmo(WEP_CVAR(rpc, ammo));
112 W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND(ROCKET_FIRE), CH_WEAPON_A, WEP_CVAR(rpc, damage));
113 Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
114 PROJECTILE_MAKETRIGGER(missile);
116 missile.owner = missile.realowner = self;
117 missile.bot_dodge = true;
118 missile.bot_dodgerating = WEP_CVAR(rpc, damage) * 2;
120 missile.takedamage = DAMAGE_YES;
121 missile.damageforcescale = WEP_CVAR(rpc, damageforcescale);
122 missile.health = WEP_CVAR(rpc, health);
123 missile.event_damage = W_RocketPropelledChainsaw_Damage;
124 missile.damagedbycontents = true;
125 missile.movetype = MOVETYPE_FLY;
127 missile.projectiledeathtype = WEP_RPC.m_id;
128 setsize (missile, '-3 -3 -3', '3 3 3'); // give it some size so it can be shot
130 setorigin (missile, w_shotorg - v_forward * 3); // move it back so it hits the wall at the right point
131 W_SetupProjVelocity_Basic(missile, WEP_CVAR(rpc, speed), 0);
133 missile.touch = W_RocketPropelledChainsaw_Touch;
135 missile.think = W_RocketPropelledChainsaw_Think;
136 missile.cnt = time + WEP_CVAR(rpc, lifetime);
137 missile.nextthink = time;
138 missile.flags = FL_PROJECTILE;
140 CSQCProjectile(missile, true, PROJECTILE_RPC, false);
142 setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below
143 SUB_SetFade (flash, time, 0.1);
144 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
145 W_AttachToShotorg(flash, '5 0 0');
146 missile.pos1 = missile.velocity;
148 MUTATOR_CALLHOOK(EditProjectile, self, missile);
151 bool W_RocketPropelledChainsaw(entity thiswep, int req)
153 float ammo_amount = false;
158 self.BUTTON_ATCK = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false);
163 if(WEP_CVAR(rpc, reload_ammo) && self.clip_load < WEP_CVAR(rpc, ammo))
164 _WEP_ACTION(self.weapon, WR_RELOAD);
167 if (self.BUTTON_ATCK)
169 if(weapon_prepareattack(0, WEP_CVAR(rpc, refire)))
171 W_RocketPropelledChainsaw_Attack();
172 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready);
176 if (self.BUTTON_ATCK2)
186 RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
191 ammo_amount = self.WEP_AMMO(RPC) >= WEP_CVAR(rpc, ammo);
192 ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
201 RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
206 W_Reload(WEP_CVAR(rpc, ammo), SND(RELOAD));
209 case WR_SUICIDEMESSAGE:
211 if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
212 return WEAPON_RPC_SUICIDE_SPLASH;
214 return WEAPON_RPC_SUICIDE_DIRECT;
218 if(w_deathtype & HITTYPE_SECONDARY)
219 return WEAPON_BLASTER_MURDER;
220 else if((w_deathtype & HITTYPE_BOUNCE) || (w_deathtype & HITTYPE_SPLASH))
221 return WEAPON_RPC_MURDER_SPLASH;
223 return WEAPON_RPC_MURDER_DIRECT;
232 bool W_RocketPropelledChainsaw(entity thiswep, int req)
236 case WR_IMPACTEFFECT:
239 org2 = w_org + w_backoff * 12;
240 pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), org2, '0 0 0', 1);
242 sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
252 // no weapon specific image for this weapon