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 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
27 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
28 if(damage_goodhits && self.minstanex_lasthit)
30 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_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 NUM_TEAM_1: // 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 NUM_TEAM_2: // 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 NUM_TEAM_3: // 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 NUM_TEAM_4: // 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 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_MINSTA_FINDAMMO);
89 e.minstagib_needammo = FALSE;
91 void minstagib_ammocheck(void)
93 if (time < self.minstagib_nextthink)
96 if (self.deadflag || gameover || (self.flags & FL_GODMODE))
97 minstagib_stop_countdown(self);
98 else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
100 minstagib_stop_countdown(self);
105 self.minstagib_needammo = TRUE;
106 if (self.health == 5)
108 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
109 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_MINSTAGIB_TERMINATED);
111 else if (self.health == 10)
113 Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
114 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
116 else if (self.health == 20)
118 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
119 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
121 else if (self.health == 30)
123 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
124 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
126 else if (self.health == 40)
128 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
129 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
131 else if (self.health == 50)
133 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
134 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
136 else if (self.health == 60)
138 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
139 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
141 else if (self.health == 70)
143 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
144 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
146 else if (self.health == 80)
148 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
149 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
151 else if (self.health == 90)
153 Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO);
154 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
155 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
157 else if (self.health == 100)
159 Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_MINSTA_FINDAMMO);
160 Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
163 self.minstagib_nextthink = time + 1;
166 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
168 float w_minstanex(float req)
171 float minstanex_ammo;
173 // now multiple WR_s use this
177 minstanex_ammo = autocvar_g_balance_minstanex_ammo;
181 if(self.ammo_cells > 0)
182 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
184 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
186 else if (req == WR_THINK)
188 // if the laser uses load, we also consider its ammo for reloading
189 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
190 weapon_action(self.weapon, WR_RELOAD);
191 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
192 weapon_action(self.weapon, WR_RELOAD);
193 else if (self.BUTTON_ATCK)
195 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
197 W_MinstaNex_Attack();
198 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
201 else if (self.BUTTON_ATCK2)
203 if (self.jump_interval <= time)
204 if (weapon_prepareattack(1, -1))
206 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
207 self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
209 // decrease ammo for the laser?
210 if(autocvar_g_balance_minstanex_laser_ammo)
211 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
213 // ugly minstagib hack to reuse the fire mode of the laser
216 self.weapon = WEP_LASER;
220 // now do normal refire
221 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
225 else if (req == WR_PRECACHE)
227 precache_model ("models/nexflash.md3");
228 precache_model ("models/weapons/g_minstanex.md3");
229 precache_model ("models/weapons/v_minstanex.md3");
230 precache_model ("models/weapons/h_minstanex.iqm");
231 precache_sound ("weapons/minstanexfire.wav");
232 precache_sound ("weapons/nexwhoosh1.wav");
233 precache_sound ("weapons/nexwhoosh2.wav");
234 precache_sound ("weapons/nexwhoosh3.wav");
235 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
236 w_laser(WR_PRECACHE);
238 else if (req == WR_SETUP)
240 weapon_setup(WEP_MINSTANEX);
241 self.current_ammo = ammo_cells;
242 self.minstanex_lasthit = 0;
244 else if (req == WR_CHECKAMMO1)
246 ammo_amount = self.ammo_cells >= minstanex_ammo;
247 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
250 else if (req == WR_CHECKAMMO2)
252 if(!autocvar_g_balance_minstanex_laser_ammo)
254 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
255 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
258 else if (req == WR_RESETPLAYER)
260 self.minstanex_lasthit = 0;
262 else if (req == WR_RELOAD)
265 if(autocvar_g_balance_minstanex_laser_ammo)
266 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
268 used_ammo = minstanex_ammo;
270 W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
272 else if (req == WR_SUICIDEMESSAGE)
274 return WEAPON_THINKING_WITH_PORTALS;
276 else if (req == WR_KILLMESSAGE)
278 return WEAPON_MINSTANEX_MURDER;
284 float w_minstanex(float req)
286 if(req == WR_IMPACTEFFECT)
289 org2 = w_org + w_backoff * 6;
290 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
292 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
294 else if(req == WR_PRECACHE)
296 precache_sound("weapons/neximpact.wav");