3 /* WEP_##id */ VAPORIZER,
4 /* function */ W_Vaporizer,
5 /* ammotype */ ammo_cells,
7 /* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
8 /* rating */ BOT_PICKUP_RATING_HIGH,
10 /* modelname */ "minstanex",
11 /* simplemdl */ "foobar",
12 /* crosshair */ "gfx/crosshairminstanex 0.6",
13 /* wepimg */ "weaponminstanex",
14 /* refname */ "vaporizer",
15 /* wepname */ _("Vaporizer")
18 #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
19 #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
20 w_cvar(id, sn, PRI, ammo) \
21 w_cvar(id, sn, PRI, animtime) \
22 w_cvar(id, sn, PRI, damage) \
23 w_cvar(id, sn, PRI, refire) \
24 w_cvar(id, sn, SEC, ammo) \
25 w_cvar(id, sn, SEC, animtime) \
26 w_cvar(id, sn, SEC, damage) \
27 w_cvar(id, sn, SEC, delay) \
28 w_cvar(id, sn, SEC, edgedamage) \
29 w_cvar(id, sn, SEC, force) \
30 w_cvar(id, sn, SEC, lifetime) \
31 w_cvar(id, sn, SEC, radius) \
32 w_cvar(id, sn, SEC, refire) \
33 w_cvar(id, sn, SEC, shotangle) \
34 w_cvar(id, sn, SEC, speed) \
35 w_cvar(id, sn, SEC, spread) \
36 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
37 w_prop(id, sn, float, reloading_time, reload_time) \
38 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
39 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
40 w_prop(id, sn, string, weaponreplace, weaponreplace) \
41 w_prop(id, sn, float, weaponstart, weaponstart) \
42 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
43 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
46 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
47 .float vaporizer_lasthit;
49 .float jump_interval2;
58 void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
59 void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
61 void W_RocketMinsta_Explosion(vector loc)
63 if(accuracy_canbegooddamage(self))
64 accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
65 entity dmgent = spawn();
66 dmgent.owner = dmgent.realowner = self;
67 setorigin(dmgent, loc);
68 RadiusDamage (dmgent, self, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, world, world, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other);
72 void W_Vaporizer_Attack(void)
74 bool flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
75 float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
77 W_SetupShot(self, true, 0, "", CH_WEAPON_A, vaporizer_damage);
78 // handle sound separately so we can change the volume
79 // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
80 sound (self, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
84 FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
87 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
88 if(damage_goodhits && self.vaporizer_lasthit)
90 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
91 damage_goodhits = 0; // only every second time
94 self.vaporizer_lasthit = damage_goodhits;
96 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
98 // teamcolor / hit beam effect
99 vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
100 Send_Effect((damage_goodhits ? EFFECT_VAPORIZER_HIT(self.team) : EFFECT_VAPORIZER(self.team)), w_shotorg, v, 1);
103 if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
104 W_RocketMinsta_Explosion(trace_endpos);
106 W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
109 void W_RocketMinsta_Laser_Explode (void)
111 if(other.takedamage == DAMAGE_AIM)
113 if(DIFF_TEAM(self.realowner, other))
114 if(other.deadflag == DEAD_NO)
116 Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
118 self.event_damage = func_null;
119 self.takedamage = DAMAGE_NO;
120 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
124 void W_RocketMinsta_Laser_Touch (void)
127 //W_RocketMinsta_Laser_Explode ();
128 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
132 void W_RocketMinsta_Attack2(void)
134 makevectors(self.v_angle);
138 float total = autocvar_g_rm_laser_count;
139 float spread = autocvar_g_rm_laser_spread;
140 float rndspread = autocvar_g_rm_laser_spread_random;
142 float w = self.weapon;
143 self.weapon = WEP_ELECTRO.m_id;
144 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage);
147 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
149 while(counter < total)
152 proj.classname = "plasma_prim";
153 proj.owner = proj.realowner = self;
154 proj.bot_dodge = true;
155 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
156 proj.use = W_RocketMinsta_Laser_Explode;
157 proj.think = adaptor_think2use_hittype_splash;
158 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
159 PROJECTILE_MAKETRIGGER(proj);
160 proj.projectiledeathtype = WEP_ELECTRO.m_id;
161 setorigin(proj, w_shotorg);
163 proj.rm_force = autocvar_g_rm_laser_force / total;
164 proj.rm_damage = autocvar_g_rm_laser_damage / total;
165 proj.rm_edmg = proj.rm_damage;
167 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
169 proj.movetype = MOVETYPE_BOUNCEMISSILE;
170 //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
171 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
172 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
173 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
174 proj.angles = vectoangles(proj.velocity);
175 proj.touch = W_RocketMinsta_Laser_Touch;
176 setsize(proj, '0 0 -3', '0 0 -3');
177 proj.flags = FL_PROJECTILE;
178 proj.missile_flags = MIF_SPLASH;
180 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
182 MUTATOR_CALLHOOK(EditProjectile, self, proj);
187 void W_RocketMinsta_Attack3 (void)
189 makevectors(self.v_angle);
196 self.weapon = WEP_ELECTRO.m_id;
197 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage);
200 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
202 while(counter < total)
205 proj.classname = "plasma_prim";
206 proj.owner = proj.realowner = self;
207 proj.bot_dodge = true;
208 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
209 proj.use = W_RocketMinsta_Laser_Explode;
210 proj.think = adaptor_think2use_hittype_splash;
211 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
212 PROJECTILE_MAKETRIGGER(proj);
213 proj.projectiledeathtype = WEP_ELECTRO.m_id;
214 setorigin(proj, w_shotorg);
216 proj.rm_force = autocvar_g_rm_laser_force / total;
217 proj.rm_damage = autocvar_g_rm_laser_damage / total;
218 proj.rm_edmg = proj.rm_damage;
220 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
222 proj.movetype = MOVETYPE_BOUNCEMISSILE;
223 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
224 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
225 proj.angles = vectoangles(proj.velocity);
226 proj.touch = W_RocketMinsta_Laser_Touch;
227 setsize(proj, '0 0 -3', '0 0 -3');
228 proj.flags = FL_PROJECTILE;
229 proj.missile_flags = MIF_SPLASH;
231 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
233 MUTATOR_CALLHOOK(EditProjectile, self, proj);
238 float W_Vaporizer(entity thiswep, float req)
241 float vaporizer_ammo;
242 float rapid = autocvar_g_rm_laser_rapid;
244 // now multiple WR_s use this
245 vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
251 if(self.WEP_AMMO(VAPORIZER) > 0)
252 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
254 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
260 // if the laser uses load, we also consider its ammo for reloading
261 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
262 _WEP_ACTION(self.weapon, WR_RELOAD);
263 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
264 _WEP_ACTION(self.weapon, WR_RELOAD);
265 if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
267 if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
269 W_Vaporizer_Attack();
270 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
273 if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
275 if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
277 if(self.jump_interval <= time && !self.held_down)
280 self.held_down = true;
281 self.jump_interval = time + autocvar_g_rm_laser_refire;
282 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
284 W_RocketMinsta_Attack2();
286 else if(rapid && self.jump_interval2 <= time && self.held_down)
288 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
290 W_RocketMinsta_Attack3();
291 //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
294 else if (self.jump_interval <= time)
296 // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
297 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
299 // decrease ammo for the laser?
300 if(WEP_CVAR_SEC(vaporizer, ammo))
301 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
303 // ugly instagib hack to reuse the fire mode of the laser
304 makevectors(self.v_angle);
305 int oldwep = self.weapon; // we can't avoid this hack
306 self.weapon = WEP_BLASTER.m_id;
308 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
309 WEP_CVAR_SEC(vaporizer, shotangle),
310 WEP_CVAR_SEC(vaporizer, damage),
311 WEP_CVAR_SEC(vaporizer, edgedamage),
312 WEP_CVAR_SEC(vaporizer, radius),
313 WEP_CVAR_SEC(vaporizer, force),
314 WEP_CVAR_SEC(vaporizer, speed),
315 WEP_CVAR_SEC(vaporizer, spread),
316 WEP_CVAR_SEC(vaporizer, delay),
317 WEP_CVAR_SEC(vaporizer, lifetime)
319 self.weapon = oldwep;
321 // now do normal refire
322 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
326 self.held_down = false;
332 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
333 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
338 self.ammo_field = WEP_AMMO(VAPORIZER);
339 self.vaporizer_lasthit = 0;
344 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
345 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
350 if(!WEP_CVAR_SEC(vaporizer, ammo))
352 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
353 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
358 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
363 self.vaporizer_lasthit = 0;
369 if(WEP_CVAR_SEC(vaporizer, ammo))
370 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
372 used_ammo = vaporizer_ammo;
374 W_Reload(used_ammo, SND(RELOAD));
377 case WR_SUICIDEMESSAGE:
379 return WEAPON_THINKING_WITH_PORTALS;
383 return WEAPON_VAPORIZER_MURDER;
390 float W_Vaporizer(entity thiswep, float req)
394 case WR_IMPACTEFFECT:
396 vector org2 = w_org + w_backoff * 6;
397 if(w_deathtype & HITTYPE_SECONDARY)
399 pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
400 if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
404 pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
405 if(!w_issilent) { sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
411 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
413 precache_pic("gfx/reticle_nex");
419 if(button_zoom || zoomscript_caught)
421 reticle_image = "gfx/reticle_nex";
426 // no weapon specific image for this weapon