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, W_Sound("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
100 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
103 case NUM_TEAM_1: // Red
105 Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1);
107 Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1);
109 case NUM_TEAM_2: // Blue
111 Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1);
113 Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1);
115 case NUM_TEAM_3: // Yellow
117 Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1);
119 Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1);
121 case NUM_TEAM_4: // Pink
123 Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1);
125 Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1);
129 Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1);
131 Send_Effect_("TE_TEI_G3", w_shotorg, v, 1);
136 if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
137 W_RocketMinsta_Explosion(trace_endpos);
139 W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
142 void W_RocketMinsta_Laser_Explode (void)
144 if(other.takedamage == DAMAGE_AIM)
146 if(DIFF_TEAM(self.realowner, other))
147 if(other.deadflag == DEAD_NO)
149 Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
151 self.event_damage = func_null;
152 self.takedamage = DAMAGE_NO;
153 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
157 void W_RocketMinsta_Laser_Touch (void)
160 //W_RocketMinsta_Laser_Explode ();
161 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
165 void W_RocketMinsta_Attack2(void)
167 makevectors(self.v_angle);
171 float total = autocvar_g_rm_laser_count;
172 float spread = autocvar_g_rm_laser_spread;
173 float rndspread = autocvar_g_rm_laser_spread_random;
175 float w = self.weapon;
176 self.weapon = WEP_ELECTRO.m_id;
177 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
180 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
182 while(counter < total)
185 proj.classname = "plasma_prim";
186 proj.owner = proj.realowner = self;
187 proj.bot_dodge = true;
188 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
189 proj.use = W_RocketMinsta_Laser_Explode;
190 proj.think = adaptor_think2use_hittype_splash;
191 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
192 PROJECTILE_MAKETRIGGER(proj);
193 proj.projectiledeathtype = WEP_ELECTRO.m_id;
194 setorigin(proj, w_shotorg);
196 proj.rm_force = autocvar_g_rm_laser_force / total;
197 proj.rm_damage = autocvar_g_rm_laser_damage / total;
198 proj.rm_edmg = proj.rm_damage;
200 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
202 proj.movetype = MOVETYPE_BOUNCEMISSILE;
203 //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
204 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
205 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
206 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
207 proj.angles = vectoangles(proj.velocity);
208 proj.touch = W_RocketMinsta_Laser_Touch;
209 setsize(proj, '0 0 -3', '0 0 -3');
210 proj.flags = FL_PROJECTILE;
211 proj.missile_flags = MIF_SPLASH;
213 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
215 MUTATOR_CALLHOOK(EditProjectile, self, proj);
220 void W_RocketMinsta_Attack3 (void)
222 makevectors(self.v_angle);
229 self.weapon = WEP_ELECTRO.m_id;
230 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("electro_fire2"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
233 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
235 while(counter < total)
238 proj.classname = "plasma_prim";
239 proj.owner = proj.realowner = self;
240 proj.bot_dodge = true;
241 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
242 proj.use = W_RocketMinsta_Laser_Explode;
243 proj.think = adaptor_think2use_hittype_splash;
244 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
245 PROJECTILE_MAKETRIGGER(proj);
246 proj.projectiledeathtype = WEP_ELECTRO.m_id;
247 setorigin(proj, w_shotorg);
249 proj.rm_force = autocvar_g_rm_laser_force / total;
250 proj.rm_damage = autocvar_g_rm_laser_damage / total;
251 proj.rm_edmg = proj.rm_damage;
253 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
255 proj.movetype = MOVETYPE_BOUNCEMISSILE;
256 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
257 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
258 proj.angles = vectoangles(proj.velocity);
259 proj.touch = W_RocketMinsta_Laser_Touch;
260 setsize(proj, '0 0 -3', '0 0 -3');
261 proj.flags = FL_PROJECTILE;
262 proj.missile_flags = MIF_SPLASH;
264 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
266 MUTATOR_CALLHOOK(EditProjectile, self, proj);
271 float W_Vaporizer(float req)
274 float vaporizer_ammo;
275 float rapid = autocvar_g_rm_laser_rapid;
277 // now multiple WR_s use this
278 vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
284 if(self.WEP_AMMO(VAPORIZER) > 0)
285 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
287 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
293 // if the laser uses load, we also consider its ammo for reloading
294 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
295 WEP_ACTION(self.weapon, WR_RELOAD);
296 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
297 WEP_ACTION(self.weapon, WR_RELOAD);
298 if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
300 if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
302 W_Vaporizer_Attack();
303 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
306 if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
308 if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
310 if(self.jump_interval <= time && !self.held_down)
313 self.held_down = true;
314 self.jump_interval = time + autocvar_g_rm_laser_refire;
315 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
317 W_RocketMinsta_Attack2();
319 else if(rapid && self.jump_interval2 <= time && self.held_down)
321 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
323 W_RocketMinsta_Attack3();
324 //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
327 else if (self.jump_interval <= time)
329 // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
330 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
332 // decrease ammo for the laser?
333 if(WEP_CVAR_SEC(vaporizer, ammo))
334 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
336 // ugly instagib hack to reuse the fire mode of the laser
337 makevectors(self.v_angle);
338 int oldwep = self.weapon; // we can't avoid this hack
339 self.weapon = WEP_BLASTER.m_id;
341 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
342 WEP_CVAR_SEC(vaporizer, shotangle),
343 WEP_CVAR_SEC(vaporizer, damage),
344 WEP_CVAR_SEC(vaporizer, edgedamage),
345 WEP_CVAR_SEC(vaporizer, radius),
346 WEP_CVAR_SEC(vaporizer, force),
347 WEP_CVAR_SEC(vaporizer, speed),
348 WEP_CVAR_SEC(vaporizer, spread),
349 WEP_CVAR_SEC(vaporizer, delay),
350 WEP_CVAR_SEC(vaporizer, lifetime)
352 self.weapon = oldwep;
354 // now do normal refire
355 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
359 self.held_down = false;
365 precache_sound(W_Sound("minstanexfire"));
366 precache_sound(W_Sound("nexwhoosh1"));
367 precache_sound(W_Sound("nexwhoosh2"));
368 precache_sound(W_Sound("nexwhoosh3"));
369 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
370 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
375 self.ammo_field = WEP_AMMO(VAPORIZER);
376 self.vaporizer_lasthit = 0;
381 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
382 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
387 if(!WEP_CVAR_SEC(vaporizer, ammo))
389 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
390 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
395 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
400 self.vaporizer_lasthit = 0;
406 if(WEP_CVAR_SEC(vaporizer, ammo))
407 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
409 used_ammo = vaporizer_ammo;
411 W_Reload(used_ammo, W_Sound("reload"));
414 case WR_SUICIDEMESSAGE:
416 return WEAPON_THINKING_WITH_PORTALS;
420 return WEAPON_VAPORIZER_MURDER;
427 float W_Vaporizer(float req)
431 case WR_IMPACTEFFECT:
433 vector org2 = w_org + w_backoff * 6;
434 if(w_deathtype & HITTYPE_SECONDARY)
436 pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
437 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); }
441 pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
442 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); }
448 precache_sound(W_Sound("laserimpact"));
449 precache_sound(W_Sound("neximpact"));
450 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
452 precache_pic("gfx/reticle_nex");
458 if(button_zoom || zoomscript_caught)
460 reticle_image = "gfx/reticle_nex";
465 // no weapon specific image for this weapon