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