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;
23 AnnounceTo(self, "yoda");
26 AnnounceTo(self, "headshot");
28 if(damage_goodhits && self.minstanex_lasthit)
30 if(AnnounceTo(self, "impressive"))
31 damage_goodhits = 0; // only every second time
34 self.minstanex_lasthit = damage_goodhits;
36 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
38 // teamcolor / hit beam effect
40 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
45 case COLOR_TEAM1: // Red
47 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
49 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
51 case COLOR_TEAM2: // Blue
53 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
55 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
57 case COLOR_TEAM3: // Yellow
59 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
61 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
63 case COLOR_TEAM4: // Pink
65 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
67 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
72 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
74 W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo);
77 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
79 float w_minstanex(float req)
84 // now multiple WR_s use this
85 minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo);
89 if(self.ammo_cells > 0)
90 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
92 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_laser_primary_speed, 0, autocvar_g_balance_laser_primary_lifetime, FALSE);
94 else if (req == WR_THINK)
96 // if the laser uses load, we also consider its ammo for reloading
97 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
98 weapon_action(self.weapon, WR_RELOAD);
99 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
100 weapon_action(self.weapon, WR_RELOAD);
101 else if (self.BUTTON_ATCK)
103 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
105 W_MinstaNex_Attack();
106 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
109 else if (self.BUTTON_ATCK2)
111 if (self.jump_interval <= time)
112 if (weapon_prepareattack(1, -1))
114 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
115 self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
117 // decrease ammo for the laser?
118 if(autocvar_g_balance_minstanex_laser_ammo)
119 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
121 // ugly minstagib hack to reuse the fire mode of the laser
124 self.weapon = WEP_LASER;
128 // now do normal refire
129 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
133 else if (req == WR_PRECACHE)
135 precache_model ("models/nexflash.md3");
136 precache_model ("models/weapons/g_minstanex.md3");
137 precache_model ("models/weapons/v_minstanex.md3");
138 precache_model ("models/weapons/h_minstanex.iqm");
139 precache_sound ("weapons/minstanexfire.wav");
140 precache_sound ("weapons/nexwhoosh1.wav");
141 precache_sound ("weapons/nexwhoosh2.wav");
142 precache_sound ("weapons/nexwhoosh3.wav");
143 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
144 w_laser(WR_PRECACHE);
146 else if (req == WR_SETUP)
148 weapon_setup(WEP_MINSTANEX);
149 self.current_ammo = ammo_cells;
150 self.minstanex_lasthit = 0;
152 else if (req == WR_CHECKAMMO1)
154 ammo_amount = self.ammo_cells >= minstanex_ammo;
155 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
158 else if (req == WR_CHECKAMMO2)
160 if(!autocvar_g_balance_minstanex_laser_ammo)
162 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
163 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
166 else if (req == WR_RESETPLAYER)
168 self.minstanex_lasthit = 0;
170 else if (req == WR_RELOAD)
173 if(autocvar_g_balance_minstanex_laser_ammo)
174 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
176 used_ammo = minstanex_ammo;
178 W_Reload(used_ammo, autocvar_g_balance_minstanex_reload_ammo, autocvar_g_balance_minstanex_reload_time, "weapons/reload.wav");
184 float w_minstanex(float req)
186 if(req == WR_IMPACTEFFECT)
189 org2 = w_org + w_backoff * 6;
190 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
192 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
194 else if(req == WR_PRECACHE)
196 precache_sound("weapons/neximpact.wav");
198 else if (req == WR_SUICIDEMESSAGE)
199 w_deathtypestring = _("%s is now thinking with portals");
200 else if (req == WR_KILLMESSAGE)
201 w_deathtypestring = _("%s has been vaporized by %s's minstanex");