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