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,
9 /* model */ "minstanex",
10 /* netname */ "minstanex",
11 /* fullname */ _("Vaporizer")
14 #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
15 #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
16 w_cvar(id, sn, PRI, ammo) \
17 w_cvar(id, sn, PRI, animtime) \
18 w_cvar(id, sn, PRI, refire) \
19 w_cvar(id, sn, SEC, ammo) \
20 w_cvar(id, sn, SEC, animtime) \
21 w_cvar(id, sn, SEC, damage) \
22 w_cvar(id, sn, SEC, delay) \
23 w_cvar(id, sn, SEC, edgedamage) \
24 w_cvar(id, sn, SEC, force) \
25 w_cvar(id, sn, SEC, lifetime) \
26 w_cvar(id, sn, SEC, radius) \
27 w_cvar(id, sn, SEC, refire) \
28 w_cvar(id, sn, SEC, shotangle) \
29 w_cvar(id, sn, SEC, speed) \
30 w_cvar(id, sn, SEC, spread) \
31 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
32 w_prop(id, sn, float, reloading_time, reload_time) \
33 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
34 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
35 w_prop(id, sn, string, weaponreplace, weaponreplace) \
36 w_prop(id, sn, float, weaponstart, weaponstart) \
37 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
40 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
41 .float vaporizer_lasthit;
46 void spawnfunc_weapon_vaporizer (void) { weapon_defaultspawnfunc(WEP_VAPORIZER); }
48 void W_Vaporizer_Attack (void)
51 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
53 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
57 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER);
60 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
61 if(damage_goodhits && self.vaporizer_lasthit)
63 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
64 damage_goodhits = 0; // only every second time
67 self.vaporizer_lasthit = damage_goodhits;
69 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
71 // teamcolor / hit beam effect
73 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
76 case NUM_TEAM_1: // Red
78 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
80 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
82 case NUM_TEAM_2: // Blue
84 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
86 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
88 case NUM_TEAM_3: // Yellow
90 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
92 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
94 case NUM_TEAM_4: // Pink
96 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
98 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
102 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
104 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
108 W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
111 float w_vaporizer(float req)
114 float vaporizer_ammo;
116 // now multiple WR_s use this
117 vaporizer_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
123 if(self.AMMO_VAL(WEP_VAPORIZER) > 0)
124 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
126 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), FALSE); // WEAPONTODO: replace with proper vaporizer cvars
132 // if the laser uses load, we also consider its ammo for reloading
133 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
134 WEP_ACTION(self.weapon, WR_RELOAD);
135 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
136 WEP_ACTION(self.weapon, WR_RELOAD);
137 else if (self.BUTTON_ATCK)
139 if (weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
141 W_Vaporizer_Attack();
142 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
145 else if (self.BUTTON_ATCK2)
147 if (self.jump_interval <= time)
148 if (weapon_prepareattack(1, -1))
150 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
151 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
153 // decrease ammo for the laser?
154 if(WEP_CVAR_SEC(vaporizer, ammo))
155 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
157 // ugly minstagib hack to reuse the fire mode of the laser
160 self.weapon = WEP_BLASTER;
162 WEP_CVAR_SEC(vaporizer, shotangle),
163 WEP_CVAR_SEC(vaporizer, damage),
164 WEP_CVAR_SEC(vaporizer, edgedamage),
165 WEP_CVAR_SEC(vaporizer, radius),
166 WEP_CVAR_SEC(vaporizer, force),
167 WEP_CVAR_SEC(vaporizer, speed),
168 WEP_CVAR_SEC(vaporizer, spread),
169 WEP_CVAR_SEC(vaporizer, delay),
170 WEP_CVAR_SEC(vaporizer, lifetime)
174 // now do normal refire
175 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
183 precache_model("models/nexflash.md3");
184 precache_model("models/weapons/g_minstanex.md3");
185 precache_model("models/weapons/v_minstanex.md3");
186 precache_model("models/weapons/h_minstanex.iqm");
187 precache_sound("weapons/minstanexfire.wav");
188 precache_sound("weapons/nexwhoosh1.wav");
189 precache_sound("weapons/nexwhoosh2.wav");
190 precache_sound("weapons/nexwhoosh3.wav");
191 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
192 VAPORIZER_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
197 self.current_ammo = AMMO_VAL(WEP_VAPORIZER);
198 self.vaporizer_lasthit = 0;
203 ammo_amount = self.AMMO_VAL(WEP_VAPORIZER) >= vaporizer_ammo;
204 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= vaporizer_ammo;
209 if(!WEP_CVAR_SEC(vaporizer, ammo))
211 ammo_amount = self.AMMO_VAL(WEP_VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
212 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
217 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
222 self.vaporizer_lasthit = 0;
228 if(WEP_CVAR_SEC(vaporizer, ammo))
229 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
231 used_ammo = vaporizer_ammo;
233 W_Reload(used_ammo, "weapons/reload.wav");
236 case WR_SUICIDEMESSAGE:
238 return WEAPON_THINKING_WITH_PORTALS;
242 return WEAPON_VAPORIZER_MURDER;
249 float w_vaporizer(float req)
253 case WR_IMPACTEFFECT:
256 org2 = w_org + w_backoff * 6;
257 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
259 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
265 precache_sound("weapons/neximpact.wav");