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