2 REGISTER_WEAPON(MINSTANEX, w_minstanex, IT_CELLS, 7, WEP_FLAG_HIDDEN | WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex", "minstanex", _("MinstaNex"))
5 .float minstanex_lasthit;
9 void W_Minstanex_SetAmmoCounter()
11 // set clip_load to the weapon we have switched to, if the gun uses reloading
12 if(!autocvar_g_balance_minstanex_reload_ammo)
13 self.clip_load = 0; // also keeps crosshair ammo from displaying
16 self.clip_load = self.minstanex_load;
17 self.clip_size = autocvar_g_balance_minstanex_reload_ammo; // for the crosshair ammo display
21 void W_Minstanex_ReloadedAndReady()
25 // now do the ammo transfer
26 self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
27 while(self.clip_load < autocvar_g_balance_minstanex_reload_ammo && self.ammo_cells) // make sure we don't add more ammo than we have
32 self.minstanex_load = self.clip_load;
34 t = ATTACK_FINISHED(self) - autocvar_g_balance_minstanex_reload_time - 1;
35 ATTACK_FINISHED(self) = t;
39 void W_Minstanex_Reload()
41 // return if reloading is disabled for this weapon
42 if(!autocvar_g_balance_minstanex_reload_ammo)
45 if(!W_ReloadCheck(self.ammo_cells, autocvar_g_balance_minstanex_ammo))
50 sound (self, CHAN_WEAPON2, "weapons/reload.wav", VOL_BASE, ATTN_NORM);
52 t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_minstanex_reload_time + 1;
53 ATTACK_FINISHED(self) = t;
55 weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_minstanex_reload_time, W_Minstanex_ReloadedAndReady);
57 self.old_clip_load = self.clip_load;
61 void W_MinstaNex_Attack (void)
64 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
66 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CHAN_WEAPON, 10000);
71 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
76 AnnounceTo(self, "yoda");
81 AnnounceTo(self, "yoda");
84 AnnounceTo(self, "headshot");
86 if(damage_goodhits && self.minstanex_lasthit)
88 if(AnnounceTo(self, "impressive"))
89 damage_goodhits = 0; // only every second time
93 self.minstanex_lasthit = damage_goodhits;
95 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
97 // teamcolor / hit beam effect
99 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
104 case COLOR_TEAM1: // Red
106 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
108 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
110 case COLOR_TEAM2: // Blue
112 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
114 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
116 case COLOR_TEAM3: // Yellow
118 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
120 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
122 case COLOR_TEAM4: // Pink
124 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
126 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
131 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
133 // flash and burn the wall
134 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
135 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX, self);
137 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
138 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
140 if(autocvar_g_balance_minstanex_reload_ammo)
143 self.clip_load -= - 1;
145 self.clip_load -= autocvar_g_balance_minstanex_ammo;
146 self.minstanex_load = self.clip_load;
151 self.ammo_cells -= - 1;
153 self.ammo_cells -= autocvar_g_balance_minstanex_ammo;
159 .float minstagib_nextthink;
160 void minstagib_ammocheck (void)
162 if (time < self.minstagib_nextthink || self.deadflag || gameover)
165 if (self.ammo_cells <= 0)
167 if (self.health == 5)
169 centerprint(self, "you're dead now...\n");
170 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
171 AnnounceTo(self, "terminated");
173 else if (self.health == 10)
175 centerprint(self, "^11^7 second left to find some ammo\n");
176 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
177 AnnounceTo(self, "1");
179 else if (self.health == 20)
181 centerprint(self, "^12^7 seconds left to find some ammo\n");
182 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
183 AnnounceTo(self, "2");
185 else if (self.health == 30)
187 centerprint(self, "^13^7 seconds left to find some ammo\n");
188 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
189 AnnounceTo(self, "3");
191 else if (self.health == 40)
193 centerprint(self, "^14^7 seconds left to find some ammo\n");
194 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
195 AnnounceTo(self, "4");
197 else if (self.health == 50)
199 centerprint(self, "^15^7 seconds left to find some ammo\n");
200 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
201 AnnounceTo(self, "5");
203 else if (self.health == 60)
205 centerprint(self, "^36^7 seconds left to find some ammo\n");
206 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
207 AnnounceTo(self, "6");
209 else if (self.health == 70)
211 centerprint(self, "^37^7 seconds left to find some ammo\n");
212 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
213 AnnounceTo(self, "7");
215 else if (self.health == 80)
217 centerprint(self, "^38^7 seconds left to find some ammo\n");
218 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
219 AnnounceTo(self, "8");
221 else if (self.health == 90)
223 centerprint(self, "^39^7 seconds left to find some ammo\n");
224 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
225 AnnounceTo(self, "9");
227 else if (self.health == 100)
229 centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
230 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
231 if not(self.flags & FL_GODMODE)
232 AnnounceTo(self, "10");
235 self.minstagib_nextthink = time + 1;
238 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
240 float w_minstanex(float req)
244 if(self.ammo_cells>0)
245 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
247 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
249 else if (req == WR_THINK)
251 if(autocvar_g_balance_minstanex_reload_ammo && ((g_minstagib && self.clip_load < 1) || (!g_minstagib && self.clip_load < autocvar_g_balance_minstanex_ammo))) // forced reload
252 W_Minstanex_Reload();
253 else if (self.BUTTON_ATCK)
255 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
257 W_MinstaNex_Attack();
258 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
261 else if (self.BUTTON_ATCK2)
263 if (self.jump_interval <= time)
265 self.jump_interval = time + autocvar_g_balance_laser_primary_refire * W_WeaponRateFactor();
267 // ugly minstagib hack to reuse the fire mode of the laser
270 self.weapon = WEP_LASER;
277 if(self.switchweapon == self.weapon)
279 if(self.weaponentity.state == WS_READY)
281 self.wish_reload = 0;
282 W_Minstanex_Reload();
287 else if (req == WR_PRECACHE)
289 precache_model ("models/nexflash.md3");
290 precache_model ("models/weapons/g_minstanex.md3");
291 precache_model ("models/weapons/v_minstanex.md3");
292 precache_model ("models/weapons/h_minstanex.iqm");
293 precache_sound ("weapons/minstanexfire.wav");
294 precache_sound ("weapons/nexwhoosh1.wav");
295 precache_sound ("weapons/nexwhoosh2.wav");
296 precache_sound ("weapons/nexwhoosh3.wav");
297 w_laser(WR_PRECACHE);
299 else if (req == WR_SETUP)
301 weapon_setup(WEP_MINSTANEX);
302 W_Minstanex_SetAmmoCounter();
303 self.minstanex_lasthit = 0;
305 else if (req == WR_CHECKAMMO1)
307 if(autocvar_g_balance_minstanex_reload_ammo)
310 return self.clip_load >= 1;
312 return self.clip_load >= autocvar_g_balance_minstanex_ammo;
317 return self.ammo_cells >= 1;
319 return self.ammo_cells >= autocvar_g_balance_minstanex_ammo;
322 else if (req == WR_CHECKAMMO2)
324 else if (req == WR_RESETPLAYER)
326 self.minstanex_lasthit = 0;
328 else if (req == WR_RELOAD)
330 W_Minstanex_Reload();
336 float w_minstanex(float req)
338 if(req == WR_IMPACTEFFECT)
341 org2 = w_org + w_backoff * 6;
342 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
344 sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
346 else if(req == WR_PRECACHE)
348 precache_sound("weapons/neximpact.wav");
350 else if (req == WR_SUICIDEMESSAGE)
351 w_deathtypestring = "%s did the impossible";
352 else if (req == WR_KILLMESSAGE)
353 w_deathtypestring = "%s has been vaporized by %s";