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_Reload()
24 self.reload_ammo_player = ammo_fuel;
25 if(autocvar_g_balance_minstanex_laser_ammo)
26 self.reload_ammo_min = min(autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
28 self.reload_ammo_min = autocvar_g_balance_minstanex_ammo;
29 self.reload_ammo_amount = autocvar_g_balance_minstanex_reload_ammo;
30 self.reload_time = autocvar_g_balance_minstanex_reload_time;
31 self.reload_sound = "weapons/reload.wav";
36 void W_MinstaNex_Attack (void)
39 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
41 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CHAN_WEAPON, 10000);
46 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
51 AnnounceTo(self, "yoda");
56 AnnounceTo(self, "yoda");
59 AnnounceTo(self, "headshot");
61 if(damage_goodhits && self.minstanex_lasthit)
63 if(AnnounceTo(self, "impressive"))
64 damage_goodhits = 0; // only every second time
68 self.minstanex_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);
79 case COLOR_TEAM1: // Red
81 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
83 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
85 case COLOR_TEAM2: // Blue
87 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
89 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
91 case COLOR_TEAM3: // Yellow
93 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
95 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
97 case COLOR_TEAM4: // Pink
99 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
101 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
106 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
108 // flash and burn the wall
109 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
110 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX, self);
112 // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
113 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
115 if(autocvar_g_balance_minstanex_reload_ammo)
118 self.clip_load -= - 1;
120 self.clip_load -= autocvar_g_balance_minstanex_ammo;
121 self.minstanex_load = self.clip_load;
126 self.ammo_cells -= - 1;
128 self.ammo_cells -= autocvar_g_balance_minstanex_ammo;
134 .float minstagib_nextthink;
135 void minstagib_ammocheck (void)
137 if (time < self.minstagib_nextthink || self.deadflag || gameover)
140 if (self.ammo_cells <= 0)
142 if (self.health == 5)
144 centerprint(self, "you're dead now...\n");
145 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
146 AnnounceTo(self, "terminated");
148 else if (self.health == 10)
150 centerprint(self, "^11^7 second left to find some ammo\n");
151 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
152 AnnounceTo(self, "1");
154 else if (self.health == 20)
156 centerprint(self, "^12^7 seconds left to find some ammo\n");
157 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
158 AnnounceTo(self, "2");
160 else if (self.health == 30)
162 centerprint(self, "^13^7 seconds left to find some ammo\n");
163 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
164 AnnounceTo(self, "3");
166 else if (self.health == 40)
168 centerprint(self, "^14^7 seconds left to find some ammo\n");
169 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
170 AnnounceTo(self, "4");
172 else if (self.health == 50)
174 centerprint(self, "^15^7 seconds left to find some ammo\n");
175 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
176 AnnounceTo(self, "5");
178 else if (self.health == 60)
180 centerprint(self, "^36^7 seconds left to find some ammo\n");
181 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
182 AnnounceTo(self, "6");
184 else if (self.health == 70)
186 centerprint(self, "^37^7 seconds left to find some ammo\n");
187 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
188 AnnounceTo(self, "7");
190 else if (self.health == 80)
192 centerprint(self, "^38^7 seconds left to find some ammo\n");
193 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
194 AnnounceTo(self, "8");
196 else if (self.health == 90)
198 centerprint(self, "^39^7 seconds left to find some ammo\n");
199 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
200 AnnounceTo(self, "9");
202 else if (self.health == 100)
204 centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
205 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
206 if not(self.flags & FL_GODMODE)
207 AnnounceTo(self, "10");
210 self.minstagib_nextthink = time + 1;
213 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
215 float minstanex_ammo;
216 float w_minstanex(float req)
221 if(self.ammo_cells > 0)
222 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
224 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
226 else if (req == WR_THINK)
231 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
233 // if the laser uses load, we also consider its ammo for reloading
234 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
235 W_Minstanex_Reload();
236 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
237 W_Minstanex_Reload();
238 else if (self.BUTTON_ATCK)
240 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
242 W_MinstaNex_Attack();
243 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
246 else if (self.BUTTON_ATCK2)
248 if (self.jump_interval <= time)
250 self.jump_interval = time + autocvar_g_balance_laser_primary_refire * W_WeaponRateFactor();
252 // decrease ammo for the laser?
253 if(autocvar_g_balance_minstanex_laser_ammo)
255 if(autocvar_g_balance_minstanex_reload_ammo)
256 self.clip_load -= autocvar_g_balance_minstanex_laser_ammo;
258 self.ammo_cells -= autocvar_g_balance_minstanex_laser_ammo;
261 // ugly minstagib hack to reuse the fire mode of the laser
264 self.weapon = WEP_LASER;
270 else if (req == WR_PRECACHE)
272 precache_model ("models/nexflash.md3");
273 precache_model ("models/weapons/g_minstanex.md3");
274 precache_model ("models/weapons/v_minstanex.md3");
275 precache_model ("models/weapons/h_minstanex.iqm");
276 precache_sound ("weapons/minstanexfire.wav");
277 precache_sound ("weapons/nexwhoosh1.wav");
278 precache_sound ("weapons/nexwhoosh2.wav");
279 precache_sound ("weapons/nexwhoosh3.wav");
280 precache_sound ("weapons/reload.wav");
281 w_laser(WR_PRECACHE);
283 else if (req == WR_SETUP)
285 weapon_setup(WEP_MINSTANEX);
286 W_Minstanex_SetAmmoCounter();
287 self.minstanex_lasthit = 0;
289 else if (req == WR_CHECKAMMO1)
291 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_ammo;
292 ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_ammo;
295 else if (req == WR_CHECKAMMO2)
297 if(!autocvar_g_balance_minstanex_laser_ammo)
299 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
300 ammo_amount += self.minstanex_load >= autocvar_g_balance_minstanex_laser_ammo;
303 else if (req == WR_RESETPLAYER)
305 self.minstanex_lasthit = 0;
307 // all weapons must be fully loaded when we spawn
308 self.minstanex_load = autocvar_g_balance_minstanex_reload_ammo;
310 else if (req == WR_RELOAD)
312 W_Minstanex_Reload();
318 float w_minstanex(float req)
320 if(req == WR_IMPACTEFFECT)
323 org2 = w_org + w_backoff * 6;
324 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
326 sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
328 else if(req == WR_PRECACHE)
330 precache_sound("weapons/neximpact.wav");
332 else if (req == WR_SUICIDEMESSAGE)
333 w_deathtypestring = _("%s did the impossible");
334 else if (req == WR_KILLMESSAGE)
335 w_deathtypestring = _("%s has been vaporized by %s");