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);
18 damage_headshotbonus = -1; // no extra damage, just count
19 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
20 damage_headshotbonus = 0;
25 AnnounceTo(self, "yoda");
30 AnnounceTo(self, "yoda");
33 AnnounceTo(self, "headshot");
35 if(damage_goodhits && self.minstanex_lasthit)
37 if(AnnounceTo(self, "impressive"))
38 damage_goodhits = 0; // only every second time
42 self.minstanex_lasthit = damage_goodhits;
44 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
46 // teamcolor / hit beam effect
48 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
53 case COLOR_TEAM1: // Red
55 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
57 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
59 case COLOR_TEAM2: // Blue
61 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
63 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
65 case COLOR_TEAM3: // Yellow
67 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
69 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
71 case COLOR_TEAM4: // Pink
73 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
75 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
80 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
83 W_DecreaseAmmo(ammo_cells, 1, autocvar_g_balance_minstanex_reload_ammo);
85 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_reload_ammo);
89 .float minstagib_nextthink;
90 .float minstagib_needammo;
91 void minstagib_stop_countdown(entity e)
93 if (!e.minstagib_needammo)
95 Send_CSQC_Centerprint_Generic_Expire(e, CPID_MINSTA_FINDAMMO);
96 e.minstagib_needammo = FALSE;
98 void minstagib_ammocheck(void)
100 if (time < self.minstagib_nextthink)
103 if (self.deadflag || gameover)
104 minstagib_stop_countdown(self);
105 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
107 if (self.minstagib_needammo)
109 minstagib_stop_countdown(self);
113 self.minstagib_needammo = TRUE;
114 if (self.health == 5)
116 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
117 AnnounceTo(self, "terminated");
119 else if (self.health == 10)
121 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
122 AnnounceTo(self, "1");
124 else if (self.health == 20)
126 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
127 AnnounceTo(self, "2");
129 else if (self.health == 30)
131 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
132 AnnounceTo(self, "3");
134 else if (self.health == 40)
136 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
137 AnnounceTo(self, "4");
139 else if (self.health == 50)
141 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
142 AnnounceTo(self, "5");
144 else if (self.health == 60)
146 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
147 AnnounceTo(self, "6");
149 else if (self.health == 70)
151 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
152 AnnounceTo(self, "7");
154 else if (self.health == 80)
156 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
157 AnnounceTo(self, "8");
159 else if (self.health == 90)
161 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "^1%d^7 seconds left to find some ammo", 1, 9);
162 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
163 AnnounceTo(self, "9");
165 else if (self.health == 100)
167 Send_CSQC_Centerprint_Generic(self, CPID_MINSTA_FINDAMMO, "get some ammo or\nyou'll be dead in ^3%d^7 seconds...", 1, 10);
168 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
169 if not(self.flags & FL_GODMODE)
170 AnnounceTo(self, "10");
173 self.minstagib_nextthink = time + 1;
176 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
178 float w_minstanex(float req)
181 float minstanex_ammo;
183 // now multiple WR_s use this
187 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
191 if(self.ammo_cells > 0)
192 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
194 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
196 else if (req == WR_THINK)
198 // if the laser uses load, we also consider its ammo for reloading
199 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
200 weapon_action(self.weapon, WR_RELOAD);
201 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
202 weapon_action(self.weapon, WR_RELOAD);
203 else if (self.BUTTON_ATCK)
205 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
207 W_MinstaNex_Attack();
208 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
211 else if (self.BUTTON_ATCK2)
213 if (self.jump_interval <= time)
214 if (weapon_prepareattack(1, -1))
216 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
217 self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
219 // decrease ammo for the laser?
220 if(autocvar_g_balance_minstanex_laser_ammo)
221 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
223 // ugly minstagib hack to reuse the fire mode of the laser
226 self.weapon = WEP_LASER;
230 // now do normal refire
231 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
235 else if (req == WR_PRECACHE)
237 precache_model ("models/nexflash.md3");
238 precache_model ("models/weapons/g_minstanex.md3");
239 precache_model ("models/weapons/v_minstanex.md3");
240 precache_model ("models/weapons/h_minstanex.iqm");
241 precache_sound ("weapons/minstanexfire.wav");
242 precache_sound ("weapons/nexwhoosh1.wav");
243 precache_sound ("weapons/nexwhoosh2.wav");
244 precache_sound ("weapons/nexwhoosh3.wav");
245 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
246 w_laser(WR_PRECACHE);
248 else if (req == WR_SETUP)
250 weapon_setup(WEP_MINSTANEX);
251 self.current_ammo = ammo_cells;
252 self.minstanex_lasthit = 0;
254 else if (req == WR_CHECKAMMO1)
256 ammo_amount = self.ammo_cells >= minstanex_ammo;
257 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
260 else if (req == WR_CHECKAMMO2)
262 if(!autocvar_g_balance_minstanex_laser_ammo)
264 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
265 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
268 else if (req == WR_RESETPLAYER)
270 self.minstanex_lasthit = 0;
272 else if (req == WR_RELOAD)
275 if(autocvar_g_balance_minstanex_laser_ammo)
276 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
278 used_ammo = minstanex_ammo;
280 W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
286 float w_minstanex(float req)
288 if(req == WR_IMPACTEFFECT)
291 org2 = w_org + w_backoff * 6;
292 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
294 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
296 else if(req == WR_PRECACHE)
298 precache_sound("weapons/neximpact.wav");
300 else if (req == WR_SUICIDEMESSAGE)
301 w_deathtypestring = _("%s is now thinking with portals");
302 else if (req == WR_KILLMESSAGE)
303 w_deathtypestring = _("%s has been vaporized by %s's minstanex");