]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/mutators/mutator/mutator_nades.qc
Mutators: combine headers
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / mutator_nades.qc
1 #ifndef MUTATOR_NADES_H
2 #define MUTATOR_NADES_H
3
4 .entity nade;
5 .entity fake_nade;
6 .float nade_timer;
7 .float nade_refire;
8 .float bonus_nades;
9 .float nade_special_time;
10 .float bonus_nade_score;
11 .float nade_type;
12 .string pokenade_type;
13 .entity nade_damage_target;
14 .float cvar_cl_nade_type;
15 .string cvar_cl_pokenade_type;
16 .float toss_time;
17 .float stat_healing_orb;
18 .float stat_healing_orb_alpha;
19 .float nade_show_particles;
20
21 // Remove nades that are being thrown
22 void(entity player) nades_Clear;
23
24 // Give a bonus grenade to a player
25 void(entity player, float score) nades_GiveBonus;
26 // Remove all bonus nades from a player
27 void(entity player) nades_RemoveBonus;
28
29 #endif
30 #ifdef IMPLEMENTATION
31
32 #include "../../../common/nades/all.qh"
33 #include "../../../common/gamemodes/all.qh"
34 #include "../../../common/monsters/spawn.qh"
35 #include "../../../common/monsters/sv_monsters.qh"
36 #include "../../g_subs.qh"
37
38 REGISTER_MUTATOR(nades, cvar("g_nades"))
39 {
40         MUTATOR_ONADD
41         {
42                 addstat(STAT_NADE_TIMER, AS_FLOAT, nade_timer);
43                 addstat(STAT_NADE_BONUS, AS_FLOAT, bonus_nades);
44                 addstat(STAT_NADE_BONUS_TYPE, AS_INT, nade_type);
45                 addstat(STAT_NADE_BONUS_SCORE, AS_FLOAT, bonus_nade_score);
46                 addstat(STAT_HEALING_ORB, AS_FLOAT, stat_healing_orb);
47                 addstat(STAT_HEALING_ORB_ALPHA, AS_FLOAT, stat_healing_orb_alpha);
48         }
49
50         return false;
51 }
52
53 .float nade_time_primed;
54
55 .entity nade_spawnloc;
56
57 void nade_timer_think()
58 {SELFPARAM();
59         self.skin = 8 - (self.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
60         self.nextthink = time;
61         if(!self.owner || wasfreed(self.owner))
62                 remove(self);
63 }
64
65 void nade_burn_spawn(entity _nade)
66 {
67         CSQCProjectile(_nade, true, Nades[_nade.nade_type].m_projectile[true], true);
68 }
69
70 void nade_spawn(entity _nade)
71 {
72         entity timer = spawn();
73         setmodel(timer, MDL_NADE_TIMER);
74         setattachment(timer, _nade, "");
75         timer.classname = "nade_timer";
76         timer.colormap = _nade.colormap;
77         timer.glowmod = _nade.glowmod;
78         timer.think = nade_timer_think;
79         timer.nextthink = time;
80         timer.wait = _nade.wait;
81         timer.owner = _nade;
82         timer.skin = 10;
83
84         _nade.effects |= EF_LOWPRECISION;
85
86         CSQCProjectile(_nade, true, Nades[_nade.nade_type].m_projectile[false], true);
87 }
88
89 void napalm_damage(float dist, float damage, float edgedamage, float burntime)
90 {SELFPARAM();
91         entity e;
92         float d;
93         vector p;
94
95         if ( damage < 0 )
96                 return;
97
98         RandomSelection_Init();
99         for(e = WarpZone_FindRadius(self.origin, dist, true); e; e = e.chain)
100                 if(e.takedamage == DAMAGE_AIM)
101                 if(self.realowner != e || autocvar_g_nades_napalm_selfdamage)
102                 if(!IS_PLAYER(e) || !self.realowner || DIFF_TEAM(e, self))
103                 if(!e.frozen)
104                 {
105                         p = e.origin;
106                         p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
107                         p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
108                         p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
109                         d = vlen(WarpZone_UnTransformOrigin(e, self.origin) - p);
110                         if(d < dist)
111                         {
112                                 e.fireball_impactvec = p;
113                                 RandomSelection_Add(e, 0, string_null, 1 / (1 + d), !Fire_IsBurning(e));
114                         }
115                 }
116         if(RandomSelection_chosen_ent)
117         {
118                 d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, self.origin) - RandomSelection_chosen_ent.fireball_impactvec);
119                 d = damage + (edgedamage - damage) * (d / dist);
120                 Fire_AddDamage(RandomSelection_chosen_ent, self.realowner, d * burntime, burntime, self.projectiledeathtype | HITTYPE_BOUNCE);
121                 //trailparticles(self, particleeffectnum(EFFECT_FIREBALL_LASER), self.origin, RandomSelection_chosen_ent.fireball_impactvec);
122                 Send_Effect(EFFECT_FIREBALL_LASER, self.origin, RandomSelection_chosen_ent.fireball_impactvec - self.origin, 1);
123         }
124 }
125
126
127 void napalm_ball_think()
128 {SELFPARAM();
129         if(round_handler_IsActive())
130         if(!round_handler_IsRoundStarted())
131         {
132                 remove(self);
133                 return;
134         }
135
136         if(time > self.pushltime)
137         {
138                 remove(self);
139                 return;
140         }
141
142         vector midpoint = ((self.absmin + self.absmax) * 0.5);
143         if(pointcontents(midpoint) == CONTENT_WATER)
144         {
145                 self.velocity = self.velocity * 0.5;
146
147                 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
148                         { self.velocity_z = 200; }
149         }
150
151         self.angles = vectoangles(self.velocity);
152
153         napalm_damage(autocvar_g_nades_napalm_ball_radius,autocvar_g_nades_napalm_ball_damage,
154                                   autocvar_g_nades_napalm_ball_damage,autocvar_g_nades_napalm_burntime);
155
156         self.nextthink = time + 0.1;
157 }
158
159
160 void nade_napalm_ball()
161 {SELFPARAM();
162         entity proj;
163         vector kick;
164
165         spamsound(self, CH_SHOTS, SND(FIREBALL_FIRE), VOL_BASE, ATTEN_NORM);
166
167         proj = spawn ();
168         proj.owner = self.owner;
169         proj.realowner = self.realowner;
170         proj.team = self.owner.team;
171         proj.classname = "grenade";
172         proj.bot_dodge = true;
173         proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
174         proj.movetype = MOVETYPE_BOUNCE;
175         proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
176         PROJECTILE_MAKETRIGGER(proj);
177         setmodel(proj, MDL_Null);
178         proj.scale = 1;//0.5;
179         setsize(proj, '-4 -4 -4', '4 4 4');
180         setorigin(proj, self.origin);
181         proj.think = napalm_ball_think;
182         proj.nextthink = time;
183         proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
184         proj.effects = EF_LOWPRECISION | EF_FLAME;
185
186         kick.x =(random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
187         kick.y = (random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
188         kick.z = (random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
189         proj.velocity = kick;
190
191         proj.pushltime = time + autocvar_g_nades_napalm_ball_lifetime;
192
193         proj.angles = vectoangles(proj.velocity);
194         proj.flags = FL_PROJECTILE;
195         proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
196
197         //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
198 }
199
200
201 void napalm_fountain_think()
202 {SELFPARAM();
203
204         if(round_handler_IsActive())
205         if(!round_handler_IsRoundStarted())
206         {
207                 remove(self);
208                 return;
209         }
210
211         if(time >= self.ltime)
212         {
213                 remove(self);
214                 return;
215         }
216
217         vector midpoint = ((self.absmin + self.absmax) * 0.5);
218         if(pointcontents(midpoint) == CONTENT_WATER)
219         {
220                 self.velocity = self.velocity * 0.5;
221
222                 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
223                         { self.velocity_z = 200; }
224
225                 UpdateCSQCProjectile(self);
226         }
227
228         napalm_damage(autocvar_g_nades_napalm_fountain_radius, autocvar_g_nades_napalm_fountain_damage,
229                 autocvar_g_nades_napalm_fountain_edgedamage, autocvar_g_nades_napalm_burntime);
230
231         self.nextthink = time + 0.1;
232         if(time >= self.nade_special_time)
233         {
234                 self.nade_special_time = time + autocvar_g_nades_napalm_fountain_delay;
235                 nade_napalm_ball();
236         }
237 }
238
239 void nade_napalm_boom()
240 {SELFPARAM();
241         entity fountain;
242         int c;
243         for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
244                 nade_napalm_ball();
245
246
247         fountain = spawn();
248         fountain.owner = self.owner;
249         fountain.realowner = self.realowner;
250         fountain.origin = self.origin;
251         setorigin(fountain, fountain.origin);
252         fountain.think = napalm_fountain_think;
253         fountain.nextthink = time;
254         fountain.ltime = time + autocvar_g_nades_napalm_fountain_lifetime;
255         fountain.pushltime = fountain.ltime;
256         fountain.team = self.team;
257         fountain.movetype = MOVETYPE_TOSS;
258         fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
259         fountain.bot_dodge = true;
260         fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
261         fountain.nade_special_time = time;
262         setsize(fountain, '-16 -16 -16', '16 16 16');
263         CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
264 }
265
266 void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
267 {
268         frost_target.frozen_by = freezefield.realowner;
269         Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
270         Freeze(frost_target, 1/freeze_time, 3, false);
271
272         Drop_Special_Items(frost_target);
273 }
274
275 void nade_ice_think()
276 {SELFPARAM();
277
278         if(round_handler_IsActive())
279         if(!round_handler_IsRoundStarted())
280         {
281                 remove(self);
282                 return;
283         }
284
285         if(time >= self.ltime)
286         {
287                 if ( autocvar_g_nades_ice_explode )
288                 {
289                         entity expef = EFFECT_NADE_EXPLODE(self.realowner.team);
290                         Send_Effect(expef, self.origin + '0 0 1', '0 0 0', 1);
291                         sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
292
293                         RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
294                                 autocvar_g_nades_nade_radius, self, world, autocvar_g_nades_nade_force, self.projectiledeathtype, self.enemy);
295                         Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
296                                 autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self);
297                 }
298                 remove(self);
299                 return;
300         }
301
302
303         self.nextthink = time+0.1;
304
305         // gaussian
306         float randomr;
307         randomr = random();
308         randomr = exp(-5*randomr*randomr)*autocvar_g_nades_nade_radius;
309         float randomw;
310         randomw = random()*M_PI*2;
311         vector randomp;
312         randomp.x = randomr*cos(randomw);
313         randomp.y = randomr*sin(randomw);
314         randomp.z = 1;
315         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, self.origin + randomp, '0 0 0', 1);
316
317         if(time >= self.nade_special_time)
318         {
319                 self.nade_special_time = time+0.7;
320
321                 Send_Effect(EFFECT_ELECTRO_IMPACT, self.origin, '0 0 0', 1);
322                 Send_Effect(EFFECT_ICEFIELD, self.origin, '0 0 0', 1);
323         }
324
325
326         float current_freeze_time = self.ltime - time - 0.1;
327
328         entity e;
329         for(e = findradius(self.origin, autocvar_g_nades_nade_radius); e; e = e.chain)
330         if(e != self)
331         if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(e, self.realowner) || e == self.realowner))
332         if(e.takedamage && e.deadflag == DEAD_NO)
333         if(e.health > 0)
334         if(!e.revival_time || ((time - e.revival_time) >= 1.5))
335         if(!e.frozen)
336         if(current_freeze_time > 0)
337                 nade_ice_freeze(self, e, current_freeze_time);
338 }
339
340 void nade_ice_boom()
341 {SELFPARAM();
342         entity fountain;
343         fountain = spawn();
344         fountain.owner = self.owner;
345         fountain.realowner = self.realowner;
346         fountain.origin = self.origin;
347         setorigin(fountain, fountain.origin);
348         fountain.think = nade_ice_think;
349         fountain.nextthink = time;
350         fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
351         fountain.pushltime = fountain.wait = fountain.ltime;
352         fountain.team = self.team;
353         fountain.movetype = MOVETYPE_TOSS;
354         fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
355         fountain.bot_dodge = false;
356         setsize(fountain, '-16 -16 -16', '16 16 16');
357         fountain.nade_special_time = time+0.3;
358         fountain.angles = self.angles;
359
360         if ( autocvar_g_nades_ice_explode )
361         {
362                 setmodel(fountain, MDL_PROJECTILE_GRENADE);
363                 entity timer = spawn();
364                 setmodel(timer, MDL_NADE_TIMER);
365                 setattachment(timer, fountain, "");
366                 timer.classname = "nade_timer";
367                 timer.colormap = self.colormap;
368                 timer.glowmod = self.glowmod;
369                 timer.think = nade_timer_think;
370                 timer.nextthink = time;
371                 timer.wait = fountain.ltime;
372                 timer.owner = fountain;
373                 timer.skin = 10;
374         }
375         else
376                 setmodel(fountain, MDL_Null);
377 }
378
379 void nade_translocate_boom()
380 {SELFPARAM();
381         if(self.realowner.vehicle)
382                 return;
383
384         vector locout = self.origin + '0 0 1' * (1 - self.realowner.mins.z - 24);
385         tracebox(locout, self.realowner.mins, self.realowner.maxs, locout, MOVE_NOMONSTERS, self.realowner);
386         locout = trace_endpos;
387
388         makevectors(self.realowner.angles);
389
390         MUTATOR_CALLHOOK(PortalTeleport, self.realowner);
391
392         TeleportPlayer(self, self.realowner, locout, self.realowner.angles, v_forward * vlen(self.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
393 }
394
395 void nade_spawn_boom()
396 {SELFPARAM();
397         entity spawnloc = spawn();
398         setorigin(spawnloc, self.origin);
399         setsize(spawnloc, self.realowner.mins, self.realowner.maxs);
400         spawnloc.movetype = MOVETYPE_NONE;
401         spawnloc.solid = SOLID_NOT;
402         spawnloc.drawonlytoclient = self.realowner;
403         spawnloc.effects = EF_STARDUST;
404         spawnloc.cnt = autocvar_g_nades_spawn_count;
405
406         if(self.realowner.nade_spawnloc)
407         {
408                 remove(self.realowner.nade_spawnloc);
409                 self.realowner.nade_spawnloc = world;
410         }
411
412         self.realowner.nade_spawnloc = spawnloc;
413 }
414
415 void nade_heal_think()
416 {SELFPARAM();
417         if(time >= self.ltime)
418         {
419                 remove(self);
420                 return;
421         }
422
423         self.nextthink = time;
424
425         if(time >= self.nade_special_time)
426         {
427                 self.nade_special_time = time+0.25;
428                 self.nade_show_particles = 1;
429         }
430         else
431                 self.nade_show_particles = 0;
432 }
433
434 void nade_heal_touch()
435 {SELFPARAM();
436         float maxhealth;
437         float health_factor;
438         if(IS_PLAYER(other) || IS_MONSTER(other))
439         if(other.deadflag == DEAD_NO)
440         if(!other.frozen)
441         {
442                 health_factor = autocvar_g_nades_heal_rate*frametime/2;
443                 if ( other != self.realowner )
444                 {
445                         if ( SAME_TEAM(other,self) )
446                                 health_factor *= autocvar_g_nades_heal_friend;
447                         else
448                                 health_factor *= autocvar_g_nades_heal_foe;
449                 }
450                 if ( health_factor > 0 )
451                 {
452                         maxhealth = (IS_MONSTER(other)) ? other.max_health : g_pickup_healthmega_max;
453                         if ( other.health < maxhealth )
454                         {
455                                 if ( self.nade_show_particles )
456                                         Send_Effect(EFFECT_HEALING, other.origin, '0 0 0', 1);
457                                 other.health = min(other.health+health_factor, maxhealth);
458                         }
459                         other.pauserothealth_finished = max(other.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
460                 }
461                 else if ( health_factor < 0 )
462                 {
463                         Damage(other,self,self.realowner,-health_factor,DEATH_NADE_HEAL.m_id,other.origin,'0 0 0');
464                 }
465
466         }
467
468         if ( IS_REAL_CLIENT(other) || IS_VEHICLE(other) )
469         {
470                 entity show_red = (IS_VEHICLE(other)) ? other.owner : other;
471                 show_red.stat_healing_orb = time+0.1;
472                 show_red.stat_healing_orb_alpha = 0.75 * (self.ltime - time) / self.healer_lifetime;
473         }
474 }
475
476 void nade_heal_boom()
477 {SELFPARAM();
478         entity healer;
479         healer = spawn();
480         healer.owner = self.owner;
481         healer.realowner = self.realowner;
482         setorigin(healer, self.origin);
483         healer.healer_lifetime = autocvar_g_nades_heal_time; // save the cvar
484         healer.ltime = time + healer.healer_lifetime;
485         healer.team = self.realowner.team;
486         healer.bot_dodge = false;
487         healer.solid = SOLID_TRIGGER;
488         healer.touch = nade_heal_touch;
489
490         setmodel(healer, MDL_NADE_HEAL);
491         healer.healer_radius = autocvar_g_nades_nade_radius;
492         vector size = '1 1 1' * healer.healer_radius / 2;
493         setsize(healer,-size,size);
494
495         Net_LinkEntity(healer, true, 0, healer_send);
496
497         healer.think = nade_heal_think;
498         healer.nextthink = time;
499         healer.SendFlags |= 1;
500 }
501
502 void nade_monster_boom()
503 {SELFPARAM();
504         entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, false, false, 1);
505
506         if(autocvar_g_nades_pokenade_monster_lifetime > 0)
507                 e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
508         e.monster_skill = MONSTER_SKILL_INSANE;
509 }
510
511 void nade_boom()
512 {SELFPARAM();
513         entity expef = NULL;
514         bool nade_blast = true;
515
516         switch ( Nades[self.nade_type] )
517         {
518                 case NADE_TYPE_NAPALM:
519                         nade_blast = autocvar_g_nades_napalm_blast;
520                         expef = EFFECT_EXPLOSION_MEDIUM;
521                         break;
522                 case NADE_TYPE_ICE:
523                         nade_blast = false;
524                         expef = EFFECT_ELECTRO_COMBO; // hookbomb_explode electro_combo bigplasma_impact
525                         break;
526                 case NADE_TYPE_TRANSLOCATE:
527                         nade_blast = false;
528                         break;
529                 case NADE_TYPE_MONSTER:
530                 case NADE_TYPE_SPAWN:
531                         nade_blast = false;
532                         switch(self.realowner.team)
533                         {
534                                 case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
535                                 case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
536                                 case NUM_TEAM_3: expef = EFFECT_SPAWN_YELLOW; break;
537                                 case NUM_TEAM_4: expef = EFFECT_SPAWN_PINK; break;
538                                 default: expef = EFFECT_SPAWN_NEUTRAL; break;
539                         }
540                         break;
541                 case NADE_TYPE_HEAL:
542                         nade_blast = false;
543                         expef = EFFECT_SPAWN_RED;
544                         break;
545
546                 default:
547                 case NADE_TYPE_NORMAL:
548                         expef = EFFECT_NADE_EXPLODE(self.realowner.team);
549                         break;
550         }
551
552         if(expef)
553                 Send_Effect(expef, findbetterlocation(self.origin, 8), '0 0 0', 1);
554
555         sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
556         sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
557
558         self.event_damage = func_null; // prevent somehow calling damage in the next call
559
560         if(nade_blast)
561         {
562                 RadiusDamage(self, self.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
563                                  autocvar_g_nades_nade_radius, self, world, autocvar_g_nades_nade_force, self.projectiledeathtype, self.enemy);
564                 Damage_DamageInfo(self.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, self.projectiledeathtype, 0, self);
565         }
566
567         if(self.takedamage)
568         switch ( Nades[self.nade_type] )
569         {
570                 case NADE_TYPE_NAPALM: nade_napalm_boom(); break;
571                 case NADE_TYPE_ICE: nade_ice_boom(); break;
572                 case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(); break;
573                 case NADE_TYPE_SPAWN: nade_spawn_boom(); break;
574                 case NADE_TYPE_HEAL: nade_heal_boom(); break;
575                 case NADE_TYPE_MONSTER: nade_monster_boom(); break;
576         }
577
578         entity head;
579         for(head = world; (head = find(head, classname, "grapplinghook")); )
580         if(head.aiment == self)
581                 RemoveGrapplingHook(head.realowner);
582
583         remove(self);
584 }
585
586 void nade_touch()
587 {SELFPARAM();
588         /*float is_weapclip = 0;
589         if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
590         if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
591         if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
592                 is_weapclip = 1;*/
593         if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
594         {
595                 entity head;
596                 for(head = world; (head = find(head, classname, "grapplinghook")); )
597                 if(head.aiment == self)
598                         RemoveGrapplingHook(head.realowner);
599                 remove(self);
600                 return;
601         }
602
603         PROJECTILE_TOUCH;
604
605         //setsize(self, '-2 -2 -2', '2 2 2');
606         //UpdateCSQCProjectile(self);
607         if(self.health == self.max_health)
608         {
609                 spamsound(self, CH_SHOTS, SND(GRENADE_BOUNCE_RANDOM()), VOL_BASE, ATTEN_NORM);
610                 return;
611         }
612
613         self.enemy = other;
614         nade_boom();
615 }
616
617 void nade_beep()
618 {SELFPARAM();
619         sound(self, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
620         self.think = nade_boom;
621         self.nextthink = max(self.wait, time);
622 }
623
624 void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
625 {SELFPARAM();
626         if(ITEM_DAMAGE_NEEDKILL(deathtype))
627         {
628                 self.takedamage = DAMAGE_NO;
629                 nade_boom();
630                 return;
631         }
632
633         if(self.nade_type == NADE_TYPE_TRANSLOCATE.m_id || self.nade_type == NADE_TYPE_SPAWN.m_id)
634                 return;
635
636         if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
637         {
638                 force *= 1.5;
639                 damage = 0;
640         }
641
642         if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) && (deathtype & HITTYPE_SECONDARY))
643         {
644                 force *= 0.5; // too much
645                 frag_damage = 0;
646         }
647
648         if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
649         {
650                 force *= 6;
651                 damage = self.max_health * 0.55;
652         }
653
654         if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_HMG))
655                 damage = self.max_health * 0.1;
656
657         if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
658         if(deathtype & HITTYPE_SECONDARY)
659         {
660                 damage = self.max_health * 0.1;
661                 force *= 10;
662         }
663         else
664                 damage = self.max_health * 1.15;
665
666         self.velocity += force;
667         UpdateCSQCProjectile(self);
668
669         if(damage <= 0 || ((self.flags & FL_ONGROUND) && IS_PLAYER(attacker)))
670                 return;
671
672         if(self.health == self.max_health)
673         {
674                 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
675                 self.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
676                 self.think = nade_beep;
677         }
678
679         self.health -= damage;
680
681         if ( self.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
682                 self.realowner = attacker;
683
684         if(self.health <= 0)
685                 W_PrepareExplosionByDamage(attacker, nade_boom);
686         else
687                 nade_burn_spawn(self);
688 }
689
690 void toss_nade(entity e, vector _velocity, float _time)
691 {SELFPARAM();
692         if(e.nade == world)
693                 return;
694
695         entity _nade = e.nade;
696         e.nade = world;
697
698         remove(e.fake_nade);
699         e.fake_nade = world;
700
701         makevectors(e.v_angle);
702
703         W_SetupShot(e, false, false, "", CH_WEAPON_A, 0);
704
705         Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_NADES);
706
707         vector offset = (v_forward * autocvar_g_nades_throw_offset.x)
708                                   + (v_right * autocvar_g_nades_throw_offset.y)
709                                   + (v_up * autocvar_g_nades_throw_offset.z);
710         if(autocvar_g_nades_throw_offset == '0 0 0')
711                 offset = '0 0 0';
712
713         setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1);
714         //setmodel(_nade, MDL_PROJECTILE_NADE);
715         //setattachment(_nade, world, "");
716         PROJECTILE_MAKETRIGGER(_nade);
717         setsize(_nade, '-16 -16 -16', '16 16 16');
718         _nade.movetype = MOVETYPE_BOUNCE;
719
720         tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, false, _nade);
721         if (trace_startsolid)
722                 setorigin(_nade, e.origin);
723
724         if(self.v_angle.x >= 70 && self.v_angle.x <= 110 && self.BUTTON_CROUCH)
725                 _nade.velocity = '0 0 100';
726         else if(autocvar_g_nades_nade_newton_style == 1)
727                 _nade.velocity = e.velocity + _velocity;
728         else if(autocvar_g_nades_nade_newton_style == 2)
729                 _nade.velocity = _velocity;
730         else
731                 _nade.velocity = W_CalculateProjectileVelocity(e.velocity, _velocity, true);
732
733         _nade.touch = nade_touch;
734         _nade.health = autocvar_g_nades_nade_health;
735         _nade.max_health = _nade.health;
736         _nade.takedamage = DAMAGE_AIM;
737         _nade.event_damage = nade_damage;
738         _nade.customizeentityforclient = func_null;
739         _nade.exteriormodeltoclient = world;
740         _nade.traileffectnum = 0;
741         _nade.teleportable = true;
742         _nade.pushable = true;
743         _nade.gravity = 1;
744         _nade.missile_flags = MIF_SPLASH | MIF_ARC;
745         _nade.damagedbycontents = true;
746         _nade.angles = vectoangles(_nade.velocity);
747         _nade.flags = FL_PROJECTILE;
748         _nade.projectiledeathtype = DEATH_NADE.m_id;
749         _nade.toss_time = time;
750         _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
751
752         if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id)
753                 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
754         else
755                 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
756
757         nade_spawn(_nade);
758
759         if(_time)
760         {
761                 _nade.think = nade_boom;
762                 _nade.nextthink = _time;
763         }
764
765         e.nade_refire = time + autocvar_g_nades_nade_refire;
766         e.nade_timer = 0;
767 }
768
769 void nades_GiveBonus(entity player, float score)
770 {
771         if (autocvar_g_nades)
772         if (autocvar_g_nades_bonus)
773         if (IS_REAL_CLIENT(player))
774         if (IS_PLAYER(player) && player.bonus_nades < autocvar_g_nades_bonus_max)
775         if (player.frozen == 0)
776         if (player.deadflag == DEAD_NO)
777         {
778                 if ( player.bonus_nade_score < 1 )
779                         player.bonus_nade_score += score/autocvar_g_nades_bonus_score_max;
780
781                 if ( player.bonus_nade_score >= 1 )
782                 {
783                         Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
784                         play2(player, SND(KH_ALARM));
785                         player.bonus_nades++;
786                         player.bonus_nade_score -= 1;
787                 }
788         }
789 }
790
791 void nades_RemoveBonus(entity player)
792 {
793         player.bonus_nades = player.bonus_nade_score = 0;
794 }
795
796 float nade_customize()
797 {SELFPARAM();
798         //if(IS_SPEC(other)) { return false; }
799         if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner))
800         {
801                 // somewhat hide the model, but keep the glow
802                 //self.effects = 0;
803                 if(self.traileffectnum)
804                         self.traileffectnum = 0;
805                 self.alpha = -1;
806         }
807         else
808         {
809                 //self.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
810                 if(!self.traileffectnum)
811                         self.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades[self.nade_type].m_projectile[false], self.team).eent_eff_name);
812                 self.alpha = 1;
813         }
814
815         return true;
816 }
817
818 void nade_prime()
819 {SELFPARAM();
820         if(autocvar_g_nades_bonus_only)
821         if(!self.bonus_nades)
822                 return; // only allow bonus nades
823
824         if(self.nade)
825                 remove(self.nade);
826
827         if(self.fake_nade)
828                 remove(self.fake_nade);
829
830         entity n = spawn(), fn = spawn();
831
832         n.classname = "nade";
833         fn.classname = "fake_nade";
834
835         if(self.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
836                 n.nade_type = self.nade_type;
837         else if (self.bonus_nades >= 1)
838         {
839                 n.nade_type = self.nade_type;
840                 n.pokenade_type = self.pokenade_type;
841                 self.bonus_nades -= 1;
842         }
843         else
844         {
845                 n.nade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_nade_type : autocvar_g_nades_nade_type);
846                 n.pokenade_type = ((autocvar_g_nades_client_select) ? self.cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
847         }
848
849         n.nade_type = bound(1, n.nade_type, Nades_COUNT);
850
851         setmodel(n, MDL_PROJECTILE_NADE);
852         //setattachment(n, self, "bip01 l hand");
853         n.exteriormodeltoclient = self;
854         n.customizeentityforclient = nade_customize;
855         n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades[n.nade_type].m_projectile[false], self.team).eent_eff_name);
856         n.colormod = Nades[n.nade_type].m_color;
857         n.realowner = self;
858         n.colormap = self.colormap;
859         n.glowmod = self.glowmod;
860         n.wait = time + autocvar_g_nades_nade_lifetime;
861         n.nade_time_primed = time;
862         n.think = nade_beep;
863         n.nextthink = max(n.wait - 3, time);
864         n.projectiledeathtype = DEATH_NADE.m_id;
865
866         setmodel(fn, MDL_NADE_VIEW);
867         setattachment(fn, self.weaponentity, "");
868         fn.realowner = fn.owner = self;
869         fn.colormod = Nades[n.nade_type].m_color;
870         fn.colormap = self.colormap;
871         fn.glowmod = self.glowmod;
872         fn.think = SUB_Remove;
873         fn.nextthink = n.wait;
874
875         self.nade = n;
876         self.fake_nade = fn;
877 }
878
879 float CanThrowNade()
880 {SELFPARAM();
881         if(self.vehicle)
882                 return false;
883
884         if(gameover)
885                 return false;
886
887         if(self.deadflag != DEAD_NO)
888                 return false;
889
890         if (!autocvar_g_nades)
891                 return false; // allow turning them off mid match
892
893         if(forbidWeaponUse(self))
894                 return false;
895
896         if (!IS_PLAYER(self))
897                 return false;
898
899         return true;
900 }
901
902 .bool nade_altbutton;
903
904 void nades_CheckThrow()
905 {SELFPARAM();
906         if(!CanThrowNade())
907                 return;
908
909         entity held_nade = self.nade;
910         if (!held_nade)
911         {
912                 self.nade_altbutton = true;
913                 if(time > self.nade_refire)
914                 {
915                         Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_NADE_THROW);
916                         nade_prime();
917                         self.nade_refire = time + autocvar_g_nades_nade_refire;
918                 }
919         }
920         else
921         {
922                 self.nade_altbutton = false;
923                 if (time >= held_nade.nade_time_primed + 1) {
924                         makevectors(self.v_angle);
925                         float _force = time - held_nade.nade_time_primed;
926                         _force /= autocvar_g_nades_nade_lifetime;
927                         _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
928                         toss_nade(self, (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05) * _force, 0);
929                 }
930         }
931 }
932
933 void nades_Clear(entity player)
934 {
935         if(player.nade)
936                 remove(player.nade);
937         if(player.fake_nade)
938                 remove(player.fake_nade);
939
940         player.nade = player.fake_nade = world;
941         player.nade_timer = 0;
942 }
943
944 MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
945 {
946         if(vh_player.nade)
947                 toss_nade(vh_player, '0 0 100', max(vh_player.nade.wait, time + 0.05));
948
949         return false;
950 }
951
952 CLASS(NadeOffhand, OffhandWeapon)
953     METHOD(NadeOffhand, offhand_think, void(NadeOffhand this, entity player, bool key_pressed))
954     {
955         entity held_nade = player.nade;
956                 if (held_nade)
957                 {
958                         player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1);
959                         // LOG_TRACEF("%d %d\n", player.nade_timer, time - held_nade.nade_time_primed);
960                         makevectors(player.angles);
961                         held_nade.velocity = player.velocity;
962                         setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
963                         held_nade.angles_y = player.angles.y;
964
965                         if (time + 0.1 >= held_nade.wait)
966                                 toss_nade(player, '0 0 0', time + 0.05);
967                 }
968
969         if (!CanThrowNade()) return;
970         if (!(time > player.nade_refire)) return;
971                 if (key_pressed) {
972                         if (!held_nade) {
973                                 nade_prime();
974                                 held_nade = player.nade;
975                         }
976                 } else if (time >= held_nade.nade_time_primed + 1) {
977                         if (held_nade) {
978                                 makevectors(player.v_angle);
979                                 float _force = time - held_nade.nade_time_primed;
980                                 _force /= autocvar_g_nades_nade_lifetime;
981                                 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
982                                 toss_nade(player, (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1) * _force, 0);
983                         }
984                 }
985     }
986 ENDCLASS(NadeOffhand)
987 NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); }
988
989 MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
990 {
991         if (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
992                 nades_CheckThrow();
993                 return true;
994         }
995         return false;
996 }
997
998 MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
999 {SELFPARAM();
1000         if (!IS_PLAYER(self)) { return false; }
1001
1002         if (self.nade && (self.offhand != OFFHAND_NADE || (self.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, self, self.nade_altbutton);
1003
1004         if(IS_PLAYER(self))
1005         {
1006                 if ( autocvar_g_nades_bonus && autocvar_g_nades )
1007                 {
1008                         entity key;
1009                         float key_count = 0;
1010                         FOR_EACH_KH_KEY(key) if(key.owner == self) { ++key_count; }
1011
1012                         float time_score;
1013                         if(self.flagcarried || self.ballcarried) // this player is important
1014                                 time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
1015                         else
1016                                 time_score = autocvar_g_nades_bonus_score_time;
1017
1018                         if(key_count)
1019                                 time_score = autocvar_g_nades_bonus_score_time_flagcarrier * key_count; // multiply by the number of keys the player is holding
1020
1021                         if(autocvar_g_nades_bonus_client_select)
1022                         {
1023                                 self.nade_type = self.cvar_cl_nade_type;
1024                                 self.pokenade_type = self.cvar_cl_pokenade_type;
1025                         }
1026                         else
1027                         {
1028                                 self.nade_type = autocvar_g_nades_bonus_type;
1029                                 self.pokenade_type = autocvar_g_nades_pokenade_monster_type;
1030                         }
1031
1032                         self.nade_type = bound(1, self.nade_type, Nades_COUNT);
1033
1034                         if(self.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
1035                                 nades_GiveBonus(self, time_score / autocvar_g_nades_bonus_score_max);
1036                 }
1037                 else
1038                 {
1039                         self.bonus_nades = self.bonus_nade_score = 0;
1040                 }
1041         }
1042
1043         float n = 0;
1044         entity o = world;
1045         if(self.freezetag_frozen_timeout > 0 && time >= self.freezetag_frozen_timeout)
1046                 n = -1;
1047         else
1048         {
1049                 vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
1050                 n = 0;
1051                 FOR_EACH_PLAYER(other) if(self != other)
1052                 {
1053                         if(other.deadflag == DEAD_NO)
1054                         if(other.frozen == 0)
1055                         if(SAME_TEAM(other, self))
1056                         if(boxesoverlap(self.absmin - revive_extra_size, self.absmax + revive_extra_size, other.absmin, other.absmax))
1057                         {
1058                                 if(!o)
1059                                         o = other;
1060                                 if(self.frozen == 1)
1061                                         other.reviving = true;
1062                                 ++n;
1063                         }
1064                 }
1065         }
1066
1067         if(n && self.frozen == 3) // OK, there is at least one teammate reviving us
1068         {
1069                 self.revive_progress = bound(0, self.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
1070                 self.health = max(1, self.revive_progress * start_health);
1071
1072                 if(self.revive_progress >= 1)
1073                 {
1074                         Unfreeze(self);
1075
1076                         Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
1077                         Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, self.netname);
1078                 }
1079
1080                 FOR_EACH_PLAYER(other) if(other.reviving)
1081                 {
1082                         other.revive_progress = self.revive_progress;
1083                         other.reviving = false;
1084                 }
1085         }
1086
1087         return false;
1088 }
1089
1090 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
1091 {SELFPARAM();
1092         if(autocvar_g_nades_spawn)
1093                 self.nade_refire = time + autocvar_g_spawnshieldtime;
1094         else
1095                 self.nade_refire  = time + autocvar_g_nades_nade_refire;
1096
1097         if(autocvar_g_nades_bonus_client_select)
1098                 self.nade_type = self.cvar_cl_nade_type;
1099
1100         self.nade_timer = 0;
1101
1102         if (!self.offhand) self.offhand = OFFHAND_NADE;
1103
1104         if(self.nade_spawnloc)
1105         {
1106                 setorigin(self, self.nade_spawnloc.origin);
1107                 self.nade_spawnloc.cnt -= 1;
1108
1109                 if(self.nade_spawnloc.cnt <= 0)
1110                 {
1111                         remove(self.nade_spawnloc);
1112                         self.nade_spawnloc = world;
1113                 }
1114         }
1115
1116         return false;
1117 }
1118
1119 MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
1120 {
1121         if(frag_target.nade)
1122         if(!frag_target.frozen || !autocvar_g_freezetag_revive_nade)
1123                 toss_nade(frag_target, '0 0 100', max(frag_target.nade.wait, time + 0.05));
1124
1125         float killcount_bonus = ((frag_attacker.killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * frag_attacker.killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
1126
1127         if(IS_PLAYER(frag_attacker))
1128         {
1129                 if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
1130                         nades_RemoveBonus(frag_attacker);
1131                 else if(frag_target.flagcarried)
1132                         nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_medium);
1133                 else if(autocvar_g_nades_bonus_score_spree && frag_attacker.killcount > 1)
1134                 {
1135                         #define SPREE_ITEM(counta,countb,center,normal,gentle) \
1136                                 case counta: { nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_spree); break; }
1137                         switch(frag_attacker.killcount)
1138                         {
1139                                 KILL_SPREE_LIST
1140                                 default: nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor); break;
1141                         }
1142                         #undef SPREE_ITEM
1143                 }
1144                 else
1145                         nades_GiveBonus(frag_attacker, killcount_bonus);
1146         }
1147
1148         nades_RemoveBonus(frag_target);
1149
1150         return false;
1151 }
1152
1153 MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
1154 {
1155         if(frag_target.frozen)
1156         if(autocvar_g_freezetag_revive_nade)
1157         if(frag_attacker == frag_target)
1158         if(frag_deathtype == DEATH_NADE.m_id)
1159         if(time - frag_inflictor.toss_time <= 0.1)
1160         {
1161                 Unfreeze(frag_target);
1162                 frag_target.health = autocvar_g_freezetag_revive_nade_health;
1163                 Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
1164                 frag_damage = 0;
1165                 frag_force = '0 0 0';
1166                 Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
1167                 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
1168         }
1169
1170         return false;
1171 }
1172
1173 MUTATOR_HOOKFUNCTION(nades, MonsterDies)
1174 {SELFPARAM();
1175         if(IS_PLAYER(frag_attacker))
1176         if(DIFF_TEAM(frag_attacker, self))
1177         if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
1178                 nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
1179
1180         return false;
1181 }
1182
1183 MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
1184 {
1185         if(frag_target.nade)
1186                 toss_nade(frag_target, '0 0 0', time + 0.05);
1187
1188         return false;
1189 }
1190
1191 bool nades_RemovePlayer()
1192 {SELFPARAM();
1193         nades_Clear(self);
1194         nades_RemoveBonus(self);
1195         return false;
1196 }
1197
1198 MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { nades_RemovePlayer(); }
1199 MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { nades_RemovePlayer(); }
1200 MUTATOR_HOOKFUNCTION(nades, reset_map_global) { nades_RemovePlayer(); }
1201
1202 MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
1203 {SELFPARAM();
1204         self.nade_timer = other.nade_timer;
1205         self.nade_type = other.nade_type;
1206         self.pokenade_type = other.pokenade_type;
1207         self.bonus_nades = other.bonus_nades;
1208         self.bonus_nade_score = other.bonus_nade_score;
1209         self.stat_healing_orb = other.stat_healing_orb;
1210         self.stat_healing_orb_alpha = other.stat_healing_orb_alpha;
1211         return false;
1212 }
1213
1214 MUTATOR_HOOKFUNCTION(nades, GetCvars)
1215 {
1216         GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_nade_type, "cl_nade_type");
1217         GetCvars_handleString(get_cvars_s, get_cvars_f, cvar_cl_pokenade_type, "cl_pokenade_type");
1218
1219         return false;
1220 }
1221
1222 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
1223 {
1224         ret_string = strcat(ret_string, ":Nades");
1225         return false;
1226 }
1227
1228 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
1229 {
1230         ret_string = strcat(ret_string, ", Nades");
1231         return false;
1232 }
1233 #endif