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