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 /* model */ "minstanex",
11 /* netname */ "minstanex",
12 /* fullname */ _("Vaporizer")
15 #define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
16 #define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
17 w_cvar(id, sn, PRI, ammo) \
18 w_cvar(id, sn, PRI, animtime) \
19 w_cvar(id, sn, PRI, refire) \
20 w_cvar(id, sn, SEC, ammo) \
21 w_cvar(id, sn, SEC, animtime) \
22 w_cvar(id, sn, SEC, damage) \
23 w_cvar(id, sn, SEC, delay) \
24 w_cvar(id, sn, SEC, edgedamage) \
25 w_cvar(id, sn, SEC, force) \
26 w_cvar(id, sn, SEC, lifetime) \
27 w_cvar(id, sn, SEC, radius) \
28 w_cvar(id, sn, SEC, refire) \
29 w_cvar(id, sn, SEC, shotangle) \
30 w_cvar(id, sn, SEC, speed) \
31 w_cvar(id, sn, SEC, spread) \
32 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
33 w_prop(id, sn, float, reloading_time, reload_time) \
34 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
35 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
36 w_prop(id, sn, string, weaponreplace, weaponreplace) \
37 w_prop(id, sn, float, weaponstart, weaponstart) \
38 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
41 VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
42 .float vaporizer_lasthit;
47 void spawnfunc_weapon_vaporizer (void) { weapon_defaultspawnfunc(WEP_VAPORIZER); }
49 void W_Vaporizer_Attack (void)
52 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
54 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
58 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_VAPORIZER);
61 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
62 if(damage_goodhits && self.vaporizer_lasthit)
64 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
65 damage_goodhits = 0; // only every second time
68 self.vaporizer_lasthit = damage_goodhits;
70 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
72 // teamcolor / hit beam effect
74 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
77 case NUM_TEAM_1: // Red
79 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
81 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
83 case NUM_TEAM_2: // Blue
85 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
87 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
89 case NUM_TEAM_3: // Yellow
91 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
93 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
95 case NUM_TEAM_4: // Pink
97 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
99 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
103 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
105 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
109 W_DecreaseAmmo(((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
112 float w_vaporizer(float req)
115 float vaporizer_ammo;
117 // now multiple WR_s use this
118 vaporizer_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
124 if(self.AMMO_VAL(WEP_VAPORIZER) > 0)
125 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
127 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), FALSE); // WEAPONTODO: replace with proper vaporizer cvars
133 // if the laser uses load, we also consider its ammo for reloading
134 if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && self.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) // forced reload
135 WEP_ACTION(self.weapon, WR_RELOAD);
136 else if(WEP_CVAR(vaporizer, reload_ammo) && self.clip_load < vaporizer_ammo) // forced reload
137 WEP_ACTION(self.weapon, WR_RELOAD);
138 else if (self.BUTTON_ATCK)
140 if (weapon_prepareattack(0, WEP_CVAR_PRI(vaporizer, refire)))
142 W_Vaporizer_Attack();
143 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
146 else if (self.BUTTON_ATCK2)
148 if (self.jump_interval <= time)
149 if (weapon_prepareattack(1, -1))
151 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
152 self.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor();
154 // decrease ammo for the laser?
155 if(WEP_CVAR_SEC(vaporizer, ammo))
156 W_DecreaseAmmo(WEP_CVAR_SEC(vaporizer, ammo));
158 // ugly minstagib hack to reuse the fire mode of the laser
161 self.weapon = WEP_BLASTER;
163 WEP_CVAR_SEC(vaporizer, shotangle),
164 WEP_CVAR_SEC(vaporizer, damage),
165 WEP_CVAR_SEC(vaporizer, edgedamage),
166 WEP_CVAR_SEC(vaporizer, radius),
167 WEP_CVAR_SEC(vaporizer, force),
168 WEP_CVAR_SEC(vaporizer, speed),
169 WEP_CVAR_SEC(vaporizer, spread),
170 WEP_CVAR_SEC(vaporizer, delay),
171 WEP_CVAR_SEC(vaporizer, lifetime)
175 // now do normal refire
176 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
184 precache_model("models/nexflash.md3");
185 precache_model("models/weapons/g_minstanex.md3");
186 precache_model("models/weapons/v_minstanex.md3");
187 precache_model("models/weapons/h_minstanex.iqm");
188 precache_sound("weapons/minstanexfire.wav");
189 precache_sound("weapons/nexwhoosh1.wav");
190 precache_sound("weapons/nexwhoosh2.wav");
191 precache_sound("weapons/nexwhoosh3.wav");
192 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
193 VAPORIZER_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
198 self.current_ammo = AMMO_VAL(WEP_VAPORIZER);
199 self.vaporizer_lasthit = 0;
204 ammo_amount = self.AMMO_VAL(WEP_VAPORIZER) >= vaporizer_ammo;
205 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= vaporizer_ammo;
210 if(!WEP_CVAR_SEC(vaporizer, ammo))
212 ammo_amount = self.AMMO_VAL(WEP_VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
213 ammo_amount += self.(weapon_load[WEP_VAPORIZER]) >= WEP_CVAR_SEC(vaporizer, ammo);
218 VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
223 self.vaporizer_lasthit = 0;
229 if(WEP_CVAR_SEC(vaporizer, ammo))
230 used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
232 used_ammo = vaporizer_ammo;
234 W_Reload(used_ammo, "weapons/reload.wav");
237 case WR_SUICIDEMESSAGE:
239 return WEAPON_THINKING_WITH_PORTALS;
243 return WEAPON_VAPORIZER_MURDER;
250 float w_vaporizer(float req)
254 case WR_IMPACTEFFECT:
257 org2 = w_org + w_backoff * 6;
258 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
260 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
266 precache_sound("weapons/neximpact.wav");