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