3 /* WEP_##id */ MINSTANEX,
4 /* function */ w_minstanex,
5 /* ammotype */ IT_CELLS,
7 /* flags */ WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN,
8 /* rating */ BOT_PICKUP_RATING_HIGH,
9 /* model */ "minstanex",
10 /* netname */ "minstanex",
11 /* fullname */ _("MinstaNex")
15 .float minstanex_lasthit;
20 void spawnfunc_weapon_minstanex (void) { weapon_defaultspawnfunc(WEP_MINSTANEX); }
22 void W_MinstaNex_Attack (void)
25 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
27 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
31 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
34 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
35 if(damage_goodhits && self.minstanex_lasthit)
37 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
38 damage_goodhits = 0; // only every second time
41 self.minstanex_lasthit = damage_goodhits;
43 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
45 // teamcolor / hit beam effect
47 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
50 case NUM_TEAM_1: // 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 NUM_TEAM_2: // 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 NUM_TEAM_3: // 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 NUM_TEAM_4: // Pink
70 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
72 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
76 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
78 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
82 W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo);
85 float w_minstanex(float req)
90 // now multiple WR_s use this
91 minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo);
97 if(self.ammo_cells > 0)
98 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
100 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), FALSE); // WEAPONTODO: replace with proper minstanex cvars
106 // if the laser uses load, we also consider its ammo for reloading
107 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
108 WEP_ACTION(self.weapon, WR_RELOAD);
109 else if(autocvar_g_balance_minstanex_reload_ammo && self.clip_load < minstanex_ammo) // forced reload
110 WEP_ACTION(self.weapon, WR_RELOAD);
111 else if (self.BUTTON_ATCK)
113 if (weapon_prepareattack(0, autocvar_g_balance_minstanex_refire))
115 W_MinstaNex_Attack();
116 weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_minstanex_animtime, w_ready);
119 else if (self.BUTTON_ATCK2)
121 if (self.jump_interval <= time)
122 if (weapon_prepareattack(1, -1))
124 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
125 self.jump_interval = time + autocvar_g_balance_minstanex_laser_refire * W_WeaponRateFactor();
127 // decrease ammo for the laser?
128 if(autocvar_g_balance_minstanex_laser_ammo)
129 W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_laser_ammo, autocvar_g_balance_minstanex_reload_ammo);
131 // ugly minstagib hack to reuse the fire mode of the laser
134 self.weapon = WEP_BLASTER;
135 W_Blaster_Attack( // WEAPONTODO: replace with proper minstanex cvars
136 WEP_CVAR_PRI(blaster, shotangle),
137 WEP_CVAR_PRI(blaster, damage),
138 WEP_CVAR_PRI(blaster, edgedamage),
139 WEP_CVAR_PRI(blaster, radius),
140 WEP_CVAR_PRI(blaster, force),
141 WEP_CVAR_PRI(blaster, speed),
142 WEP_CVAR_PRI(blaster, spread),
143 WEP_CVAR_PRI(blaster, delay),
144 WEP_CVAR_PRI(blaster, lifetime)
148 // now do normal refire
149 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_minstanex_laser_animtime, w_ready);
157 precache_model ("models/nexflash.md3");
158 precache_model ("models/weapons/g_minstanex.md3");
159 precache_model ("models/weapons/v_minstanex.md3");
160 precache_model ("models/weapons/h_minstanex.iqm");
161 precache_sound ("weapons/minstanexfire.wav");
162 precache_sound ("weapons/nexwhoosh1.wav");
163 precache_sound ("weapons/nexwhoosh2.wav");
164 precache_sound ("weapons/nexwhoosh3.wav");
165 W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
170 self.current_ammo = ammo_cells;
171 self.minstanex_lasthit = 0;
176 ammo_amount = self.ammo_cells >= minstanex_ammo;
177 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
182 if(!autocvar_g_balance_minstanex_laser_ammo)
184 ammo_amount = self.ammo_cells >= autocvar_g_balance_minstanex_laser_ammo;
185 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= autocvar_g_balance_minstanex_laser_ammo;
190 self.minstanex_lasthit = 0;
196 if(autocvar_g_balance_minstanex_laser_ammo)
197 used_ammo = min(minstanex_ammo, autocvar_g_balance_minstanex_laser_ammo);
199 used_ammo = minstanex_ammo;
201 W_Reload(used_ammo, "weapons/reload.wav");
204 case WR_SUICIDEMESSAGE:
206 return WEAPON_THINKING_WITH_PORTALS;
210 return WEAPON_MINSTANEX_MURDER;
217 float w_minstanex(float req)
221 case WR_IMPACTEFFECT:
224 org2 = w_org + w_backoff * 6;
225 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
227 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
233 precache_sound("weapons/neximpact.wav");