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.4",
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;
51 void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER); }
52 void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
54 void W_Vaporizer_Attack(void)
57 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
59 W_SetupShot(self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
63 FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER);
66 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
67 if(damage_goodhits && self.vaporizer_lasthit)
69 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
70 damage_goodhits = 0; // only every second time
73 self.vaporizer_lasthit = damage_goodhits;
75 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
77 // teamcolor / hit beam effect
79 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
82 case NUM_TEAM_1: // Red
84 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
86 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
88 case NUM_TEAM_2: // Blue
90 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
92 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
94 case NUM_TEAM_3: // Yellow
96 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
98 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
100 case NUM_TEAM_4: // Pink
102 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
104 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
108 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
110 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
114 W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
117 float W_Vaporizer(float req)
120 float vaporizer_ammo;
122 // now multiple WR_s use this
123 vaporizer_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
129 if(self.WEP_AMMO(VAPORIZER) > 0)
130 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
132 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), FALSE); // WEAPONTODO: replace with proper vaporizer cvars
138 // if the laser uses load, we also consider its ammo for reloading
139 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
140 WEP_ACTION(self.weapon, WR_RELOAD);
141 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
142 WEP_ACTION(self.weapon, WR_RELOAD);
143 else if(self.BUTTON_ATCK)
145 if(weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
147 W_Vaporizer_Attack();
148 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
151 else if(self.BUTTON_ATCK2)
153 if(self.jump_interval <= time)
154 if(weapon_prepareattack(1, -1))
156 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
157 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
159 // decrease ammo for the laser?
160 if(WEP_CVAR_SEC(vaporizer, ammo))
161 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
163 // ugly minstagib hack to reuse the fire mode of the laser
165 WEP_VAPORIZER | HITTYPE_SECONDARY,
166 WEP_CVAR_SEC(vaporizer, shotangle),
167 WEP_CVAR_SEC(vaporizer, damage),
168 WEP_CVAR_SEC(vaporizer, edgedamage),
169 WEP_CVAR_SEC(vaporizer, radius),
170 WEP_CVAR_SEC(vaporizer, force),
171 WEP_CVAR_SEC(vaporizer, speed),
172 WEP_CVAR_SEC(vaporizer, spread),
173 WEP_CVAR_SEC(vaporizer, delay),
174 WEP_CVAR_SEC(vaporizer, lifetime)
177 // now do normal refire
178 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
186 precache_model("models/nexflash.md3");
187 precache_model("models/weapons/g_minstanex.md3");
188 precache_model("models/weapons/v_minstanex.md3");
189 precache_model("models/weapons/h_minstanex.iqm");
190 precache_sound("weapons/minstanexfire.wav");
191 precache_sound("weapons/nexwhoosh1.wav");
192 precache_sound("weapons/nexwhoosh2.wav");
193 precache_sound("weapons/nexwhoosh3.wav");
194 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
195 VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
200 self.ammo_field = WEP_AMMO(VAPORIZER);
201 self.vaporizer_lasthit = 0;
206 ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
207 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= vaporizer_ammo;
212 if(!WEP_CVAR_SEC(vaporizer, ammo))
214 ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
215 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
220 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
225 self.vaporizer_lasthit = 0;
231 if(WEP_CVAR_SEC(vaporizer, ammo))
232 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
234 used_ammo = vaporizer_ammo;
236 W_Reload(used_ammo, "weapons/reload.wav");
239 case WR_SUICIDEMESSAGE:
241 return WEAPON_THINKING_WITH_PORTALS;
245 return WEAPON_VAPORIZER_MURDER;
252 float W_Vaporizer(float req)
256 case WR_IMPACTEFFECT:
259 org2 = w_org + w_backoff * 6;
260 if(w_deathtype & HITTYPE_SECONDARY)
262 pointparticles(particleeffectnum("laser_impact"), org2, w_backoff * 1000, 1);
263 if(!w_issilent) { sound(self, CH_SHOTS, "weapons/laserimpact.wav", VOL_BASE, ATTN_NORM); }
267 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
268 if(!w_issilent) { sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM); }
274 precache_sound("weapons/laserimpact.wav");
275 precache_sound("weapons/neximpact.wav");
276 if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
278 precache_pic("gfx/reticle_nex");
284 if(button_zoom || zoomscript_caught)
286 reticle_image = "gfx/reticle_nex";
291 // no weapon specific image for this weapon