2 REGISTER_WEAPON(MINSTANEX, w_minstanex, IT_CELLS, 7, WEP_FLAG_HIDDEN | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex", "minstanex", _("MinstaNex"))
5 .float minstanex_lasthit;
7 void W_MinstaNex_Attack (void)
10 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
12 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CHAN_WEAPON, 10000);
17 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
22 AnnounceTo(self, "yoda");
27 AnnounceTo(self, "yoda");
30 AnnounceTo(self, "headshot");
32 if(damage_goodhits && self.minstanex_lasthit)
34 if(AnnounceTo(self, "impressive"))
35 damage_goodhits = 0; // only every second time
39 self.minstanex_lasthit = damage_goodhits;
41 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
43 // teamcolor / hit beam effect
45 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
50 case COLOR_TEAM1: // Red
52 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
54 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
56 case COLOR_TEAM2: // Blue
58 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
60 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
62 case COLOR_TEAM3: // Yellow
64 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
66 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
68 case COLOR_TEAM4: // Pink
70 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
72 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
77 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
79 // flash and burn the wall
80 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
81 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX, self);
84 W_DecreaseAmmo(ammo_cells, 1, autocvar_g_balance_minstanex_reload_ammo);
86 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_reload_ammo);
90 .float minstagib_nextthink;
91 void minstagib_ammocheck (void)
93 if (time < self.minstagib_nextthink || self.deadflag || gameover)
96 if (self.ammo_cells <= 0)
97 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
101 centerprint(self, "you're dead now...\n");
102 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
103 AnnounceTo(self, "terminated");
105 else if (self.health == 10)
107 centerprint(self, "^11^7 second left to find some ammo\n");
108 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
109 AnnounceTo(self, "1");
111 else if (self.health == 20)
113 centerprint(self, "^12^7 seconds left to find some ammo\n");
114 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
115 AnnounceTo(self, "2");
117 else if (self.health == 30)
119 centerprint(self, "^13^7 seconds left to find some ammo\n");
120 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
121 AnnounceTo(self, "3");
123 else if (self.health == 40)
125 centerprint(self, "^14^7 seconds left to find some ammo\n");
126 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
127 AnnounceTo(self, "4");
129 else if (self.health == 50)
131 centerprint(self, "^15^7 seconds left to find some ammo\n");
132 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
133 AnnounceTo(self, "5");
135 else if (self.health == 60)
137 centerprint(self, "^36^7 seconds left to find some ammo\n");
138 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
139 AnnounceTo(self, "6");
141 else if (self.health == 70)
143 centerprint(self, "^37^7 seconds left to find some ammo\n");
144 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
145 AnnounceTo(self, "7");
147 else if (self.health == 80)
149 centerprint(self, "^38^7 seconds left to find some ammo\n");
150 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
151 AnnounceTo(self, "8");
153 else if (self.health == 90)
155 centerprint(self, "^39^7 seconds left to find some ammo\n");
156 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
157 AnnounceTo(self, "9");
159 else if (self.health == 100)
161 centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
162 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
163 if not(self.flags & FL_GODMODE)
164 AnnounceTo(self, "10");
167 self.minstagib_nextthink = time + 1;
170 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
172 float w_minstanex(float req)
175 float minstanex_ammo;
177 // now multiple WR_s use this
181 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
185 if(self.ammo_cells > 0)
186 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
188 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
190 else if (req == WR_THINK)
192 // if the laser uses load, we also consider its ammo for reloading
193 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
194 weapon_action(self.weapon, WR_RELOAD);
195 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
196 weapon_action(self.weapon, WR_RELOAD);
197 else if (self.BUTTON_ATCK)
199 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
201 W_MinstaNex_Attack();
202 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
205 else if (self.BUTTON_ATCK2)
207 if (self.jump_interval <= time)
209 self.jump_interval = time + autocvar_g_balance_laser_primary_refire * W_WeaponRateFactor();
211 // decrease ammo for the laser?
212 if(autocvar_g_balance_minstanex_laser_ammo)
213 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
215 // ugly minstagib hack to reuse the fire mode of the laser
218 self.weapon = WEP_LASER;
224 else if (req == WR_PRECACHE)
226 precache_model ("models/nexflash.md3");
227 precache_model ("models/weapons/g_minstanex.md3");
228 precache_model ("models/weapons/v_minstanex.md3");
229 precache_model ("models/weapons/h_minstanex.iqm");
230 precache_sound ("weapons/minstanexfire.wav");
231 precache_sound ("weapons/nexwhoosh1.wav");
232 precache_sound ("weapons/nexwhoosh2.wav");
233 precache_sound ("weapons/nexwhoosh3.wav");
234 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
235 w_laser(WR_PRECACHE);
237 else if (req == WR_SETUP)
239 weapon_setup(WEP_MINSTANEX);
240 self.current_ammo = ammo_cells;
241 self.minstanex_lasthit = 0;
243 else if (req == WR_CHECKAMMO1)
245 ammo_amount = self.ammo_cells >= minstanex_ammo;
246 ammo_amount += self.weapon_load[WEP_MINSTANEX] >= minstanex_ammo;
249 else if (req == WR_CHECKAMMO2)
251 if(!autocvar_g_balance_minstanex_laser_ammo)
253 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
254 ammo_amount += self.weapon_load[WEP_MINSTANEX] >= autocvar_g_balance_minstanex_laser_ammo;
257 else if (req == WR_RESETPLAYER)
259 self.minstanex_lasthit = 0;
261 else if (req == WR_RELOAD)
264 if(autocvar_g_balance_minstanex_laser_ammo)
265 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
267 used_ammo = minstanex_ammo;
269 W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
275 float w_minstanex(float req)
277 if(req == WR_IMPACTEFFECT)
280 org2 = w_org + w_backoff * 6;
281 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
283 sound(self, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
285 else if(req == WR_PRECACHE)
287 precache_sound("weapons/neximpact.wav");
289 else if (req == WR_SUICIDEMESSAGE)
290 w_deathtypestring = _("%s is now thinking with portals");
291 else if (req == WR_KILLMESSAGE)
292 w_deathtypestring = _("%s has been vaporized by %s");