2 REGISTER_WEAPON(MINSTANEX, w_minstanex, IT_CELLS, 7, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN, BOT_PICKUP_RATING_HIGH, "minstanex", "minstanex", _("MinstaNex"))
5 .float minstanex_lasthit;
8 void W_MinstaNex_Attack (void)
11 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
13 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 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");
28 if(damage_goodhits && self.minstanex_lasthit)
30 AnnounceTo(self, "impressive");
31 damage_goodhits = 0; // only every second time
35 self.minstanex_lasthit = damage_goodhits;
37 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
39 // teamcolor / hit beam effect
41 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
46 case COLOR_TEAM1: // Red
48 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
50 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
52 case COLOR_TEAM2: // Blue
54 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
56 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
58 case COLOR_TEAM3: // Yellow
60 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
62 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
64 case COLOR_TEAM4: // Pink
66 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
68 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
73 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
76 W_DecreaseAmmo(ammo_cells, 1, autocvar_g_balance_minstanex_reload_ammo);
78 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_reload_ammo);
82 .float minstagib_nextthink;
83 .float minstagib_needammo;
84 void minstagib_stop_countdown(entity e)
86 if (!e.minstagib_needammo)
88 Send_CSQC_Centerprint_Generic_Expire(e, CPID_MINSTA_FINDAMMO);
89 e.minstagib_needammo = FALSE;
91 void minstagib_ammocheck(void)
93 if (time < self.minstagib_nextthink)
96 if (self.deadflag || gameover)
97 minstagib_stop_countdown(self);
98 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
100 if (self.minstagib_needammo)
102 minstagib_stop_countdown(self);
106 self.minstagib_needammo = TRUE;
107 if (self.health == 5)
109 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
110 AnnounceTo(self, "terminated");
112 else if (self.health == 10)
114 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
115 AnnounceTo(self, "1");
117 else if (self.health == 20)
119 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
120 AnnounceTo(self, "2");
122 else if (self.health == 30)
124 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
125 AnnounceTo(self, "3");
127 else if (self.health == 40)
129 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
130 AnnounceTo(self, "4");
132 else if (self.health == 50)
134 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
135 AnnounceTo(self, "5");
137 else if (self.health == 60)
139 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
140 AnnounceTo(self, "6");
142 else if (self.health == 70)
144 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
145 AnnounceTo(self, "7");
147 else if (self.health == 80)
149 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
150 AnnounceTo(self, "8");
152 else if (self.health == 90)
154 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 seconds left to find some ammo", 1, 9);
155 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
156 AnnounceTo(self, "9");
158 else if (self.health == 100)
160 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10);
161 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
162 if not(self.flags & FL_GODMODE)
163 AnnounceTo(self, "10");
166 self.minstagib_nextthink = time + 1;
169 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
171 float w_minstanex(float req)
174 float minstanex_ammo;
176 // now multiple WR_s use this
180 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
184 if(self.ammo_cells > 0)
185 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
187 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
189 else if (req == WR_THINK)
191 // if the laser uses load, we also consider its ammo for reloading
192 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
193 weapon_action(self.weapon, WR_RELOAD);
194 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
195 weapon_action(self.weapon, WR_RELOAD);
196 else if (self.BUTTON_ATCK)
198 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
200 W_MinstaNex_Attack();
201 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
204 else if (self.BUTTON_ATCK2)
206 if (self.jump_interval <= time)
207 if (weapon_prepareattack(1, -1))
209 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
210 self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
212 // decrease ammo for the laser?
213 if(autocvar_g_balance_minstanex_laser_ammo)
214 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
216 // ugly minstagib hack to reuse the fire mode of the laser
219 self.weapon = WEP_LASER;
223 // now do normal refire
224 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
228 else if (req == WR_PRECACHE)
230 precache_model ("models/nexflash.md3");
231 precache_model ("models/weapons/g_minstanex.md3");
232 precache_model ("models/weapons/v_minstanex.md3");
233 precache_model ("models/weapons/h_minstanex.iqm");
234 precache_sound ("weapons/minstanexfire.wav");
235 precache_sound ("weapons/nexwhoosh1.wav");
236 precache_sound ("weapons/nexwhoosh2.wav");
237 precache_sound ("weapons/nexwhoosh3.wav");
238 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
239 w_laser(WR_PRECACHE);
241 else if (req == WR_SETUP)
243 weapon_setup(WEP_MINSTANEX);
244 self.current_ammo = ammo_cells;
245 self.minstanex_lasthit = 0;
247 else if (req == WR_CHECKAMMO1)
249 ammo_amount = self.ammo_cells >= minstanex_ammo;
250 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
253 else if (req == WR_CHECKAMMO2)
255 if(!autocvar_g_balance_minstanex_laser_ammo)
257 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
258 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
261 else if (req == WR_RESETPLAYER)
263 self.minstanex_lasthit = 0;
265 else if (req == WR_RELOAD)
268 if(autocvar_g_balance_minstanex_laser_ammo)
269 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
271 used_ammo = minstanex_ammo;
273 W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
279 float w_minstanex(float req)
281 if(req == WR_IMPACTEFFECT)
284 org2 = w_org + w_backoff * 6;
285 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
287 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
289 else if(req == WR_PRECACHE)
291 precache_sound("weapons/neximpact.wav");
293 else if (req == WR_SUICIDEMESSAGE)
294 w_deathtypestring = _("%s is now thinking with portals");
295 else if (req == WR_KILLMESSAGE)
296 w_deathtypestring = _("%s has been vaporized by %s's minstanex");