4 bool autocvar_g_nades_nade_small;
5 float autocvar_g_nades_spread = 0.04;
8 REGISTER_STAT(NADES_SMALL, int, autocvar_g_nades_nade_small)
11 entity Nade_TrailEffect(int proj, int nade_team)
15 case PROJECTILE_NADE: return EFFECT_NADE_TRAIL(nade_team);
16 case PROJECTILE_NADE_BURN: return EFFECT_NADE_TRAIL_BURN(nade_team);
19 FOREACH(Nades, true, {
20 for (int j = 0; j < 2; j++)
22 if (it.m_projectile[j] == proj)
24 string trail = it.m_trail[j].eent_eff_name;
25 if (trail) return it.m_trail[j];
36 REGISTER_MUTATOR(cl_nades, true);
37 MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
39 if (STAT(HEALING_ORB) > time)
41 M_ARGV(0, vector) = NADE_TYPE_HEAL.m_color;
42 M_ARGV(1, float) = STAT(HEALING_ORB_ALPHA);
45 if (STAT(ENTRAP_ORB) > time)
47 M_ARGV(0, vector) = NADE_TYPE_ENTRAP.m_color;
48 M_ARGV(1, float) = STAT(ENTRAP_ORB_ALPHA);
53 MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
55 entity proj = M_ARGV(0, entity);
57 if (proj.cnt == PROJECTILE_NAPALM_FOUNTAIN)
60 proj.traileffect = EFFECT_FIREBALL.m_id;
63 if (Nade_FromProjectile(proj.cnt) != NADE_TYPE_Null)
65 setmodel(proj, MDL_PROJECTILE_NADE);
66 entity trail = Nade_TrailEffect(proj.cnt, proj.team);
67 if (trail.eent_eff_name) proj.traileffect = trail.m_id;
71 MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
73 entity proj = M_ARGV(0, entity);
75 if (proj.cnt == PROJECTILE_NAPALM_FOUNTAIN)
77 loopsound(proj, CH_SHOTS_SINGLE, SND_FIREBALL_FLY2, VOL_BASE, ATTEN_NORM);
78 proj.mins = '-16 -16 -16';
79 proj.maxs = '16 16 16';
82 entity nade_type = Nade_FromProjectile(proj.cnt);
83 if (nade_type == NADE_TYPE_Null) return;
84 if(STAT(NADES_SMALL, NULL))
86 proj.mins = '-8 -8 -8';
91 proj.mins = '-16 -16 -16';
92 proj.maxs = '16 16 16';
94 proj.colormod = nade_type.m_color;
95 set_movetype(proj, MOVETYPE_BOUNCE);
96 settouch(proj, func_null);
98 proj.avelocity = randomvec() * 720;
100 if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
101 proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
103 proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
105 bool Projectile_isnade(int p)
107 return Nade_FromProjectile(p) != NADE_TYPE_Null;
109 void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time)
111 float bonusNades = STAT(NADE_BONUS);
112 float bonusProgress = STAT(NADE_BONUS_SCORE);
113 float bonusType = STAT(NADE_BONUS_TYPE);
114 Nade def = Nades_from(bonusType);
115 vector nadeColor = def.m_color;
116 string nadeIcon = def.m_icon;
118 vector iconPos, textPos;
120 if(autocvar_hud_panel_ammo_iconalign)
122 iconPos = myPos + eX * 2 * mySize.y;
128 textPos = myPos + eX * mySize.y;
131 if(bonusNades > 0 || bonusProgress > 0)
133 DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
135 if(autocvar_hud_panel_ammo_text)
136 drawstring_aspect(textPos, ftos(bonusNades), vec2((2/3) * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
139 drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
141 drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
148 #include <common/gamemodes/_mod.qh>
149 #include <common/monsters/sv_spawn.qh>
150 #include <common/monsters/sv_monsters.qh>
151 #include <server/g_subs.qh>
153 REGISTER_MUTATOR(nades, cvar("g_nades"));
155 .float nade_time_primed;
156 .float nade_lifetime;
158 .entity nade_spawnloc;
161 void nade_timer_think(entity this)
163 this.skin = 8 - (this.owner.wait - time) / (this.owner.nade_lifetime / 10);
164 this.nextthink = time;
165 if(!this.owner || wasfreed(this.owner))
169 void nade_burn_spawn(entity _nade)
171 CSQCProjectile(_nade, true, Nades_from(_nade.nade_type).m_projectile[true], true);
174 void nade_spawn(entity _nade)
176 entity timer = new(nade_timer);
177 setmodel(timer, MDL_NADE_TIMER);
178 setattachment(timer, _nade, "");
179 timer.colormap = _nade.colormap;
180 timer.glowmod = _nade.glowmod;
181 setthink(timer, nade_timer_think);
182 timer.nextthink = time;
183 timer.wait = _nade.wait;
187 _nade.effects |= EF_LOWPRECISION;
189 CSQCProjectile(_nade, true, Nades_from(_nade.nade_type).m_projectile[false], true);
192 void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
201 RandomSelection_Init();
202 for(e = WarpZone_FindRadius(this.origin, dist, true); e; e = e.chain)
203 if(e.takedamage == DAMAGE_AIM)
204 if(this.realowner != e || autocvar_g_nades_napalm_selfdamage)
205 if(!IS_PLAYER(e) || !this.realowner || DIFF_TEAM(e, this))
209 p.x += e.mins.x + random() * (e.maxs.x - e.mins.x);
210 p.y += e.mins.y + random() * (e.maxs.y - e.mins.y);
211 p.z += e.mins.z + random() * (e.maxs.z - e.mins.z);
212 d = vlen(WarpZone_UnTransformOrigin(e, this.origin) - p);
215 e.fireball_impactvec = p;
216 RandomSelection_AddEnt(e, 1 / (1 + d), !Fire_IsBurning(e));
219 if(RandomSelection_chosen_ent)
221 d = vlen(WarpZone_UnTransformOrigin(RandomSelection_chosen_ent, this.origin) - RandomSelection_chosen_ent.fireball_impactvec);
222 d = damage + (edgedamage - damage) * (d / dist);
223 Fire_AddDamage(RandomSelection_chosen_ent, this.realowner, d * burntime, burntime, this.projectiledeathtype);
224 //trailparticles(this, particleeffectnum(EFFECT_FIREBALL_LASER), this.origin, RandomSelection_chosen_ent.fireball_impactvec);
225 Send_Effect(EFFECT_FIREBALL_LASER, this.origin, RandomSelection_chosen_ent.fireball_impactvec - this.origin, 1);
230 void napalm_ball_think(entity this)
232 if(round_handler_IsActive())
233 if(!round_handler_IsRoundStarted())
239 if(time > this.pushltime)
245 vector midpoint = ((this.absmin + this.absmax) * 0.5);
246 if(pointcontents(midpoint) == CONTENT_WATER)
248 this.velocity = this.velocity * 0.5;
250 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
251 { this.velocity_z = 200; }
254 this.angles = vectoangles(this.velocity);
256 napalm_damage(this, autocvar_g_nades_napalm_ball_radius,autocvar_g_nades_napalm_ball_damage,
257 autocvar_g_nades_napalm_ball_damage,autocvar_g_nades_napalm_burntime);
259 this.nextthink = time + 0.1;
263 void nade_napalm_ball(entity this)
268 spamsound(this, CH_SHOTS, SND_FIREBALL_FIRE, VOL_BASE, ATTEN_NORM);
271 proj.owner = this.owner;
272 proj.realowner = this.realowner;
273 proj.team = this.owner.team;
274 proj.bot_dodge = true;
275 proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
276 set_movetype(proj, MOVETYPE_BOUNCE);
277 proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
278 PROJECTILE_MAKETRIGGER(proj);
279 setmodel(proj, MDL_Null);
280 proj.scale = 1;//0.5;
281 setsize(proj, '-4 -4 -4', '4 4 4');
282 setorigin(proj, this.origin);
283 setthink(proj, napalm_ball_think);
284 proj.nextthink = time;
285 proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
286 proj.effects = EF_LOWPRECISION | EF_FLAME;
288 kick.x =(random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
289 kick.y = (random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
290 kick.z = (random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
291 proj.velocity = kick;
293 proj.pushltime = time + autocvar_g_nades_napalm_ball_lifetime;
295 proj.angles = vectoangles(proj.velocity);
296 proj.flags = FL_PROJECTILE;
297 IL_PUSH(g_projectiles, proj);
298 IL_PUSH(g_bot_dodge, proj);
299 proj.missile_flags = MIF_SPLASH | MIF_PROXY | MIF_ARC;
301 //CSQCProjectile(proj, true, PROJECTILE_NAPALM_FIRE, true);
305 void napalm_fountain_think(entity this)
308 if(round_handler_IsActive())
309 if(!round_handler_IsRoundStarted())
315 if(time >= this.ltime)
321 vector midpoint = ((this.absmin + this.absmax) * 0.5);
322 if(pointcontents(midpoint) == CONTENT_WATER)
324 this.velocity = this.velocity * 0.5;
326 if(pointcontents(midpoint + '0 0 16') == CONTENT_WATER)
327 { this.velocity_z = 200; }
329 UpdateCSQCProjectile(this);
332 napalm_damage(this, autocvar_g_nades_napalm_fountain_radius, autocvar_g_nades_napalm_fountain_damage,
333 autocvar_g_nades_napalm_fountain_edgedamage, autocvar_g_nades_napalm_burntime);
335 this.nextthink = time + 0.1;
336 if(time >= this.nade_special_time)
338 this.nade_special_time = time + autocvar_g_nades_napalm_fountain_delay;
339 nade_napalm_ball(this);
343 void nade_napalm_boom(entity this)
347 for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
348 nade_napalm_ball(this);
352 fountain.owner = this.owner;
353 fountain.realowner = this.realowner;
354 fountain.origin = this.origin;
355 fountain.flags = FL_PROJECTILE;
356 IL_PUSH(g_projectiles, fountain);
357 IL_PUSH(g_bot_dodge, fountain);
358 setorigin(fountain, fountain.origin);
359 setthink(fountain, napalm_fountain_think);
360 fountain.nextthink = time;
361 fountain.ltime = time + autocvar_g_nades_napalm_fountain_lifetime;
362 fountain.pushltime = fountain.ltime;
363 fountain.team = this.team;
364 set_movetype(fountain, MOVETYPE_TOSS);
365 fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
366 fountain.bot_dodge = true;
367 fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
368 fountain.nade_special_time = time;
369 setsize(fountain, '-16 -16 -16', '16 16 16');
370 CSQCProjectile(fountain, true, PROJECTILE_NAPALM_FOUNTAIN, true);
373 void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time)
375 frost_target.frozen_by = freezefield.realowner;
376 Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
377 Freeze(frost_target, 1/freeze_time, 3, false);
379 Drop_Special_Items(frost_target);
382 void nade_ice_think(entity this)
384 if(round_handler_IsActive())
385 if(!round_handler_IsRoundStarted())
391 if(time >= this.ltime)
393 if ( autocvar_g_nades_ice_explode )
395 entity expef = EFFECT_NADE_EXPLODE(this.realowner.team);
396 Send_Effect(expef, this.origin + '0 0 1', '0 0 0', 1);
397 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
399 RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
400 autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
401 Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
402 autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this);
409 this.nextthink = time+0.1;
414 randomr = exp(-5*randomr*randomr)*autocvar_g_nades_nade_radius;
416 randomw = random()*M_PI*2;
418 randomp.x = randomr*cos(randomw);
419 randomp.y = randomr*sin(randomw);
421 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, this.origin + randomp, '0 0 0', 1);
423 if(time >= this.nade_special_time)
425 this.nade_special_time = time+0.7;
427 Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
428 Send_Effect(EFFECT_ICEFIELD, this.origin, '0 0 0', 1);
432 float current_freeze_time = this.ltime - time - 0.1;
434 FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && it.health > 0 && current_freeze_time > 0,
436 if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(it, this.realowner) || it == this.realowner))
437 if(!it.revival_time || ((time - it.revival_time) >= 1.5))
438 if(!STAT(FROZEN, it))
439 nade_ice_freeze(this, it, current_freeze_time);
443 void nade_ice_boom(entity this)
447 fountain.owner = this.owner;
448 fountain.realowner = this.realowner;
449 fountain.origin = this.origin;
450 setorigin(fountain, fountain.origin);
451 setthink(fountain, nade_ice_think);
452 fountain.nextthink = time;
453 fountain.ltime = time + autocvar_g_nades_ice_freeze_time;
454 fountain.pushltime = fountain.wait = fountain.ltime;
455 fountain.team = this.team;
456 set_movetype(fountain, MOVETYPE_TOSS);
457 fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
458 fountain.bot_dodge = false;
459 setsize(fountain, '-16 -16 -16', '16 16 16');
460 fountain.nade_special_time = time+0.3;
461 fountain.angles = this.angles;
463 if ( autocvar_g_nades_ice_explode )
465 setmodel(fountain, MDL_PROJECTILE_GRENADE);
466 entity timer = new(nade_timer);
467 setmodel(timer, MDL_NADE_TIMER);
468 setattachment(timer, fountain, "");
469 timer.colormap = this.colormap;
470 timer.glowmod = this.glowmod;
471 setthink(timer, nade_timer_think);
472 timer.nextthink = time;
473 timer.wait = fountain.ltime;
474 timer.owner = fountain;
478 setmodel(fountain, MDL_Null);
481 void nade_translocate_boom(entity this)
483 if(this.realowner.vehicle)
486 vector locout = this.origin + '0 0 1' * (1 - this.realowner.mins.z - 24);
487 tracebox(locout, this.realowner.mins, this.realowner.maxs, locout, MOVE_NOMONSTERS, this.realowner);
488 locout = trace_endpos;
490 makevectors(this.realowner.angles);
492 MUTATOR_CALLHOOK(PortalTeleport, this.realowner);
494 TeleportPlayer(this, this.realowner, locout, this.realowner.angles, v_forward * vlen(this.realowner.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
497 void nade_spawn_boom(entity this)
499 entity spawnloc = spawn();
500 setorigin(spawnloc, this.origin);
501 setsize(spawnloc, this.realowner.mins, this.realowner.maxs);
502 set_movetype(spawnloc, MOVETYPE_NONE);
503 spawnloc.solid = SOLID_NOT;
504 spawnloc.drawonlytoclient = this.realowner;
505 spawnloc.effects = EF_STARDUST;
506 spawnloc.cnt = autocvar_g_nades_spawn_count;
508 if(this.realowner.nade_spawnloc)
510 delete(this.realowner.nade_spawnloc);
511 this.realowner.nade_spawnloc = NULL;
514 this.realowner.nade_spawnloc = spawnloc;
517 void nades_orb_think(entity this)
519 if(time >= this.ltime)
525 this.nextthink = time;
527 if(time >= this.nade_special_time)
529 this.nade_special_time = time+0.25;
530 this.nade_show_particles = 1;
533 this.nade_show_particles = 0;
536 entity nades_spawn_orb(entity own, entity realown, vector org, float orb_ltime, float orb_rad)
538 // NOTE: this function merely places an orb
539 // you must add a custom touch function to the returned entity if desired
540 // also set .colormod if you wish to have it colorized
541 entity orb = spawn(); // Net_LinkEntity sets the classname (TODO)
543 orb.realowner = realown;
546 orb.orb_lifetime = orb_ltime; // required for timers
547 orb.ltime = time + orb.orb_lifetime;
548 orb.bot_dodge = false;
549 orb.team = realown.team;
550 orb.solid = SOLID_TRIGGER;
552 setmodel(orb, MDL_NADE_ORB);
554 orb.orb_radius = orb_rad; // required for fading
555 vector size = '1 1 1' * orb.orb_radius / 2;
556 setsize(orb, -size, size);
558 Net_LinkEntity(orb, true, 0, orb_send);
561 setthink(orb, nades_orb_think);
562 orb.nextthink = time;
567 void nade_entrap_touch(entity this, entity toucher)
569 if(DIFF_TEAM(toucher, this.realowner)) // TODO: what if realowner changes team or disconnects?
571 if (!isPushable(toucher))
574 float pushdeltatime = time - toucher.lastpushtime;
575 if (pushdeltatime > 0.15) pushdeltatime = 0;
576 toucher.lastpushtime = time;
577 if(!pushdeltatime) return;
579 // div0: ticrate independent, 1 = identity (not 20)
580 toucher.velocity = toucher.velocity * (autocvar_g_nades_entrap_strength ** pushdeltatime);
583 UpdateCSQCProjectile(toucher);
587 if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
589 entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
590 STAT(ENTRAP_ORB, show_tint) = time + 0.1;
592 float tint_alpha = 0.75;
593 if(SAME_TEAM(toucher, this.realowner))
595 STAT(ENTRAP_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
599 void nade_entrap_boom(entity this)
601 entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_entrap_time, autocvar_g_nades_entrap_radius);
603 settouch(orb, nade_entrap_touch);
604 orb.colormod = NADE_TYPE_ENTRAP.m_color;
607 void nade_heal_touch(entity this, entity toucher)
611 if(IS_PLAYER(toucher) || IS_MONSTER(toucher))
612 if(!IS_DEAD(toucher))
613 if(!STAT(FROZEN, toucher))
615 health_factor = autocvar_g_nades_heal_rate*frametime/2;
616 if ( toucher != this.realowner )
618 if ( SAME_TEAM(toucher,this) )
619 health_factor *= autocvar_g_nades_heal_friend;
621 health_factor *= autocvar_g_nades_heal_foe;
623 if ( health_factor > 0 )
625 maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
626 if ( toucher.health < maxhealth )
628 if ( this.nade_show_particles )
629 Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
630 toucher.health = min(toucher.health+health_factor, maxhealth);
632 toucher.pauserothealth_finished = max(toucher.pauserothealth_finished, time + autocvar_g_balance_pause_health_rot);
634 else if ( health_factor < 0 )
636 Damage(toucher,this,this.realowner,-health_factor,DEATH_NADE_HEAL.m_id,toucher.origin,'0 0 0');
641 if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) )
643 entity show_red = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
644 show_red.stat_healing_orb = time+0.1;
645 show_red.stat_healing_orb_alpha = 0.75 * (this.ltime - time) / this.orb_lifetime;
649 void nade_heal_boom(entity this)
651 entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_heal_time, autocvar_g_nades_nade_radius);
653 settouch(orb, nade_heal_touch);
654 orb.colormod = '1 0 0';
657 void nade_monster_boom(entity this)
659 entity e = spawnmonster(spawn(), this.pokenade_type, 0, this.realowner, this.realowner, this.origin, false, false, 1);
661 if(autocvar_g_nades_pokenade_monster_lifetime > 0)
662 e.monster_lifetime = time + autocvar_g_nades_pokenade_monster_lifetime;
663 e.monster_skill = MONSTER_SKILL_INSANE;
666 void nade_boom(entity this)
669 bool nade_blast = true;
671 switch ( Nades_from(this.nade_type) )
673 case NADE_TYPE_NAPALM:
674 nade_blast = autocvar_g_nades_napalm_blast;
675 expef = EFFECT_EXPLOSION_MEDIUM;
679 expef = EFFECT_ELECTRO_COMBO; // hookbomb_explode electro_combo bigplasma_impact
681 case NADE_TYPE_TRANSLOCATE:
684 case NADE_TYPE_MONSTER:
685 case NADE_TYPE_SPAWN:
687 switch(this.realowner.team)
689 case NUM_TEAM_1: expef = EFFECT_SPAWN_RED; break;
690 case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE; break;
691 case NUM_TEAM_3: expef = EFFECT_SPAWN_YELLOW; break;
692 case NUM_TEAM_4: expef = EFFECT_SPAWN_PINK; break;
693 default: expef = EFFECT_SPAWN_NEUTRAL; break;
698 expef = EFFECT_SPAWN_RED;
701 case NADE_TYPE_ENTRAP:
703 expef = EFFECT_SPAWN_YELLOW;
707 case NADE_TYPE_NORMAL:
708 expef = EFFECT_NADE_EXPLODE(this.realowner.team);
713 Send_Effect(expef, findbetterlocation(this.origin, 8), '0 0 0', 1);
715 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
716 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
718 this.event_damage = func_null; // prevent somehow calling damage in the next call
722 RadiusDamage(this, this.realowner, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage,
723 autocvar_g_nades_nade_radius, this, NULL, autocvar_g_nades_nade_force, this.projectiledeathtype, this.enemy);
724 Damage_DamageInfo(this.origin, autocvar_g_nades_nade_damage, autocvar_g_nades_nade_edgedamage, autocvar_g_nades_nade_radius, '1 1 1' * autocvar_g_nades_nade_force, this.projectiledeathtype, 0, this);
728 switch ( Nades_from(this.nade_type) )
730 case NADE_TYPE_NAPALM: nade_napalm_boom(this); break;
731 case NADE_TYPE_ICE: nade_ice_boom(this); break;
732 case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(this); break;
733 case NADE_TYPE_SPAWN: nade_spawn_boom(this); break;
734 case NADE_TYPE_HEAL: nade_heal_boom(this); break;
735 case NADE_TYPE_MONSTER: nade_monster_boom(this); break;
736 case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break;
739 IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
747 void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype);
748 void nade_pickup(entity this, entity thenade)
750 spawn_held_nade(this, thenade.realowner, autocvar_g_nades_pickup_time, thenade.nade_type, thenade.pokenade_type);
752 // set refire so player can't even
753 this.nade_refire = time + autocvar_g_nades_nade_refire;
757 this.nade.nade_time_primed = thenade.nade_time_primed;
760 bool CanThrowNade(entity this);
761 void nade_touch(entity this, entity toucher)
764 UpdateCSQCProjectile(this);
766 if(toucher == this.realowner)
767 return; // no this impacts
769 if(autocvar_g_nades_pickup)
770 if(time >= this.spawnshieldtime)
771 if(!toucher.nade && this.health == this.max_health) // no boosted shot pickups, thank you very much
772 if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
773 if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
775 nade_pickup(toucher, this);
776 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
780 /*float is_weapclip = 0;
781 if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
782 if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
783 if (!(trace_dphitcontents & DPCONTENTS_OPAQUE))
785 if(ITEM_TOUCH_NEEDKILL()) // || is_weapclip)
787 IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
795 PROJECTILE_TOUCH(this, toucher);
797 //setsize(this, '-2 -2 -2', '2 2 2');
798 //UpdateCSQCProjectile(this);
799 if(this.health == this.max_health)
801 spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTEN_NORM);
805 this.enemy = toucher;
809 void nade_beep(entity this)
811 sound(this, CH_SHOTS_SINGLE, SND_NADE_BEEP, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
812 setthink(this, nade_boom);
813 this.nextthink = max(this.wait, time);
816 void nade_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
818 if(ITEM_DAMAGE_NEEDKILL(deathtype))
820 this.takedamage = DAMAGE_NO;
825 if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id)
828 if (MUTATOR_CALLHOOK(Nade_Damage, this, DEATH_WEAPONOF(deathtype), force, damage)) {}
829 else if(DEATH_ISWEAPON(deathtype, WEP_BLASTER))
834 else if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) && (deathtype & HITTYPE_SECONDARY))
836 force *= 0.5; // too much
839 else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
842 damage = this.max_health * 0.55;
844 else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
845 damage = this.max_health * 0.1;
846 else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
848 if(deathtype & HITTYPE_SECONDARY)
850 damage = this.max_health * 0.1;
854 damage = this.max_health * 1.15;
857 this.velocity += force;
858 UpdateCSQCProjectile(this);
860 if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
863 if(this.health == this.max_health)
865 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
866 this.nextthink = max(time + this.nade_lifetime, time);
867 setthink(this, nade_beep);
870 this.health -= damage;
872 if ( this.nade_type != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
873 this.realowner = attacker;
876 W_PrepareExplosionByDamage(this, attacker, nade_boom);
878 nade_burn_spawn(this);
881 void toss_nade(entity e, bool set_owner, vector _velocity, float _time)
886 entity _nade = e.nade;
892 makevectors(e.v_angle);
894 // NOTE: always throw from first weapon entity?
895 W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
897 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
899 vector offset = (v_forward * autocvar_g_nades_throw_offset.x)
900 + (v_right * autocvar_g_nades_throw_offset.y)
901 + (v_up * autocvar_g_nades_throw_offset.z);
902 if(autocvar_g_nades_throw_offset == '0 0 0')
905 setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1);
906 //setmodel(_nade, MDL_PROJECTILE_NADE);
907 //setattachment(_nade, NULL, "");
908 PROJECTILE_MAKETRIGGER(_nade);
909 if(STAT(NADES_SMALL, e))
910 setsize(_nade, '-8 -8 -8', '8 8 8');
912 setsize(_nade, '-16 -16 -16', '16 16 16');
913 set_movetype(_nade, MOVETYPE_BOUNCE);
915 tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin, MOVE_NOMONSTERS, _nade);
916 if (trace_startsolid)
917 setorigin(_nade, e.origin);
919 if(e.v_angle.x >= 70 && e.v_angle.x <= 110 && PHYS_INPUT_BUTTON_CROUCH(e))
920 _nade.velocity = '0 0 100';
921 else if(autocvar_g_nades_nade_newton_style == 1)
922 _nade.velocity = e.velocity + _velocity;
923 else if(autocvar_g_nades_nade_newton_style == 2)
924 _nade.velocity = _velocity;
926 _nade.velocity = W_CalculateProjectileVelocity(e, e.velocity, _velocity, true);
931 settouch(_nade, nade_touch);
932 _nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
933 _nade.health = autocvar_g_nades_nade_health;
934 _nade.max_health = _nade.health;
935 _nade.takedamage = DAMAGE_AIM;
936 _nade.event_damage = nade_damage;
937 setcefc(_nade, func_null);
938 _nade.exteriormodeltoclient = NULL;
939 _nade.traileffectnum = 0;
940 _nade.teleportable = true;
941 _nade.pushable = true;
943 _nade.missile_flags = MIF_SPLASH | MIF_ARC;
944 _nade.damagedbycontents = true;
945 IL_PUSH(g_damagedbycontents, _nade);
946 _nade.angles = vectoangles(_nade.velocity);
947 _nade.flags = FL_PROJECTILE;
948 IL_PUSH(g_projectiles, _nade);
949 IL_PUSH(g_bot_dodge, _nade);
950 _nade.projectiledeathtype = DEATH_NADE.m_id;
951 _nade.toss_time = time;
952 _nade.solid = SOLID_CORPSE; //((_nade.nade_type == NADE_TYPE_TRANSLOCATE) ? SOLID_CORPSE : SOLID_BBOX);
954 if(_nade.nade_type == NADE_TYPE_TRANSLOCATE.m_id || _nade.nade_type == NADE_TYPE_SPAWN.m_id)
955 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
957 _nade.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
963 setthink(_nade, nade_boom);
964 _nade.nextthink = _time;
967 e.nade_refire = time + autocvar_g_nades_nade_refire;
971 void nades_GiveBonus(entity player, float score)
973 if (autocvar_g_nades)
974 if (autocvar_g_nades_bonus)
975 if (IS_REAL_CLIENT(player))
976 if (IS_PLAYER(player) && player.bonus_nades < autocvar_g_nades_bonus_max)
977 if (STAT(FROZEN, player) == 0)
978 if (!IS_DEAD(player))
980 if ( player.bonus_nade_score < 1 )
981 player.bonus_nade_score += score/autocvar_g_nades_bonus_score_max;
983 if ( player.bonus_nade_score >= 1 )
985 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
986 play2(player, SND(KH_ALARM));
987 player.bonus_nades++;
988 player.bonus_nade_score -= 1;
993 /** Remove all bonus nades from a player */
994 void nades_RemoveBonus(entity player)
996 player.bonus_nades = player.bonus_nade_score = 0;
999 MUTATOR_HOOKFUNCTION(nades, PutClientInServer)
1001 entity player = M_ARGV(0, entity);
1003 nades_RemoveBonus(player);
1006 bool nade_customize(entity this, entity client)
1008 //if(IS_SPEC(client)) { return false; }
1009 if(client == this.exteriormodeltoclient || (IS_SPEC(client) && client.enemy == this.exteriormodeltoclient))
1011 // somewhat hide the model, but keep the glow
1013 if(this.traileffectnum)
1014 this.traileffectnum = 0;
1019 //this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
1020 if(!this.traileffectnum)
1021 this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(this.nade_type).m_projectile[false], this.team).eent_eff_name);
1028 void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, string pntype)
1030 entity n = new(nade), fn = new(fake_nade);
1032 n.nade_type = max(1, ntype);
1033 n.pokenade_type = pntype;
1035 if(Nades_from(n.nade_type) == NADE_TYPE_Null)
1036 n.nade_type = NADE_TYPE_NORMAL.m_id;
1038 .entity weaponentity = weaponentities[0]; // TODO: unhardcode
1040 setmodel(n, MDL_PROJECTILE_NADE);
1041 //setattachment(n, player, "bip01 l hand");
1042 n.exteriormodeltoclient = player;
1043 setcefc(n, nade_customize);
1044 n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(n.nade_type).m_projectile[false], player.team).eent_eff_name);
1045 n.colormod = Nades_from(n.nade_type).m_color;
1046 n.realowner = nowner;
1047 n.colormap = player.colormap;
1048 n.glowmod = player.glowmod;
1049 n.wait = time + max(0, ntime);
1050 n.nade_time_primed = time;
1051 setthink(n, nade_beep);
1052 n.nextthink = max(n.wait - 3, time);
1053 n.projectiledeathtype = DEATH_NADE.m_id;
1054 n.weaponentity_fld = weaponentity;
1055 n.nade_lifetime = ntime;
1057 setmodel(fn, MDL_NADE_VIEW);
1058 setattachment(fn, player.(weaponentity), "");
1059 fn.realowner = fn.owner = player;
1060 fn.colormod = Nades_from(n.nade_type).m_color;
1061 fn.colormap = player.colormap;
1062 fn.glowmod = player.glowmod;
1063 setthink(fn, SUB_Remove);
1064 fn.nextthink = n.wait;
1065 fn.weaponentity_fld = weaponentity;
1068 player.fake_nade = fn;
1071 void nade_prime(entity this)
1073 if(autocvar_g_nades_bonus_only)
1074 if(!this.bonus_nades)
1075 return; // only allow bonus nades
1081 delete(this.fake_nade);
1084 string pntype = this.pokenade_type;
1086 if(this.items & ITEM_Strength.m_itemid && autocvar_g_nades_bonus_onstrength)
1087 ntype = this.nade_type;
1088 else if (this.bonus_nades >= 1)
1090 ntype = this.nade_type;
1091 pntype = this.pokenade_type;
1092 this.bonus_nades -= 1;
1096 ntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
1097 pntype = ((autocvar_g_nades_client_select) ? CS(this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
1100 spawn_held_nade(this, this, autocvar_g_nades_nade_lifetime, ntype, pntype);
1103 bool CanThrowNade(entity this)
1111 if (!autocvar_g_nades)
1112 return false; // allow turning them off mid match
1114 if(forbidWeaponUse(this))
1117 if (!IS_PLAYER(this))
1123 .bool nade_altbutton;
1125 void nades_CheckThrow(entity this)
1127 if(!CanThrowNade(this))
1130 entity held_nade = this.nade;
1133 this.nade_altbutton = true;
1134 if(time > this.nade_refire)
1136 Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_NADE_THROW);
1138 this.nade_refire = time + autocvar_g_nades_nade_refire;
1143 this.nade_altbutton = false;
1144 if (time >= held_nade.nade_time_primed + 1) {
1145 makevectors(this.v_angle);
1146 float _force = time - held_nade.nade_time_primed;
1147 _force /= autocvar_g_nades_nade_lifetime;
1148 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
1149 vector dir = (v_forward * 0.75 + v_up * 0.2 + v_right * 0.05);
1150 dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
1151 toss_nade(this, true, dir * _force, 0);
1156 void nades_Clear(entity player)
1159 delete(player.nade);
1160 if(player.fake_nade)
1161 delete(player.fake_nade);
1163 player.nade = player.fake_nade = NULL;
1164 player.nade_timer = 0;
1167 MUTATOR_HOOKFUNCTION(nades, VehicleEnter)
1169 entity player = M_ARGV(0, entity);
1172 toss_nade(player, true, '0 0 100', max(player.nade.wait, time + 0.05));
1175 CLASS(NadeOffhand, OffhandWeapon)
1176 METHOD(NadeOffhand, offhand_think, void(NadeOffhand this, entity player, bool key_pressed))
1178 entity held_nade = player.nade;
1180 if (!CanThrowNade(player)) return;
1181 if (!(time > player.nade_refire)) return;
1185 held_nade = player.nade;
1187 } else if (time >= held_nade.nade_time_primed + 1) {
1189 makevectors(player.v_angle);
1190 float _force = time - held_nade.nade_time_primed;
1191 _force /= autocvar_g_nades_nade_lifetime;
1192 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
1193 vector dir = (v_forward * 0.7 + v_up * 0.2 + v_right * 0.1);
1194 dir = W_CalculateSpread(dir, autocvar_g_nades_spread, g_weaponspreadfactor, autocvar_g_projectiles_spread_style);
1195 toss_nade(player, false, dir * _force, 0);
1199 ENDCLASS(NadeOffhand)
1200 NadeOffhand OFFHAND_NADE; STATIC_INIT(OFFHAND_NADE) { OFFHAND_NADE = NEW(NadeOffhand); }
1202 MUTATOR_HOOKFUNCTION(nades, ForbidThrowCurrentWeapon, CBC_ORDER_LAST)
1204 entity player = M_ARGV(0, entity);
1206 if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
1207 nades_CheckThrow(player);
1212 MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
1214 entity player = M_ARGV(0, entity);
1216 if (!IS_PLAYER(player)) { return; }
1218 if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
1220 entity held_nade = player.nade;
1223 player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
1224 // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
1225 makevectors(player.angles);
1226 held_nade.velocity = player.velocity;
1227 setorigin(held_nade, player.origin + player.view_ofs + v_forward * 8 + v_right * -8 + v_up * 0);
1228 held_nade.angles_y = player.angles.y;
1230 if (time + 0.1 >= held_nade.wait)
1231 toss_nade(player, false, '0 0 0', time + 0.05);
1234 if(IS_PLAYER(player))
1236 if ( autocvar_g_nades_bonus && autocvar_g_nades )
1239 float key_count = 0;
1240 FOR_EACH_KH_KEY(key) if(key.owner == player) { ++key_count; }
1243 if(player.flagcarried || player.ballcarried) // this player is important
1244 time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
1246 time_score = autocvar_g_nades_bonus_score_time;
1249 time_score = autocvar_g_nades_bonus_score_time_flagcarrier * key_count; // multiply by the number of keys the player is holding
1251 if(autocvar_g_nades_bonus_client_select)
1253 player.nade_type = CS(player).cvar_cl_nade_type;
1254 player.pokenade_type = CS(player).cvar_cl_pokenade_type;
1258 player.nade_type = autocvar_g_nades_bonus_type;
1259 player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
1262 player.nade_type = bound(1, player.nade_type, Nades_COUNT);
1264 if(player.bonus_nade_score >= 0 && autocvar_g_nades_bonus_score_max)
1265 nades_GiveBonus(player, time_score / autocvar_g_nades_bonus_score_max);
1269 player.bonus_nades = player.bonus_nade_score = 0;
1275 if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
1279 vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
1281 FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
1283 if(STAT(FROZEN, it) == 0)
1284 if(SAME_TEAM(it, player))
1285 if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
1289 if(STAT(FROZEN, player) == 1)
1296 if(n && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
1298 player.revive_progress = bound(0, player.revive_progress + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
1299 player.health = max(1, player.revive_progress * start_health);
1301 if(player.revive_progress >= 1)
1305 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
1306 Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
1309 FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
1310 it.revive_progress = player.revive_progress;
1311 it.reviving = false;
1316 MUTATOR_HOOKFUNCTION(nades, PlayerPhysics)
1318 entity player = M_ARGV(0, entity);
1320 if (STAT(ENTRAP_ORB, player) > time)
1322 player.stat_sv_maxspeed *= autocvar_g_nades_entrap_speed;
1323 player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nades_entrap_speed;
1327 MUTATOR_HOOKFUNCTION(nades, MonsterMove)
1329 entity mon = M_ARGV(0, entity);
1331 if (STAT(ENTRAP_ORB, mon) > time)
1333 M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
1334 M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
1338 MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
1340 entity player = M_ARGV(0, entity);
1342 if(autocvar_g_nades_spawn)
1343 player.nade_refire = time + autocvar_g_spawnshieldtime;
1345 player.nade_refire = time + autocvar_g_nades_nade_refire;
1347 if(autocvar_g_nades_bonus_client_select)
1348 player.nade_type = CS(player).cvar_cl_nade_type;
1350 player.nade_timer = 0;
1352 if (!player.offhand) player.offhand = OFFHAND_NADE;
1354 if(player.nade_spawnloc)
1356 setorigin(player, player.nade_spawnloc.origin);
1357 player.nade_spawnloc.cnt -= 1;
1359 if(player.nade_spawnloc.cnt <= 0)
1361 delete(player.nade_spawnloc);
1362 player.nade_spawnloc = NULL;
1367 MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
1369 entity frag_attacker = M_ARGV(1, entity);
1370 entity frag_target = M_ARGV(2, entity);
1372 if(frag_target.nade)
1373 if(!STAT(FROZEN, frag_target) || !autocvar_g_freezetag_revive_nade)
1374 toss_nade(frag_target, true, '0 0 100', max(frag_target.nade.wait, time + 0.05));
1376 if(IS_PLAYER(frag_attacker))
1378 float killcount_bonus = ((CS(frag_attacker).killcount >= 1) ? bound(0, autocvar_g_nades_bonus_score_minor * CS(frag_attacker).killcount, autocvar_g_nades_bonus_score_medium) : autocvar_g_nades_bonus_score_minor);
1380 if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
1381 nades_RemoveBonus(frag_attacker);
1382 else if(frag_target.flagcarried)
1383 nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_medium);
1384 else if(autocvar_g_nades_bonus_score_spree && CS(frag_attacker).killcount > 1)
1386 #define SPREE_ITEM(counta,countb,center,normal,gentle) \
1387 case counta: { nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_spree); break; }
1388 switch(CS(frag_attacker).killcount)
1391 default: nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor); break;
1396 nades_GiveBonus(frag_attacker, killcount_bonus);
1399 nades_RemoveBonus(frag_target);
1402 MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
1404 entity frag_inflictor = M_ARGV(0, entity);
1405 entity frag_attacker = M_ARGV(1, entity);
1406 entity frag_target = M_ARGV(2, entity);
1407 float frag_deathtype = M_ARGV(3, float);
1409 if(STAT(FROZEN, frag_target))
1410 if(autocvar_g_freezetag_revive_nade)
1411 if(frag_attacker == frag_target)
1412 if(frag_deathtype == DEATH_NADE.m_id)
1413 if(time - frag_inflictor.toss_time <= 0.1)
1415 Unfreeze(frag_target);
1416 frag_target.health = autocvar_g_freezetag_revive_nade_health;
1417 Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
1418 M_ARGV(4, float) = 0;
1419 M_ARGV(6, vector) = '0 0 0';
1420 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
1421 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
1425 MUTATOR_HOOKFUNCTION(nades, MonsterDies)
1427 entity frag_target = M_ARGV(0, entity);
1428 entity frag_attacker = M_ARGV(1, entity);
1430 if(IS_PLAYER(frag_attacker))
1431 if(DIFF_TEAM(frag_attacker, frag_target))
1432 if(!(frag_target.spawnflags & MONSTERFLAG_SPAWNED))
1433 nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
1436 MUTATOR_HOOKFUNCTION(nades, DropSpecialItems)
1438 entity frag_target = M_ARGV(0, entity);
1440 if(frag_target.nade)
1441 toss_nade(frag_target, true, '0 0 0', time + 0.05);
1444 void nades_RemovePlayer(entity this)
1447 nades_RemoveBonus(this);
1450 MUTATOR_HOOKFUNCTION(nades, MakePlayerObserver) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
1451 MUTATOR_HOOKFUNCTION(nades, ClientDisconnect) { entity player = M_ARGV(0, entity); nades_RemovePlayer(player); }
1452 MUTATOR_HOOKFUNCTION(nades, reset_map_global)
1454 FOREACH_CLIENT(IS_PLAYER(it),
1456 nades_RemovePlayer(it);
1460 MUTATOR_HOOKFUNCTION(nades, SpectateCopy)
1462 entity spectatee = M_ARGV(0, entity);
1463 entity client = M_ARGV(1, entity);
1465 client.nade_timer = spectatee.nade_timer;
1466 client.nade_type = spectatee.nade_type;
1467 client.pokenade_type = spectatee.pokenade_type;
1468 client.bonus_nades = spectatee.bonus_nades;
1469 client.bonus_nade_score = spectatee.bonus_nade_score;
1470 client.stat_healing_orb = spectatee.stat_healing_orb;
1471 client.stat_healing_orb_alpha = spectatee.stat_healing_orb_alpha;
1472 STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
1473 STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
1476 REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");
1477 REPLICATE(cvar_cl_pokenade_type, string, "cl_pokenade_type");
1479 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsString)
1481 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":Nades");
1484 MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
1486 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Nades");
1489 MUTATOR_HOOKFUNCTION(nades, BuildGameplayTipsString)
1491 M_ARGV(0, string) = strcat(M_ARGV(0, string), "\n\n^3nades^8 are enabled, press 'g' to use them\n");