2 REGISTER_WEAPON(CRYLINK, w_crylink, IT_CELLS, 6, WEP_FLAG_NORMAL | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "crylink", "crylink", "Crylink");
10 // force projectile to explode
11 void W_Crylink_LinkExplode (entity e, entity e2)
14 a = bound(0, 1 - (time - e.fade_time) * e.fade_rate, 1);
16 RadiusDamage (e, e.realowner, cvar("g_balance_crylink_primary_damage") * a, cvar("g_balance_crylink_primary_edgedamage") * a, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * a, e.projectiledeathtype, other);
19 W_Crylink_LinkExplode(e.queuenext, e2);
23 // NO bounce protection, as bounces are limited!
24 void W_Crylink_Touch (void)
29 local entity savenext, saveprev;
30 savenext = self.queuenext;
31 saveprev = self.queueprev;
32 if(WarpZone_Projectile_Touch())
36 savenext.queueprev = saveprev;
37 saveprev.queuenext = savenext;
43 a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
45 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
49 f = cvar("g_balance_crylink_primary_bouncedamagefactor");
52 if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage") * f, cvar("g_balance_crylink_primary_edgedamage") * f, cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force") * f, self.projectiledeathtype, other) || finalhit)
54 W_Crylink_LinkExplode(self.queuenext, self);
58 self.cnt = self.cnt - 1;
59 self.angles = vectoangles(self.velocity);
61 self.projectiledeathtype |= HITTYPE_BOUNCE;
62 // commented out as it causes a little hitch...
64 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
67 void W_Crylink_Touch2 (void)
72 local entity savenext, saveprev;
73 savenext = self.queuenext;
74 saveprev = self.queueprev;
75 if(WarpZone_Projectile_Touch())
79 savenext.queueprev = saveprev;
80 saveprev.queuenext = savenext;
86 a = 1 - (time - self.fade_time) * self.fade_rate;
88 finalhit = ((self.cnt <= 0) || (other.takedamage != DAMAGE_NO));
92 f = cvar("g_balance_crylink_secondary_bouncedamagefactor");
95 if (RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage") * f, cvar("g_balance_crylink_secondary_edgedamage") * f, cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force") * f, self.projectiledeathtype, other) || finalhit)
97 W_Crylink_LinkExplode(self.queuenext, self);
101 self.cnt = self.cnt - 1;
102 self.angles = vectoangles(self.velocity);
104 self.projectiledeathtype |= HITTYPE_BOUNCE;
105 // commented out as it causes a little hitch...
107 // CSQCProjectile(proj, TRUE, PROJECTILE_CRYLINK, TRUE);
110 void W_Crylink_Fadethink (void)
112 self.queuenext.queueprev = self.queueprev;
113 self.queueprev.queuenext = self.queuenext;
117 void W_Crylink_Attack (void)
119 local float counter, shots;
120 local entity proj, prevproj, firstproj;
122 vector forward, right, up;
124 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
125 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
127 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire.wav", (cvar("g_balance_crylink_primary_damage")*cvar("g_balance_crylink_primary_shots")));
132 shots = cvar("g_balance_crylink_primary_shots");
133 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
134 while (counter < shots)
137 proj.realowner = proj.owner = self;
138 proj.classname = "spike";
139 proj.bot_dodge = TRUE;
140 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
141 if(counter == 0) { // first projectile, store in firstproj for now
144 else if(counter == shots - 1) { // last projectile, link up with first projectile
145 prevproj.queuenext = proj;
146 firstproj.queueprev = proj;
147 proj.queuenext = firstproj;
148 proj.queueprev = prevproj;
150 else { // else link up with previous projectile
151 prevproj.queuenext = proj;
152 proj.queueprev = prevproj;
157 proj.movetype = MOVETYPE_BOUNCEMISSILE;
158 PROJECTILE_MAKETRIGGER(proj);
159 proj.projectiledeathtype = WEP_CRYLINK;
160 //proj.gravity = 0.001;
162 setorigin (proj, w_shotorg);
163 setsize(proj, '0 0 0', '0 0 0');
171 makevectors('0 360 0' * (0.75 + (counter - 0.5) / (shots - 1)));
175 s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor;
176 W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0);
177 proj.touch = W_Crylink_Touch;
179 proj.think = W_Crylink_Fadethink;
182 proj.fade_time = time + cvar("g_balance_crylink_primary_middle_lifetime");
183 self.fade_rate = 1 / cvar("g_balance_crylink_primary_middle_fadetime");
184 proj.nextthink = time + cvar("g_balance_crylink_primary_middle_lifetime") + cvar("g_balance_crylink_primary_middle_fadetime");
186 else if(counter <= 3)
188 proj.fade_time = time + cvar("g_balance_crylink_primary_star_lifetime");
189 self.fade_rate = 1 / cvar("g_balance_crylink_primary_star_fadetime");
190 proj.nextthink = time + cvar("g_balance_crylink_primary_star_lifetime") + cvar("g_balance_crylink_primary_star_fadetime");
194 proj.fade_time = time + cvar("g_balance_crylink_primary_other_lifetime");
195 self.fade_rate = 1 / cvar("g_balance_crylink_primary_other_fadetime");
196 proj.nextthink = time + cvar("g_balance_crylink_primary_other_lifetime") + cvar("g_balance_crylink_primary_other_fadetime");
198 proj.cnt = cvar("g_balance_crylink_primary_bounces");
199 //proj.scale = 1 + 1 * proj.cnt;
201 proj.angles = vectoangles (proj.velocity);
203 //proj.glow_size = 20;
205 proj.flags = FL_PROJECTILE;
207 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
209 other = proj; MUTATOR_CALLHOOK(EditProjectile);
211 counter = counter + 1;
215 void W_Crylink_Attack2 (void)
217 local float counter, shots;
218 local entity proj, prevproj, firstproj;
220 if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
221 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
223 W_SetupShot (self, FALSE, 2, "weapons/crylink_fire2.wav", (cvar("g_balance_crylink_secondary_damage")*cvar("g_balance_crylink_secondary_shots")));
225 shots = cvar("g_balance_crylink_secondary_shots");
226 pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
227 while (counter < shots)
230 proj.realowner = proj.owner = self;
231 proj.classname = "spike";
232 proj.bot_dodge = TRUE;
233 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
234 if(counter == 0) { // first projectile, store in firstproj for now
237 else if(counter == shots - 1) { // last projectile, link up with first projectile
238 prevproj.queuenext = proj;
239 firstproj.queueprev = proj;
240 proj.queuenext = firstproj;
241 proj.queueprev = prevproj;
243 else { // else link up with previous projectile
244 prevproj.queuenext = proj;
245 proj.queueprev = prevproj;
250 proj.movetype = MOVETYPE_BOUNCEMISSILE;
251 PROJECTILE_MAKETRIGGER(proj);
252 proj.projectiledeathtype = WEP_CRYLINK | HITTYPE_SECONDARY;
253 //proj.gravity = 0.001;
255 setorigin (proj, w_shotorg);
256 setsize(proj, '0 0 0', '0 0 0');
258 W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread") * g_weaponspreadfactor), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0, 0);
259 proj.touch = W_Crylink_Touch2;
260 proj.think = W_Crylink_Fadethink;
261 if(counter == (shots - 1) / 2)
263 proj.fade_time = time + cvar("g_balance_crylink_secondary_middle_lifetime");
264 self.fade_rate = 1 / cvar("g_balance_crylink_secondary_middle_fadetime");
265 proj.nextthink = time + cvar("g_balance_crylink_secondary_middle_lifetime") + cvar("g_balance_crylink_secondary_middle_fadetime");
269 proj.fade_time = time + cvar("g_balance_crylink_secondary_line_lifetime");
270 self.fade_rate = 1 / cvar("g_balance_crylink_secondary_line_fadetime");
271 proj.nextthink = time + cvar("g_balance_crylink_secondary_line_lifetime") + cvar("g_balance_crylink_secondary_line_fadetime");
273 proj.cnt = cvar("g_balance_crylink_secondary_bounces");
274 //proj.scale = 1 + 1 * proj.cnt;
276 proj.angles = vectoangles (proj.velocity);
278 //proj.glow_size = 20;
280 proj.flags = FL_PROJECTILE;
282 CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
284 other = proj; MUTATOR_CALLHOOK(EditProjectile);
286 counter = counter + 1;
290 void spawnfunc_weapon_crylink (void)
292 weapon_defaultspawnfunc(WEP_CRYLINK);
295 float w_crylink(float req)
300 self.BUTTON_ATCK = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_middle_lifetime"), FALSE);
302 self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_crylink_secondary_speed"), 0, cvar("g_balance_crylink_secondary_middle_lifetime"), FALSE);
304 else if (req == WR_THINK)
306 if (self.BUTTON_ATCK)
307 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
310 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
312 if (self.BUTTON_ATCK2 && cvar("g_balance_crylink_secondary"))
313 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
316 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
319 else if (req == WR_PRECACHE)
321 precache_model ("models/weapons/g_crylink.md3");
322 precache_model ("models/weapons/v_crylink.md3");
323 precache_model ("models/weapons/h_crylink.iqm");
324 precache_sound ("weapons/crylink_fire.wav");
325 precache_sound ("weapons/crylink_fire2.wav");
327 else if (req == WR_SETUP)
328 weapon_setup(WEP_CRYLINK);
329 else if (req == WR_CHECKAMMO1)
330 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
331 else if (req == WR_CHECKAMMO2)
332 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
337 float w_crylink(float req)
339 if(req == WR_IMPACTEFFECT)
342 org2 = w_org + w_backoff * 2;
343 if(w_deathtype & HITTYPE_SECONDARY)
345 pointparticles(particleeffectnum("crylink_impact"), org2, '0 0 0', 1);
347 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact2.wav", VOL_BASE, ATTN_NORM);
351 pointparticles(particleeffectnum("crylink_impactbig"), org2, '0 0 0', 1);
353 sound(self, CHAN_PROJECTILE, "weapons/crylink_impact.wav", VOL_BASE, ATTN_NORM);
356 else if(req == WR_PRECACHE)
358 precache_sound("weapons/crylink_impact2.wav");
359 precache_sound("weapons/crylink_impact.wav");
361 else if (req == WR_SUICIDEMESSAGE)
363 w_deathtypestring = "%s succeeded at self-destructing themself with the Crylink";
365 else if (req == WR_KILLMESSAGE)
367 if(w_deathtype & HITTYPE_BOUNCE)
368 w_deathtypestring = "%s could not hide from %s's Crylink"; // unchecked: SPLASH (SECONDARY can't be)
369 else if(w_deathtype & HITTYPE_SPLASH)
370 w_deathtypestring = "%s was too close to %s's Crylink"; // unchecked: SECONDARY
372 w_deathtypestring = "%s took a close look at %s's Crylink"; // unchecked: SECONDARY