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;
7 // weapon load persistence, for weapons that support reloading
10 void W_Minstanex_SetAmmoCounter()
12 // set clip_load to the weapon we have switched to, if the gun uses reloading
13 if(!autocvar_g_balance_minstanex_reload_ammo)
14 self.clip_load = 0; // also keeps crosshair ammo from displaying
17 self.clip_load = self.minstanex_load;
18 self.clip_size = autocvar_g_balance_minstanex_reload_ammo; // for the crosshair ammo display
22 void W_Minstanex_ReloadedAndReady()
26 // now do the ammo transfer
27 self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
28 while(self.clip_load < autocvar_g_balance_minstanex_reload_ammo && self.ammo_cells) // make sure we don't add more ammo than we have
33 self.minstanex_load = self.clip_load;
35 t = ATTACK_FINISHED(self) - autocvar_g_balance_minstanex_reload_time - 1;
36 ATTACK_FINISHED(self) = t;
40 void W_Minstanex_Reload()
42 // return if reloading is disabled for this weapon
43 if(!autocvar_g_balance_minstanex_reload_ammo)
46 if(autocvar_g_balance_minstanex_laser_ammo)
48 if(!W_ReloadCheck(self.ammo_cells, min(autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)))
51 else if(!W_ReloadCheck(self.ammo_cells, autocvar_g_balance_minstanex_ammo))
56 sound (self, CHAN_WEAPON2, "weapons/reload.wav", VOL_BASE, ATTN_NORM);
58 t = max(time, ATTACK_FINISHED(self)) + autocvar_g_balance_minstanex_reload_time + 1;
59 ATTACK_FINISHED(self) = t;
61 weapon_thinkf(WFRAME_RELOAD, autocvar_g_balance_minstanex_reload_time, W_Minstanex_ReloadedAndReady);
63 self.old_clip_load = self.clip_load;
67 void W_MinstaNex_Attack (void)
70 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
72 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CHAN_WEAPON, 10000);
77 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
82 AnnounceTo(self, "yoda");
87 AnnounceTo(self, "yoda");
90 AnnounceTo(self, "headshot");
92 if(damage_goodhits && self.minstanex_lasthit)
94 if(AnnounceTo(self, "impressive"))
95 damage_goodhits = 0; // only every second time
99 self.minstanex_lasthit = damage_goodhits;
101 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
103 // teamcolor / hit beam effect
105 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
110 case COLOR_TEAM1: // Red
112 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
114 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
116 case COLOR_TEAM2: // Blue
118 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
120 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
122 case COLOR_TEAM3: // Yellow
124 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
126 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
128 case COLOR_TEAM4: // Pink
130 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
132 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
137 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
139 // flash and burn the wall
140 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
141 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX, self);
143 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
144 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
146 if(autocvar_g_balance_minstanex_reload_ammo)
149 self.clip_load -= - 1;
151 self.clip_load -= autocvar_g_balance_minstanex_ammo;
152 self.minstanex_load = self.clip_load;
157 self.ammo_cells -= - 1;
159 self.ammo_cells -= autocvar_g_balance_minstanex_ammo;
165 .float minstagib_nextthink;
166 void minstagib_ammocheck (void)
168 if (time < self.minstagib_nextthink || self.deadflag || gameover)
171 if (self.ammo_cells <= 0)
173 if (self.health == 5)
175 centerprint(self, "you're dead now...\n");
176 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
177 AnnounceTo(self, "terminated");
179 else if (self.health == 10)
181 centerprint(self, "^11^7 second left to find some ammo\n");
182 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
183 AnnounceTo(self, "1");
185 else if (self.health == 20)
187 centerprint(self, "^12^7 seconds left to find some ammo\n");
188 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
189 AnnounceTo(self, "2");
191 else if (self.health == 30)
193 centerprint(self, "^13^7 seconds left to find some ammo\n");
194 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
195 AnnounceTo(self, "3");
197 else if (self.health == 40)
199 centerprint(self, "^14^7 seconds left to find some ammo\n");
200 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
201 AnnounceTo(self, "4");
203 else if (self.health == 50)
205 centerprint(self, "^15^7 seconds left to find some ammo\n");
206 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
207 AnnounceTo(self, "5");
209 else if (self.health == 60)
211 centerprint(self, "^36^7 seconds left to find some ammo\n");
212 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
213 AnnounceTo(self, "6");
215 else if (self.health == 70)
217 centerprint(self, "^37^7 seconds left to find some ammo\n");
218 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
219 AnnounceTo(self, "7");
221 else if (self.health == 80)
223 centerprint(self, "^38^7 seconds left to find some ammo\n");
224 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
225 AnnounceTo(self, "8");
227 else if (self.health == 90)
229 centerprint(self, "^39^7 seconds left to find some ammo\n");
230 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
231 AnnounceTo(self, "9");
233 else if (self.health == 100)
235 centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
236 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
237 if not(self.flags & FL_GODMODE)
238 AnnounceTo(self, "10");
241 self.minstagib_nextthink = time + 1;
244 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
246 float minstanex_ammo;
247 float w_minstanex(float req)
252 if(self.ammo_cells > 0)
253 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
255 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
257 else if (req == WR_THINK)
262 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
264 // if the laser uses load, we also consider its ammo for reloading
265 if(autocvar_g_balance_minstanex_reload_ammo && autocvar_g_balance_minstanex_laser_ammo && self.clip_load < min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo)) // forced reload
266 W_Minstanex_Reload();
267 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
268 W_Minstanex_Reload();
269 else if (self.BUTTON_ATCK)
271 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
273 W_MinstaNex_Attack();
274 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
277 else if (self.BUTTON_ATCK2)
279 if (self.jump_interval <= time)
281 self.jump_interval = time + autocvar_g_balance_laser_primary_refire * W_WeaponRateFactor();
283 // decrease ammo for the laser?
284 if(autocvar_g_balance_minstanex_laser_ammo)
286 if(autocvar_g_balance_minstanex_reload_ammo)
287 self.clip_load -= autocvar_g_balance_minstanex_laser_ammo;
289 self.ammo_cells -= autocvar_g_balance_minstanex_laser_ammo;
292 // ugly minstagib hack to reuse the fire mode of the laser
295 self.weapon = WEP_LASER;
301 else if (req == WR_PRECACHE)
303 precache_model ("models/nexflash.md3");
304 precache_model ("models/weapons/g_minstanex.md3");
305 precache_model ("models/weapons/v_minstanex.md3");
306 precache_model ("models/weapons/h_minstanex.iqm");
307 precache_sound ("weapons/minstanexfire.wav");
308 precache_sound ("weapons/nexwhoosh1.wav");
309 precache_sound ("weapons/nexwhoosh2.wav");
310 precache_sound ("weapons/nexwhoosh3.wav");
311 precache_sound ("weapons/reload.wav");
312 w_laser(WR_PRECACHE);
314 else if (req == WR_SETUP)
316 weapon_setup(WEP_MINSTANEX);
317 W_Minstanex_SetAmmoCounter();
318 self.minstanex_lasthit = 0;
320 else if (req == WR_CHECKAMMO1)
322 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_ammo;
323 ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_ammo;
326 else if (req == WR_CHECKAMMO2)
328 if(!autocvar_g_balance_minstanex_laser_ammo)
330 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
331 ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_laser_ammo;
334 else if (req == WR_RESETPLAYER)
336 self.minstanex_lasthit = 0;
338 // all weapons must be fully loaded when we spawn
339 self.minstanex_load = autocvar_g_balance_minstanex_reload_ammo;
341 else if (req == WR_RELOAD)
343 W_Minstanex_Reload();
349 float w_minstanex(float req)
351 if(req == WR_IMPACTEFFECT)
354 org2 = w_org + w_backoff * 6;
355 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
357 sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
359 else if(req == WR_PRECACHE)
361 precache_sound("weapons/neximpact.wav");
363 else if (req == WR_SUICIDEMESSAGE)
364 w_deathtypestring = _("%s did the impossible");
365 else if (req == WR_KILLMESSAGE)
366 w_deathtypestring = _("%s has been vaporized by %s");