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")
14 #define MINSTANEX_SETTINGS(w_cvar,w_prop) \
15 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, ammo) \
16 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, animtime) \
17 w_cvar(WEP_MINSTANEX, minstanex, MO_PRI, refire) \
18 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, ammo) \
19 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, animtime) \
20 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, damage) \
21 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, delay) \
22 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, edgedamage) \
23 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, force) \
24 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, lifetime) \
25 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, radius) \
26 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, refire) \
27 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, shotangle) \
28 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, speed) \
29 w_cvar(WEP_MINSTANEX, minstanex, MO_SEC, spread) \
30 w_prop(WEP_MINSTANEX, minstanex, reloading_ammo, reload_ammo) \
31 w_prop(WEP_MINSTANEX, minstanex, reloading_time, reload_time) \
32 w_prop(WEP_MINSTANEX, minstanex, switchdelay_raise, switchdelay_raise) \
33 w_prop(WEP_MINSTANEX, minstanex, switchdelay_drop, switchdelay_drop)
36 MINSTANEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
37 .float minstanex_lasthit;
42 void spawnfunc_weapon_minstanex (void) { weapon_defaultspawnfunc(WEP_MINSTANEX); }
44 void W_MinstaNex_Attack (void)
47 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
49 W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", CH_WEAPON_A, 10000);
53 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
56 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
57 if(damage_goodhits && self.minstanex_lasthit)
59 Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
60 damage_goodhits = 0; // only every second time
63 self.minstanex_lasthit = damage_goodhits;
65 pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
67 // teamcolor / hit beam effect
69 v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
72 case NUM_TEAM_1: // Red
74 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
76 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
78 case NUM_TEAM_2: // Blue
80 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
82 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
84 case NUM_TEAM_3: // Yellow
86 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
88 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
90 case NUM_TEAM_4: // Pink
92 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
94 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
98 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
100 WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
104 W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo)), WEP_CVAR(minstanex, reload_ammo));
107 float w_minstanex(float req)
110 float minstanex_ammo;
112 // now multiple WR_s use this
113 minstanex_ammo = ((g_minstagib) ? 1 : WEP_CVAR_PRI(minstanex, ammo));
119 if(self.ammo_cells > 0)
120 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
122 self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(minstanex, speed), 0, WEP_CVAR_SEC(minstanex, lifetime), FALSE); // WEAPONTODO: replace with proper minstanex cvars
128 // if the laser uses load, we also consider its ammo for reloading
129 if(WEP_CVAR(minstanex, reload_ammo) && WEP_CVAR_SEC(minstanex, ammo) && self.clip_load < min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo))) // forced reload
130 WEP_ACTION(self.weapon, WR_RELOAD);
131 else if(WEP_CVAR(minstanex, reload_ammo) && self.clip_load < minstanex_ammo) // forced reload
132 WEP_ACTION(self.weapon, WR_RELOAD);
133 else if (self.BUTTON_ATCK)
135 if (weapon_prepareattack(0, WEP_CVAR_PRI(minstanex, refire)))
137 W_MinstaNex_Attack();
138 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(minstanex, animtime), w_ready);
141 else if (self.BUTTON_ATCK2)
143 if (self.jump_interval <= time)
144 if (weapon_prepareattack(1, -1))
146 // handle refire manually, so that primary and secondary can be fired without conflictions (important for minstagib)
147 self.jump_interval = time + WEP_CVAR_SEC(minstanex, refire) * W_WeaponRateFactor();
149 // decrease ammo for the laser?
150 if(WEP_CVAR_SEC(minstanex, ammo))
151 W_DecreaseAmmo(ammo_cells, WEP_CVAR_SEC(minstanex, ammo), WEP_CVAR(minstanex, reload_ammo));
153 // ugly minstagib hack to reuse the fire mode of the laser
156 self.weapon = WEP_BLASTER;
158 WEP_CVAR_SEC(minstanex, shotangle),
159 WEP_CVAR_SEC(minstanex, damage),
160 WEP_CVAR_SEC(minstanex, edgedamage),
161 WEP_CVAR_SEC(minstanex, radius),
162 WEP_CVAR_SEC(minstanex, force),
163 WEP_CVAR_SEC(minstanex, speed),
164 WEP_CVAR_SEC(minstanex, spread),
165 WEP_CVAR_SEC(minstanex, delay),
166 WEP_CVAR_SEC(minstanex, lifetime)
170 // now do normal refire
171 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(minstanex, animtime), w_ready);
179 precache_model("models/nexflash.md3");
180 precache_model("models/weapons/g_minstanex.md3");
181 precache_model("models/weapons/v_minstanex.md3");
182 precache_model("models/weapons/h_minstanex.iqm");
183 precache_sound("weapons/minstanexfire.wav");
184 precache_sound("weapons/nexwhoosh1.wav");
185 precache_sound("weapons/nexwhoosh2.wav");
186 precache_sound("weapons/nexwhoosh3.wav");
187 //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
188 MINSTANEX_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
193 self.current_ammo = ammo_cells;
194 self.minstanex_lasthit = 0;
199 ammo_amount = self.ammo_cells >= minstanex_ammo;
200 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= minstanex_ammo;
205 if(!WEP_CVAR_SEC(minstanex, ammo))
207 ammo_amount = self.ammo_cells >= WEP_CVAR_SEC(minstanex, ammo);
208 ammo_amount += self.(weapon_load[WEP_MINSTANEX]) >= WEP_CVAR_SEC(minstanex, ammo);
213 MINSTANEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
218 self.minstanex_lasthit = 0;
224 if(WEP_CVAR_SEC(minstanex, ammo))
225 used_ammo = min(minstanex_ammo, WEP_CVAR_SEC(minstanex, ammo));
227 used_ammo = minstanex_ammo;
229 W_Reload(used_ammo, "weapons/reload.wav");
232 case WR_SUICIDEMESSAGE:
234 return WEAPON_THINKING_WITH_PORTALS;
238 return WEAPON_MINSTANEX_MURDER;
245 float w_minstanex(float req)
249 case WR_IMPACTEFFECT:
252 org2 = w_org + w_backoff * 6;
253 pointparticles(particleeffectnum("nex_impact"), org2, '0 0 0', 1);
255 sound(self, CH_SHOTS, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
261 precache_sound("weapons/neximpact.wav");