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