3 /* WEP_##id */ MINSTANEX,
4 /* function */ w_minstanex,
5 /* ammotype */ IT_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 */ _("MinstaNex")
14 #define MINSTANEX_SETTINGS(w_cvar,w_prop) \
15 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, ammo) \
16 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, animtime) \
17 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, refire) \
18 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, ammo) \
19 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, animtime) \
20 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, damage) \
21 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, delay) \
22 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, edgedamage) \
23 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, force) \
24 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, lifetime) \
25 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, radius) \
26 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, refire) \
27 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, shotangle) \
28 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, speed) \
29 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, spread) \
30 w_prop(WEP_MINSTANEX, minstanex, float, reloading_ammo, reload_ammo) \
31 w_prop(WEP_MINSTANEX, minstanex, float, reloading_time, reload_time) \
32 w_prop(WEP_MINSTANEX, minstanex, float, switchdelay_raise, switchdelay_raise) \
33 w_prop(WEP_MINSTANEX, minstanex, float, switchdelay_drop, switchdelay_drop) \
34 w_prop(WEP_MINSTANEX, minstanex, string, weaponreplace, weaponreplace) \
35 w_prop(WEP_MINSTANEX, minstanex, float, weaponstart, weaponstart) \
36 w_prop(WEP_MINSTANEX, minstanex, float, weaponstartoverride, weaponstartoverride)
39 MINSTANEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
40 .float minstanex_lasthit;
45 void spawnfunc_weapon_minstanex (void) { weapon_defaultspawnfunc(WEP_MINSTANEX); }
47 void W_MinstaNex_Attack (void)
50 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
52 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
56 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
59 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
60 if(damage_goodhits && self.minstanex_lasthit)
62 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
63 damage_goodhits = 0; // only every second time
66 self.minstanex_lasthit = damage_goodhits;
68 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
70 // teamcolor / hit beam effect
72 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
75 case NUM_TEAM_1: // Red
77 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
79 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
81 case NUM_TEAM_2: // Blue
83 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
85 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
87 case NUM_TEAM_3: // Yellow
89 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
91 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
93 case NUM_TEAM_4: // Pink
95 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
97 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
101 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
103 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
107 W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo));
110 float w_minstanex(float req)
113 float minstanex_ammo;
115 // now multiple WR_s use this
116 minstanex_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo));
122 if(self.ammo_cells > 0)
123 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
125 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(minstanex, speed), 0, WEP_CVAR_SEC(minstanex, lifetime), FALSE); // WEAPONTODO: replace with proper minstanex cvars
131 // if the laser uses load, we also consider its ammo for reloading
132 if(WEP_CVAR(minstanex, reload_ammo) && WEP_CVAR_SEC(minstanex, ammo) && self.clip_load < min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo))) // forced reload
133 WEP_ACTION(self.weapon, WR_RELOAD);
134 else if(WEP_CVAR(minstanex, reload_ammo) && self.clip_load < minstanex_ammo) // forced reload
135 WEP_ACTION(self.weapon, WR_RELOAD);
136 else if (self.BUTTON_ATCK)
138 if (weapon_prepareattack(0, WEP_CVAR_PRI(minstanex, refire)))
140 W_MinstaNex_Attack();
141 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(minstanex, animtime), w_ready);
144 else if (self.BUTTON_ATCK2)
146 if (self.jump_interval <= time)
147 if (weapon_prepareattack(1, -1))
149 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
150 self.jump_interval = time + WEP_CVAR_SEC(minstanex, refire) * W_WeaponRateFactor();
152 // decrease ammo for the laser?
153 if(WEP_CVAR_SEC(minstanex, ammo))
154 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo));
156 // ugly minstagib hack to reuse the fire mode of the laser
159 self.weapon = WEP_BLASTER;
161 WEP_CVAR_SEC(minstanex, shotangle),
162 WEP_CVAR_SEC(minstanex, damage),
163 WEP_CVAR_SEC(minstanex, edgedamage),
164 WEP_CVAR_SEC(minstanex, radius),
165 WEP_CVAR_SEC(minstanex, force),
166 WEP_CVAR_SEC(minstanex, speed),
167 WEP_CVAR_SEC(minstanex, spread),
168 WEP_CVAR_SEC(minstanex, delay),
169 WEP_CVAR_SEC(minstanex, lifetime)
173 // now do normal refire
174 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(minstanex, animtime), w_ready);
182 precache_model("models/nexflash.md3");
183 precache_model("models/weapons/g_minstanex.md3");
184 precache_model("models/weapons/v_minstanex.md3");
185 precache_model("models/weapons/h_minstanex.iqm");
186 precache_sound("weapons/minstanexfire.wav");
187 precache_sound("weapons/nexwhoosh1.wav");
188 precache_sound("weapons/nexwhoosh2.wav");
189 precache_sound("weapons/nexwhoosh3.wav");
190 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
191 MINSTANEX_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
196 self.current_ammo = ammo_cells;
197 self.minstanex_lasthit = 0;
202 ammo_amount = self.ammo_cells >= minstanex_ammo;
203 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
208 if(!WEP_CVAR_SEC(minstanex, ammo))
210 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(minstanex, ammo);
211 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= WEP_CVAR_SEC(minstanex, ammo);
216 MINSTANEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
221 self.minstanex_lasthit = 0;
227 if(WEP_CVAR_SEC(minstanex, ammo))
228 used_ammo = min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo));
230 used_ammo = minstanex_ammo;
232 W_Reload(used_ammo, "weapons/reload.wav");
235 case WR_SUICIDEMESSAGE:
237 return WEAPON_THINKING_WITH_PORTALS;
241 return WEAPON_MINSTANEX_MURDER;
248 float w_minstanex(float req)
252 case WR_IMPACTEFFECT:
255 org2 = w_org + w_backoff * 6;
256 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
258 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
264 precache_sound("weapons/neximpact.wav");