]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/w_seeker.qc
make ifeq/ifneq work with spaces
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / w_seeker.qc
1 #ifdef REGISTER_WEAPON
2 REGISTER_WEAPON(SEEKER, w_seeker, IT_ROCKETS, 8, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_SPLASH, BOT_PICKUP_RATING_MID, "seeker", "seeker", _("T.A.G. Seeker"))
3 #else
4 #ifdef SVQC
5 //.float proxytime; = autoswitch
6 //.float tl; = wait
7 .entity tag_target, wps_tag_tracker;
8 .float tag_time;
9
10 // ============================
11 // Begin: Missile functions, these are general functions to be manipulated by other code
12 // ============================
13 void Seeker_Missile_Explode ()
14 {
15         self.event_damage = SUB_Null;
16         RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_missile_damage, autocvar_g_balance_seeker_missile_edgedamage, autocvar_g_balance_seeker_missile_radius, world, autocvar_g_balance_seeker_missile_force, self.projectiledeathtype, other);
17
18         remove (self);
19 }
20
21 void Seeker_Missile_Touch()
22 {
23         PROJECTILE_TOUCH;
24
25         Seeker_Missile_Explode();
26 }
27
28 void Seeker_Missile_Think()
29 {
30         entity e;
31         vector desireddir, olddir, newdir, eorg;
32         float turnrate;
33         float dist;
34         float spd;
35
36         if (time > self.cnt)
37         {
38                 self.projectiledeathtype |= HITTYPE_SPLASH;
39                 Seeker_Missile_Explode();
40         }
41
42         spd = vlen(self.velocity);
43         spd = bound(
44                 spd - autocvar_g_balance_seeker_missile_decel * frametime,
45                 autocvar_g_balance_seeker_missile_speed_max,
46                 spd + autocvar_g_balance_seeker_missile_accel * frametime
47         );
48
49         if (self.enemy != world)
50                 if (self.enemy.takedamage != DAMAGE_AIM || self.enemy.deadflag != DEAD_NO)
51                         self.enemy = world;
52
53         if (self.enemy != world)
54         {
55                 e               = self.enemy;
56                 eorg            = 0.5 * (e.absmin + e.absmax);
57                 turnrate        = autocvar_g_balance_seeker_missile_turnrate; // how fast to turn
58                 desireddir      = normalize(eorg - self.origin);
59                 olddir          = normalize(self.velocity); // get my current direction
60                 dist            = vlen(eorg - self.origin);
61
62                 // Do evasive maneuvers for world objects? ( this should be a cpu hog. :P )
63                 if (autocvar_g_balance_seeker_missile_smart && (dist > autocvar_g_balance_seeker_missile_smart_mindist))
64                 {
65                         // Is it a better idea (shorter distance) to trace to the target itself?
66                         if ( vlen(self.origin + olddir * self.wait) < dist)
67                                 traceline(self.origin, self.origin + olddir * self.wait, FALSE, self);
68                         else
69                                 traceline(self.origin, eorg, FALSE, self);
70
71                         // Setup adaptive tracelength
72                         self.wait = bound(autocvar_g_balance_seeker_missile_smart_trace_min, vlen(self.origin - trace_endpos), self.wait = autocvar_g_balance_seeker_missile_smart_trace_max);
73
74                         // Calc how important it is that we turn and add this to the desierd (enemy) dir.
75                         desireddir  = normalize(((trace_plane_normal * (1 - trace_fraction)) + (desireddir * trace_fraction)) * 0.5);
76                 }
77                 
78                 newdir = normalize(olddir + desireddir * turnrate); // take the average of the 2 directions; not the best method but simple & easy
79                 self.velocity = newdir * spd; // make me fly in the new direction at my flight speed
80         }
81         else
82                 dist = 0;
83
84         // Proxy
85         if (autocvar_g_balance_seeker_missile_proxy)
86         {
87                 if ( dist <= autocvar_g_balance_seeker_missile_proxy_maxrange)
88                 {
89                         if (self.autoswitch == 0)
90                         {
91                                 self.autoswitch = time + autocvar_g_balance_seeker_missile_proxy_delay;
92                         }
93                         else
94                         {
95                                 if (self.autoswitch <= time)
96                                 {
97                                         Seeker_Missile_Explode();
98                                         self.autoswitch = 0;
99                                 }
100                         }
101                 }
102                 else
103                 {
104                         if (self.autoswitch != 0)
105                                 self.autoswitch = 0;
106                 }
107         }
108         ///////////////
109
110         if (self.enemy.deadflag != DEAD_NO)
111         {
112                 self.enemy = world;
113                 self.cnt = time + 1 + (random() * 4);
114                 self.nextthink = self.cnt;
115                 return;
116         }
117
118         //self.angles = vectoangles(self.velocity);                     // turn model in the new flight direction
119         self.nextthink = time;// + 0.05; // csqc projectiles
120         UpdateCSQCProjectile(self);
121 }
122
123
124
125 void Seeker_Missile_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
126 {
127         if (self.health <= 0)
128                 return;
129                 
130         if (!W_CheckProjectileDamage(inflictor.realowner, self.realowner, deathtype, -1)) // no exceptions
131                 return; // g_projectiles_damage says to halt
132
133         if (self.realowner == attacker)
134                 self.health = self.health - (damage * 0.25);
135         else
136                 self.health = self.health - damage;
137                 
138         if (self.health <= 0)
139                 W_PrepareExplosionByDamage(attacker, Seeker_Missile_Explode);
140 }
141
142 /*
143 void Seeker_Missile_Animate()
144 {
145         self.frame = self.frame +1;
146         self.nextthink = time + 0.05;
147
148         if (self.enemy != world)
149                 if (self.enemy.takedamage != DAMAGE_AIM || self.enemy.deadflag != DEAD_NO)
150                         self.enemy = world;
151
152         if(self.frame == 5)
153         {
154                 self.think           = Seeker_Missile_Think;
155                 self.nextthink       = time;// + cvar("g_balance_seeker_missile_activate_delay"); // cant dealy with csqc projectiles
156
157                 if (autocvar_g_balance_seeker_missile_proxy)
158                         self.movetype    = MOVETYPE_BOUNCEMISSILE;
159                 else
160                         self.movetype    = MOVETYPE_FLYMISSILE;
161         }
162
163         UpdateCSQCProjectile(self);
164 }
165 */
166
167 void Seeker_Fire_Missile(vector f_diff, entity m_target)
168 {
169         entity missile;
170
171         W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_reload_ammo);
172
173         makevectors(self.v_angle);
174         W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/seeker_fire.wav", CH_WEAPON_A, 0);
175         w_shotorg += f_diff;
176         pointparticles(particleeffectnum("seeker_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
177
178         //self.detornator         = FALSE;
179
180         missile                 = spawn();
181         missile.owner           = missile.realowner = self;
182         missile.classname       = "seeker_missile";
183         missile.bot_dodge       = TRUE;
184         missile.bot_dodgerating = autocvar_g_balance_seeker_missile_damage;
185
186         missile.think           = Seeker_Missile_Think;
187         missile.touch           = Seeker_Missile_Touch;
188         missile.event_damage    = Seeker_Missile_Damage;
189         missile.nextthink       = time;// + 0.2;// + cvar("g_balance_seeker_missile_activate_delay");
190         missile.cnt             = time + autocvar_g_balance_seeker_missile_lifetime;
191         missile.enemy           = m_target;
192         missile.solid           = SOLID_BBOX;
193         missile.scale           = 2;
194         missile.takedamage      = DAMAGE_YES;
195         missile.health          = autocvar_g_balance_seeker_missile_health;
196         missile.damageforcescale = autocvar_g_balance_seeker_missile_damageforcescale;
197         missile.damagedbycontents = TRUE;
198         //missile.think           = Seeker_Missile_Animate; // csqc projectiles.
199         
200         if (missile.enemy != world)
201                 missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
202         else 
203                 missile.projectiledeathtype = WEP_SEEKER;
204
205
206         setorigin (missile, w_shotorg);
207         setsize (missile, '-4 -4 -4', '4 4 4');
208         missile.movetype    = MOVETYPE_FLYMISSILE;
209         missile.flags       = FL_PROJECTILE;
210         missile.missile_flags = MIF_SPLASH | MIF_GUIDED_TAG;
211         
212         W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_missile);
213
214         missile.angles = vectoangles (missile.velocity);
215
216         CSQCProjectile(missile, FALSE, PROJECTILE_SEEKER, TRUE);
217
218         other = missile; MUTATOR_CALLHOOK(EditProjectile);
219 }
220
221 // ============================
222 // Begin: FLAC, close range attack meant for defeating rockets which are coming at you. 
223 // ============================
224 void Seeker_Flac_Explode ()
225 {
226         self.event_damage = SUB_Null;
227
228         RadiusDamage (self, self.realowner, autocvar_g_balance_seeker_flac_damage, autocvar_g_balance_seeker_flac_edgedamage, autocvar_g_balance_seeker_flac_radius, world, autocvar_g_balance_seeker_flac_force, self.projectiledeathtype, other);
229
230         remove (self);
231 }
232
233 void Seeker_Flac_Touch()
234 {
235         PROJECTILE_TOUCH;
236
237         Seeker_Flac_Explode();
238 }
239
240 void Seeker_Fire_Flac()
241 {
242         entity missile;
243         vector f_diff;
244         float c;
245
246         W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_flac_ammo, autocvar_g_balance_seeker_reload_ammo);
247
248         c = mod(self.bulletcounter, 4);
249         switch(c)
250         {
251                 case 0:
252                         f_diff = '-1.25 -3.75 0';
253                         break;
254                 case 1:
255                         f_diff = '+1.25 -3.75 0';
256                         break;
257                 case 2:
258                         f_diff = '-1.25 +3.75 0';
259                         break;
260                 case 3:
261                 default:
262                         f_diff = '+1.25 +3.75 0';
263                         break;
264         }
265         W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/flac_fire.wav", CH_WEAPON_A, autocvar_g_balance_seeker_flac_damage);
266         w_shotorg += f_diff;
267
268         pointparticles(particleeffectnum("hagar_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
269
270         missile                                 = spawn ();
271         missile.owner                   = missile.realowner = self;
272         missile.classname               = "missile";
273         missile.bot_dodge               = TRUE;
274         missile.bot_dodgerating = autocvar_g_balance_seeker_flac_damage;
275         missile.touch                   = Seeker_Flac_Explode;
276         missile.use                     = Seeker_Flac_Explode; 
277         missile.think                   = adaptor_think2use_hittype_splash;
278         missile.nextthink               = time + autocvar_g_balance_seeker_flac_lifetime + autocvar_g_balance_seeker_flac_lifetime_rand;
279         missile.solid                   = SOLID_BBOX;
280         missile.movetype                = MOVETYPE_FLY; 
281         missile.projectiledeathtype = WEP_SEEKER;
282         missile.projectiledeathtype = WEP_SEEKER | HITTYPE_SECONDARY;
283         missile.flags                           = FL_PROJECTILE;
284         missile.missile_flags       = MIF_SPLASH; 
285         
286         // csqc projectiles
287         //missile.angles                                = vectoangles (missile.velocity);       
288         //missile.scale = 0.4; // BUG: the model is too big 
289         
290         setorigin (missile, w_shotorg);
291         setsize (missile, '-2 -2 -2', '2 2 2');
292                 
293         W_SETUPPROJECTILEVELOCITY_UP(missile, g_balance_seeker_flac);
294         CSQCProjectile(missile, TRUE, PROJECTILE_FLAC, TRUE);
295
296         other = missile; MUTATOR_CALLHOOK(EditProjectile);
297 }
298
299 // ============================
300 // Begin: Tag and rocket controllers 
301 // ============================
302 entity Seeker_Tagged_Info(entity isowner, entity istarget)
303 {
304         entity tag;
305         for(tag = world; (tag = find(tag, classname, "tag_tracker")); ) 
306                 if ((tag.realowner == isowner) && (tag.tag_target == istarget))
307                         return tag;
308                 
309         return world;
310 }
311
312 void Seeker_Attack()
313 {
314         entity tracker, closest_target;
315         
316         closest_target = world;
317         for(tracker = world; (tracker = find(tracker, classname, "tag_tracker")); ) if (tracker.realowner == self)
318         {
319                 if (closest_target)
320                 {
321                         if (vlen(self.origin - tracker.tag_target.origin) < vlen(self.origin - closest_target.origin))
322                                 closest_target = tracker.tag_target;
323                 }
324                 else 
325                         closest_target = tracker.tag_target;
326         }
327                 
328         traceline(self.origin + self.view_ofs, closest_target.origin, MOVE_NOMONSTERS, self);
329         if ((!closest_target) || ((trace_fraction < 1) && (trace_ent != closest_target)))
330                 closest_target = world;
331         
332         Seeker_Fire_Missile('0 0 0', closest_target);
333 }
334
335 void Seeker_Vollycontroller_Think() // TODO: Merge this with Seeker_Attack
336 {
337         float c;
338         entity oldself,oldenemy;
339         self.cnt = self.cnt - 1;
340
341         if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.ammo_rockets < autocvar_g_balance_seeker_missile_ammo) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER))
342         {
343                 remove(self);
344                 return;
345         }
346
347         self.nextthink = time + autocvar_g_balance_seeker_missile_delay * W_WeaponRateFactor();
348         
349         oldself = self;
350         self = self.realowner;
351         
352         oldenemy = self.enemy;
353         self.enemy = oldself.enemy;
354         
355         c = mod(self.cnt, 4);
356         switch(c)
357         {
358                 case 0:
359                         Seeker_Fire_Missile('-1.25 -3.75 0', self.enemy);
360                         break;
361                 case 1:
362                         Seeker_Fire_Missile('+1.25 -3.75 0', self.enemy);
363                         break;
364                 case 2:
365                         Seeker_Fire_Missile('-1.25 +3.75 0', self.enemy);
366                         break;
367                 case 3:
368                 default:
369                         Seeker_Fire_Missile('+1.25 +3.75 0', self.enemy);
370                         break;
371         }
372
373         self.enemy = oldenemy;
374         self = oldself;
375 }
376
377 void Seeker_Tracker_Think() 
378 {
379         // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
380         if ((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER)
381         || (time > self.tag_time + autocvar_g_balance_seeker_tag_tracker_lifetime))
382         {
383                 if (self)
384                 {
385                         WaypointSprite_Kill(self.tag_target.wps_tag_tracker);
386                         remove(self);
387                 }
388                 return;
389         }
390         
391         // Update the think method information
392         self.nextthink = time;
393 }
394
395 // ============================
396 // Begin: Tag projectile 
397 // ============================
398 void Seeker_Tag_Explode ()
399 {
400         //if(other==self.realowner)
401         //    return;
402         Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER | HITTYPE_BOUNCE, other.species, self);
403
404         remove (self);
405 }
406
407 void Seeker_Tag_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force)
408 {
409         if (self.health <= 0)
410                 return;
411         self.health = self.health - damage;
412         if (self.health <= 0)
413                 Seeker_Tag_Explode();
414 }
415
416 void Seeker_Tag_Touch()
417 {
418         vector dir;
419         vector org2;
420         entity e;
421         
422         PROJECTILE_TOUCH;
423
424         dir     = normalize (self.realowner.origin - self.origin);
425         org2    = findbetterlocation (self.origin, 8);
426
427         te_knightspike(org2);
428
429         self.event_damage = SUB_Null;
430         Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER | HITTYPE_HEADSHOT, other.species, self);
431
432         if (other.takedamage == DAMAGE_AIM && other.deadflag == DEAD_NO)
433         {
434                 // check to see if this person is already tagged by me
435                 entity tag = Seeker_Tagged_Info(self.realowner, other);
436                 
437                 if (tag != world)
438                 {
439                         if (other.wps_tag_tracker && (autocvar_g_balance_seeker_type == 1)) // don't attach another waypointsprite without killing the old one first
440                                 WaypointSprite_Kill(other.wps_tag_tracker);
441                                 
442                         tag.tag_time = time;
443                 }
444                 else
445                 {               
446                         //sprint(self.realowner, strcat("You just tagged ^2", other.netname, "^7 with a tracking device!\n"));
447                         e             = spawn();
448                         e.cnt         = autocvar_g_balance_seeker_missile_count;
449                         e.classname   = "tag_tracker";
450                         e.owner       = self.owner;
451                         e.realowner   = self.realowner;
452                         
453                         if      (autocvar_g_balance_seeker_type == 1)
454                         {
455                                 e.tag_target  = other;
456                                 e.tag_time    = time;
457                                 e.think       = Seeker_Tracker_Think;
458                         }
459                         else 
460                         {
461                                 e.enemy     = other;
462                                 e.think     = Seeker_Vollycontroller_Think;
463                         }
464                         
465                         e.nextthink   = time;
466                 }
467                 
468                 if      (autocvar_g_balance_seeker_type == 1)
469                 {
470                         WaypointSprite_Spawn("tagged-target", autocvar_g_balance_seeker_tag_tracker_lifetime, 0, other, '0 0 64', self.realowner, 0, other, wps_tag_tracker, TRUE, RADARICON_TAGGED, '0.5 1 0');
471                         WaypointSprite_UpdateRule(other.wps_tag_tracker, 0, SPRITERULE_DEFAULT);
472                 }
473         }
474
475         remove(self);
476         return;
477 }
478
479 void Seeker_Fire_Tag()
480 {
481         entity missile;
482         W_DecreaseAmmo(ammo_rockets, autocvar_g_balance_seeker_tag_ammo, autocvar_g_balance_seeker_reload_ammo);
483
484         W_SetupShot_ProjectileSize (self, '-2 -2 -2', '2 2 2', FALSE, 2, "weapons/tag_fire.wav", CH_WEAPON_A, autocvar_g_balance_seeker_missile_damage * autocvar_g_balance_seeker_missile_count);
485
486         missile                 = spawn();
487         missile.owner           = missile.realowner = self;
488         missile.classname       = "seeker_tag";
489         missile.bot_dodge       = TRUE;
490         missile.bot_dodgerating = 50;
491         missile.touch           = Seeker_Tag_Touch;
492         missile.think           = SUB_Remove;
493         missile.nextthink       = time + autocvar_g_balance_seeker_tag_lifetime;
494         missile.movetype        = MOVETYPE_FLY;
495         missile.solid           = SOLID_BBOX;
496
497         missile.takedamage       = DAMAGE_YES;
498         missile.event_damage    = Seeker_Tag_Explode;
499         missile.health          = autocvar_g_balance_seeker_tag_health;
500         missile.damageforcescale = autocvar_g_balance_seeker_tag_damageforcescale;
501
502         setorigin (missile, w_shotorg);
503         setsize (missile, '-2 -2 -2', '2 2 2');
504
505         missile.flags       = FL_PROJECTILE;
506         //missile.missile_flags = MIF_..?; 
507
508         missile.movetype    = MOVETYPE_FLY;
509         W_SETUPPROJECTILEVELOCITY(missile, g_balance_seeker_tag);
510         missile.angles = vectoangles (missile.velocity);
511
512         CSQCProjectile(missile, TRUE, PROJECTILE_TAG, FALSE); // has sound
513
514         other = missile; MUTATOR_CALLHOOK(EditProjectile);
515 }
516
517 // ============================
518 // Begin: Genereal weapon functions
519 // ============================
520 void spawnfunc_weapon_seeker (void)
521 {
522         weapon_defaultspawnfunc(WEP_SEEKER);
523 }
524
525 float w_seeker(float req)
526 {
527         float ammo_amount;
528
529         if (req == WR_AIM)
530         {
531                 if (autocvar_g_balance_seeker_type == 1) 
532                         if (Seeker_Tagged_Info(self, self.enemy) != world)
533                                 self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_missile_speed_max, 0, autocvar_g_balance_seeker_missile_lifetime, FALSE);
534                         else
535                                 self.BUTTON_ATCK2 = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
536                 else
537                         self.BUTTON_ATCK = bot_aim(autocvar_g_balance_seeker_tag_speed, 0, autocvar_g_balance_seeker_tag_lifetime, FALSE);
538         }
539         else if (req == WR_THINK)
540         {
541                 if(autocvar_g_balance_seeker_reload_ammo && self.clip_load < min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo)) // forced reload
542                         weapon_action(self.weapon, WR_RELOAD);
543                         
544                 else if (self.BUTTON_ATCK)
545                 {
546                         if (autocvar_g_balance_seeker_type == 1) 
547                         {
548                                 if (weapon_prepareattack(0, autocvar_g_balance_seeker_missile_refire))
549                                 {
550                                         Seeker_Attack();
551                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_missile_animtime, w_ready);
552                                 }
553                         }
554                         else 
555                         {
556                                 if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
557                                 {
558                                         Seeker_Fire_Tag();
559                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
560                                 }
561                         }
562                 }
563
564                 else if (self.BUTTON_ATCK2)
565                 {
566                         if (autocvar_g_balance_seeker_type == 1) 
567                         {
568                                 if (weapon_prepareattack(0, autocvar_g_balance_seeker_tag_refire))
569                                 {
570                                         Seeker_Fire_Tag();
571                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_tag_animtime, w_ready);
572                                 }
573                         }
574                         else 
575                         {
576                                 if (weapon_prepareattack(0, autocvar_g_balance_seeker_flac_refire))
577                                 {
578                                         Seeker_Fire_Flac();
579                                         weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_seeker_flac_animtime, w_ready);
580                                 }
581                         }
582                 }
583         }
584         else if (req == WR_PRECACHE)
585         {
586                 precache_model ("models/weapons/g_seeker.md3");
587                 precache_model ("models/weapons/v_seeker.md3");
588                 precache_model ("models/weapons/h_seeker.iqm");
589                 precache_sound ("weapons/tag_fire.wav");
590                 precache_sound ("weapons/flac_fire.wav");
591                 precache_sound ("weapons/seeker_fire.wav");
592                 //precache_sound ("weapons/reload.wav"); // until weapons have individual reload sounds, precache the reload sound somewhere else
593         }
594         else if (req == WR_SETUP)
595         {
596                 weapon_setup(WEP_SEEKER);
597                 self.current_ammo = ammo_rockets;
598         }
599         else if (req == WR_CHECKAMMO1)
600         {
601                 ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_missile_ammo;
602                 ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_missile_ammo;
603                 return ammo_amount;
604         }
605         else if (req == WR_CHECKAMMO2)
606         {
607                 ammo_amount = self.ammo_rockets >= autocvar_g_balance_seeker_tag_ammo;
608                 ammo_amount += self.(weapon_load[WEP_SEEKER]) >= autocvar_g_balance_seeker_tag_ammo;
609                 return ammo_amount;
610         }
611         else if (req == WR_RELOAD)
612         {
613                 W_Reload(min(autocvar_g_balance_seeker_missile_ammo, autocvar_g_balance_seeker_tag_ammo), autocvar_g_balance_seeker_reload_ammo, autocvar_g_balance_seeker_reload_time, "weapons/reload.wav");
614         }
615         return TRUE;
616 }
617 #endif
618 #ifdef CSQC
619 float w_seeker(float req)
620 {
621         if(req == WR_IMPACTEFFECT)
622         {
623                 vector org2;
624                 org2 = w_org + w_backoff * 6;
625                 if(w_deathtype & HITTYPE_BOUNCE)
626                 {
627                         pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
628                         if(!w_issilent)
629                         {
630                                 if (w_random<0.15)
631                                         sound(self, CH_SHOTS, "weapons/tagexp1.wav", 1, ATTN_NORM);
632                                 else if (w_random<0.7)
633                                         sound(self, CH_SHOTS, "weapons/tagexp2.wav", 1, ATTN_NORM);
634                                 else
635                                         sound(self, CH_SHOTS, "weapons/tagexp3.wav", 1, ATTN_NORM);
636                         }
637                 }
638                 else if(w_deathtype & HITTYPE_HEADSHOT)
639                 {
640                         if(!w_issilent)
641                                 sound(self, CH_SHOTS, "weapons/tag_impact.wav", 1, ATTN_NORM);
642                 }
643                 else
644                 {
645                         pointparticles(particleeffectnum("hagar_explode"), org2, '0 0 0', 1);
646                         if(!w_issilent)
647                         {
648                                 if (w_random<0.15)
649                                         sound(self, CH_SHOTS, "weapons/seekerexp1.wav", 1, ATTN_NORM);
650                                 else if (w_random<0.7)
651                                         sound(self, CH_SHOTS, "weapons/seekerexp2.wav", 1, ATTN_NORM);
652                                 else
653                                         sound(self, CH_SHOTS, "weapons/seekerexp3.wav", 1, ATTN_NORM);
654                         }
655                 }
656         }
657         else if(req == WR_PRECACHE)
658         {
659                 precache_sound("weapons/seekerexp1.wav");
660                 precache_sound("weapons/seekerexp2.wav");
661                 precache_sound("weapons/seekerexp3.wav");
662                 precache_sound("weapons/tagexp1.wav");
663                 precache_sound("weapons/tagexp2.wav");
664                 precache_sound("weapons/tagexp3.wav");
665                 precache_sound("weapons/tag_impact.wav");
666         }
667         else if (req == WR_SUICIDEMESSAGE)
668                 w_deathtypestring = _("%s played with tiny seeker rockets");
669         else if (req == WR_KILLMESSAGE)
670         {
671                 if(w_deathtype & HITTYPE_SECONDARY)
672                         w_deathtypestring = _("%s was tagged with a seeker by %s");
673                 else
674                         w_deathtypestring = _("%s was pummeled with seeker rockets by %s");
675         }
676         return TRUE;
677 }
678 #endif
679 #endif