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, refire) \
23 w_cvar(id, sn, SEC, ammo) \
24 w_cvar(id, sn, SEC, animtime) \
25 w_cvar(id, sn, SEC, damage) \
26 w_cvar(id, sn, SEC, delay) \
27 w_cvar(id, sn, SEC, edgedamage) \
28 w_cvar(id, sn, SEC, force) \
29 w_cvar(id, sn, SEC, lifetime) \
30 w_cvar(id, sn, SEC, radius) \
31 w_cvar(id, sn, SEC, refire) \
32 w_cvar(id, sn, SEC, shotangle) \
33 w_cvar(id, sn, SEC, speed) \
34 w_cvar(id, sn, SEC, spread) \
35 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
36 w_prop(id, sn, float, reloading_time, reload_time) \
37 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
38 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
39 w_prop(id, sn, string, weaponreplace, weaponreplace) \
40 w_prop(id, sn, float, weaponstart, weaponstart) \
41 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
42 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
45 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
46 .float vaporizer_lasthit;
48 .float jump_interval2;
57 void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_id); }
58 void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
60 void W_RocketMinsta_Explosion(vector loc)
62 if(accuracy_canbegooddamage(self))
63 accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
64 entity dmgent = spawn();
65 dmgent.owner = dmgent.realowner = self;
66 setorigin(dmgent, loc);
67 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);
71 void W_Vaporizer_Attack(void)
74 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
76 W_SetupShot(self, true, 0, "", CH_WEAPON_A, 10000);
77 // handle sound separately so we can change the volume
78 // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
79 sound (self, CH_WEAPON_A, W_Sound("minstanexfire"), VOL_BASE * 0.8, ATTEN_NORM);
83 FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
86 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
87 if(damage_goodhits && self.vaporizer_lasthit)
89 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
90 damage_goodhits = 0; // only every second time
93 self.vaporizer_lasthit = damage_goodhits;
95 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
97 // teamcolor / hit beam effect
99 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
102 case NUM_TEAM_1: // Red
104 Send_Effect(EFFECT_VAPORIZER_RED_HIT, w_shotorg, v, 1);
106 Send_Effect(EFFECT_VAPORIZER_RED, w_shotorg, v, 1);
108 case NUM_TEAM_2: // Blue
110 Send_Effect(EFFECT_VAPORIZER_BLUE_HIT, w_shotorg, v, 1);
112 Send_Effect(EFFECT_VAPORIZER_BLUE, w_shotorg, v, 1);
114 case NUM_TEAM_3: // Yellow
116 Send_Effect(EFFECT_VAPORIZER_YELLOW_HIT, w_shotorg, v, 1);
118 Send_Effect(EFFECT_VAPORIZER_YELLOW, w_shotorg, v, 1);
120 case NUM_TEAM_4: // Pink
122 Send_Effect(EFFECT_VAPORIZER_PINK_HIT, w_shotorg, v, 1);
124 Send_Effect(EFFECT_VAPORIZER_PINK, w_shotorg, v, 1);
128 Send_Effect_("TE_TEI_G3_HIT", w_shotorg, v, 1);
130 Send_Effect_("TE_TEI_G3", w_shotorg, v, 1);
135 if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
136 W_RocketMinsta_Explosion(trace_endpos);
138 W_DecreaseAmmo(((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
141 void W_RocketMinsta_Laser_Explode (void)
143 if(other.takedamage == DAMAGE_AIM)
145 if(DIFF_TEAM(self.realowner, other))
146 if(other.deadflag == DEAD_NO)
148 Send_Notification(NOTIF_ONE, self.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
150 self.event_damage = func_null;
151 self.takedamage = DAMAGE_NO;
152 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
156 void W_RocketMinsta_Laser_Touch (void)
159 //W_RocketMinsta_Laser_Explode ();
160 RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
164 void W_RocketMinsta_Attack2(void)
166 makevectors(self.v_angle);
170 float total = autocvar_g_rm_laser_count;
171 float spread = autocvar_g_rm_laser_spread;
172 float rndspread = autocvar_g_rm_laser_spread_random;
174 float w = self.weapon;
175 self.weapon = WEP_ELECTRO.m_id;
176 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("crylink_fire"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
179 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
181 while(counter < total)
184 proj.classname = "plasma_prim";
185 proj.owner = proj.realowner = self;
186 proj.bot_dodge = true;
187 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
188 proj.use = W_RocketMinsta_Laser_Explode;
189 proj.think = adaptor_think2use_hittype_splash;
190 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
191 PROJECTILE_MAKETRIGGER(proj);
192 proj.projectiledeathtype = WEP_ELECTRO.m_id;
193 setorigin(proj, w_shotorg);
195 proj.rm_force = autocvar_g_rm_laser_force / total;
196 proj.rm_damage = autocvar_g_rm_laser_damage / total;
197 proj.rm_edmg = proj.rm_damage;
199 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
201 proj.movetype = MOVETYPE_BOUNCEMISSILE;
202 //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
203 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
204 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
205 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
206 proj.angles = vectoangles(proj.velocity);
207 proj.touch = W_RocketMinsta_Laser_Touch;
208 setsize(proj, '0 0 -3', '0 0 -3');
209 proj.flags = FL_PROJECTILE;
210 proj.missile_flags = MIF_SPLASH;
212 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
214 MUTATOR_CALLHOOK(EditProjectile, self, proj);
219 void W_RocketMinsta_Attack3 (void)
221 makevectors(self.v_angle);
228 self.weapon = WEP_ELECTRO.m_id;
229 W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, W_Sound("electro_fire2"), CH_WEAPON_A, autocvar_g_rm_laser_damage);
232 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
234 while(counter < total)
237 proj.classname = "plasma_prim";
238 proj.owner = proj.realowner = self;
239 proj.bot_dodge = true;
240 proj.bot_dodgerating = autocvar_g_rm_laser_damage;
241 proj.use = W_RocketMinsta_Laser_Explode;
242 proj.think = adaptor_think2use_hittype_splash;
243 proj.nextthink = time + autocvar_g_rm_laser_lifetime;
244 PROJECTILE_MAKETRIGGER(proj);
245 proj.projectiledeathtype = WEP_ELECTRO.m_id;
246 setorigin(proj, w_shotorg);
248 proj.rm_force = autocvar_g_rm_laser_force / total;
249 proj.rm_damage = autocvar_g_rm_laser_damage / total;
250 proj.rm_edmg = proj.rm_damage;
252 //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
254 proj.movetype = MOVETYPE_BOUNCEMISSILE;
255 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
256 proj.velocity = W_CalculateProjectileVelocity(proj.realowner.velocity, proj.velocity, true);
257 proj.angles = vectoangles(proj.velocity);
258 proj.touch = W_RocketMinsta_Laser_Touch;
259 setsize(proj, '0 0 -3', '0 0 -3');
260 proj.flags = FL_PROJECTILE;
261 proj.missile_flags = MIF_SPLASH;
263 CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
265 MUTATOR_CALLHOOK(EditProjectile, self, proj);
270 float W_Vaporizer(float req)
273 float vaporizer_ammo;
274 float rapid = autocvar_g_rm_laser_rapid;
276 // now multiple WR_s use this
277 vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
283 if(self.WEP_AMMO(VAPORIZER) > 0)
284 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
286 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
292 // if the laser uses load, we also consider its ammo for reloading
293 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
294 WEP_ACTION(self.weapon, WR_RELOAD);
295 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
296 WEP_ACTION(self.weapon, WR_RELOAD);
297 if(self.BUTTON_ATCK && (self.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(self))
299 if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
301 W_Vaporizer_Attack();
302 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
305 if(self.BUTTON_ATCK2 || (self.BUTTON_ATCK && !self.ammo_cells && autocvar_g_rm))
307 if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
309 if(self.jump_interval <= time && !self.held_down)
312 self.held_down = true;
313 self.jump_interval = time + autocvar_g_rm_laser_refire;
314 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
316 W_RocketMinsta_Attack2();
318 else if(rapid && self.jump_interval2 <= time && self.held_down)
320 self.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
322 W_RocketMinsta_Attack3();
323 //weapon_thinkf(WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
326 else if (self.jump_interval <= time)
328 // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
329 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
331 // decrease ammo for the laser?
332 if(WEP_CVAR_SEC(vaporizer, ammo))
333 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
335 // ugly instagib hack to reuse the fire mode of the laser
336 makevectors(self.v_angle);
337 int oldwep = self.weapon; // we can't avoid this hack
338 self.weapon = WEP_BLASTER.m_id;
340 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
341 WEP_CVAR_SEC(vaporizer, shotangle),
342 WEP_CVAR_SEC(vaporizer, damage),
343 WEP_CVAR_SEC(vaporizer, edgedamage),
344 WEP_CVAR_SEC(vaporizer, radius),
345 WEP_CVAR_SEC(vaporizer, force),
346 WEP_CVAR_SEC(vaporizer, speed),
347 WEP_CVAR_SEC(vaporizer, spread),
348 WEP_CVAR_SEC(vaporizer, delay),
349 WEP_CVAR_SEC(vaporizer, lifetime)
351 self.weapon = oldwep;
353 // now do normal refire
354 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
358 self.held_down = false;
364 precache_model("models/nexflash.md3");
365 precache_model(W_Model("g_minstanex.md3"));
366 precache_model(W_Model("v_minstanex.md3"));
367 precache_model(W_Model("h_minstanex.iqm"));
368 precache_sound(W_Sound("minstanexfire"));
369 precache_sound(W_Sound("nexwhoosh1"));
370 precache_sound(W_Sound("nexwhoosh2"));
371 precache_sound(W_Sound("nexwhoosh3"));
372 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
373 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
378 self.ammo_field = WEP_AMMO(VAPORIZER);
379 self.vaporizer_lasthit = 0;
384 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
385 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
390 if(!WEP_CVAR_SEC(vaporizer, ammo))
392 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
393 ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
398 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
403 self.vaporizer_lasthit = 0;
409 if(WEP_CVAR_SEC(vaporizer, ammo))
410 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
412 used_ammo = vaporizer_ammo;
414 W_Reload(used_ammo, W_Sound("reload"));
417 case WR_SUICIDEMESSAGE:
419 return WEAPON_THINKING_WITH_PORTALS;
423 return WEAPON_VAPORIZER_MURDER;
430 float W_Vaporizer(float req)
434 case WR_IMPACTEFFECT:
436 vector org2 = w_org + w_backoff * 6;
437 if(w_deathtype & HITTYPE_SECONDARY)
439 pointparticles(particleeffectnum(EFFECT_BLASTER_IMPACT), org2, w_backoff * 1000, 1);
440 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("laserimpact"), VOL_BASE, ATTN_NORM); }
444 pointparticles(particleeffectnum(EFFECT_VORTEX_IMPACT), org2, '0 0 0', 1);
445 if(!w_issilent) { sound(self, CH_SHOTS, W_Sound("neximpact"), VOL_BASE, ATTN_NORM); }
451 precache_sound(W_Sound("laserimpact"));
452 precache_sound(W_Sound("neximpact"));
453 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
455 precache_pic("gfx/reticle_nex");
461 if(button_zoom || zoomscript_caught)
463 reticle_image = "gfx/reticle_nex";
468 // no weapon specific image for this weapon