3 #include "../overkill/okmachinegun.qh" 4 #include "../overkill/okshotgun.qh" 7 bool autocvar_g_nades_nade_small;
8 float autocvar_g_nades_spread = 0.04;
15 REPLICATE(cvar_cl_nade_type,
int,
"cl_nade_type");
16 REPLICATE(cvar_cl_pokenade_type,
string,
"cl_pokenade_type");
18 entity Nade_TrailEffect(
int proj,
int nade_team)
27 for (
int j = 0; j < 2; j++)
29 if (it.m_projectile[j] == proj)
31 string trail = it.m_trail[j].eent_eff_name;
32 if (trail) return it.m_trail[j];
47 if (STAT(HEALING_ORB) >
time)
50 M_ARGV(1,
float) = STAT(HEALING_ORB_ALPHA);
53 if (STAT(ENTRAP_ORB) >
time)
56 M_ARGV(1,
float) = STAT(ENTRAP_ORB_ALPHA);
59 if (STAT(VEIL_ORB) >
time)
62 M_ARGV(1,
float) = STAT(VEIL_ORB_ALPHA);
74 proj.traileffect = EFFECT_FIREBALL.m_id;
80 entity trail = Nade_TrailEffect(proj.cnt, proj.team);
81 if (trail.eent_eff_name) proj.traileffect = trail.m_id;
92 proj.mins =
'-16 -16 -16';
93 proj.maxs =
'16 16 16';
97 if (nade_type == NADE_TYPE_Null)
return;
100 proj.mins =
'-8 -8 -8';
105 proj.mins =
'-16 -16 -16';
106 proj.maxs =
'16 16 16';
108 proj.colormod = nade_type.m_color;
113 proj.alphamod = nade_type.m_alpha;
115 if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
120 bool Projectile_isnade(
int p)
124 void DrawAmmoNades(
vector myPos,
vector mySize,
bool draw_expanding,
float expand_time)
126 float bonusNades = STAT(NADE_BONUS);
127 float bonusProgress = STAT(NADE_BONUS_SCORE);
128 float bonusType = STAT(NADE_BONUS_TYPE);
131 string nadeIcon = def.
m_icon;
137 iconPos = myPos +
eX * 2 * mySize.y;
143 textPos = myPos +
eX * mySize.y;
146 if(bonusNades > 0 || bonusProgress > 0)
167 .float nade_time_primed;
168 .float nade_lifetime;
170 .entity nade_spawnloc;
173 void nade_timer_think(
entity this)
181 void nade_burn_spawn(
entity _nade)
186 void nade_spawn(
entity _nade)
188 entity timer =
new(nade_timer);
190 setattachment(timer, _nade,
"");
191 timer.colormap = _nade.colormap;
192 timer.glowmod = _nade.glowmod;
194 timer.nextthink =
time;
195 timer.wait = _nade.wait;
204 void napalm_damage(
entity this,
float dist,
float damage,
float edgedamage,
float burntime)
216 if(this.
realowner != e || autocvar_g_nades_napalm_selfdamage)
221 p.x += e.mins.x +
random() * (e.maxs.x - e.mins.x);
222 p.y += e.mins.y +
random() * (e.maxs.y - e.mins.y);
223 p.z += e.mins.z +
random() * (e.maxs.z - e.mins.z);
227 e.fireball_impactvec = p;
234 d = damage + (edgedamage - damage) * (d / dist);
242 void napalm_ball_think(
entity this)
263 { this.velocity_z = 200; }
268 napalm_damage(
this, autocvar_g_nades_napalm_ball_radius,autocvar_g_nades_napalm_ball_damage,
269 autocvar_g_nades_napalm_ball_damage,autocvar_g_nades_napalm_burntime);
275 void nade_napalm_ball(
entity this)
283 proj.owner = this.
owner;
285 proj.team = this.
owner.team;
286 proj.bot_dodge =
true;
287 proj.bot_dodgerating = autocvar_g_nades_napalm_ball_damage;
289 proj.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
293 setsize(proj,
'-4 -4 -4',
'4 4 4');
296 proj.nextthink =
time;
297 proj.damageforcescale = autocvar_g_nades_napalm_ball_damageforcescale;
300 kick.x =(
random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
301 kick.y = (
random() - 0.5) * 2 * autocvar_g_nades_napalm_ball_spread;
302 kick.z = (
random()/2+0.5) * autocvar_g_nades_napalm_ball_spread;
303 proj.velocity = kick;
305 proj.pushltime =
time + autocvar_g_nades_napalm_ball_lifetime;
308 proj.flags = FL_PROJECTILE;
317 void napalm_fountain_think(
entity this)
339 { this.velocity_z = 200; }
344 napalm_damage(
this, autocvar_g_nades_napalm_fountain_radius, autocvar_g_nades_napalm_fountain_damage,
345 autocvar_g_nades_napalm_fountain_edgedamage, autocvar_g_nades_napalm_burntime);
348 if(
time >= this.nade_special_time)
350 this.nade_special_time =
time + autocvar_g_nades_napalm_fountain_delay;
351 nade_napalm_ball(
this);
355 void nade_napalm_boom(
entity this)
357 for (
int c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
358 nade_napalm_ball(
this);
360 entity fountain =
new(nade_napalm_fountain);
361 fountain.owner = this.
owner;
363 fountain.origin = this.
origin;
364 fountain.flags = FL_PROJECTILE;
368 setthink(fountain, napalm_fountain_think);
369 fountain.nextthink =
time;
370 fountain.ltime =
time + autocvar_g_nades_napalm_fountain_lifetime;
371 fountain.pushltime = fountain.ltime;
372 fountain.team = this.
team;
374 fountain.projectiledeathtype = DEATH_NADE_NAPALM.m_id;
375 fountain.bot_dodge =
true;
376 fountain.bot_dodgerating = autocvar_g_nades_napalm_fountain_damage;
377 fountain.nade_special_time =
time;
378 setsize(fountain,
'-16 -16 -16',
'16 16 16');
382 void nade_ice_freeze(
entity freezefield,
entity frost_target,
float freezetime)
384 frost_target.frozen_by = freezefield.realowner;
385 Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin,
'0 0 0', 1);
391 void nade_ice_think(
entity this)
402 if ( autocvar_g_nades_ice_explode )
405 Send_Effect(expef, this.
origin +
'0 0 1',
'0 0 0', 1);
411 autocvar_g_nades_nade_radius,
'1 1 1' * autocvar_g_nades_nade_force, this.
projectiledeathtype, 0,
this);
423 randomr =
exp(-5*randomr*randomr)*autocvar_g_nades_nade_radius;
427 randomp.x = randomr*
cos(randomw);
428 randomp.y = randomr*
sin(randomw);
430 Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, this.
origin + randomp,
'0 0 0', 1);
432 if(
time >= this.nade_special_time)
434 this.nade_special_time =
time+0.7;
436 Send_Effect(EFFECT_ELECTRO_IMPACT, this.
origin,
'0 0 0', 1);
437 Send_Effect(EFFECT_ICEFIELD, this.
origin,
'0 0 0', 1);
441 float current_freeze_time = this.
ltime -
time - 0.1;
443 FOREACH_ENTITY_RADIUS(this.
origin, autocvar_g_nades_nade_radius, it !=
this && it.takedamage && !
IS_DEAD(it) &&
GetResource(it,
RES_HEALTH) > 0 && current_freeze_time > 0,
446 if(!it.revival_time || ((
time - it.revival_time) >= 1.5))
447 if(!STAT(FROZEN, it))
448 nade_ice_freeze(
this, it, current_freeze_time);
452 void nade_ice_boom(
entity this)
454 entity fountain =
new(nade_ice_fountain);
455 fountain.owner = this.
owner;
457 fountain.origin = this.
origin;
460 fountain.nextthink =
time;
461 fountain.ltime =
time + autocvar_g_nades_ice_freeze_time;
462 fountain.pushltime = fountain.wait = fountain.ltime;
463 fountain.team = this.
team;
465 fountain.projectiledeathtype = DEATH_NADE_ICE.m_id;
466 fountain.bot_dodge =
false;
467 setsize(fountain,
'-16 -16 -16',
'16 16 16');
468 fountain.nade_special_time =
time+0.3;
469 fountain.angles = this.
angles;
471 if ( autocvar_g_nades_ice_explode )
473 setmodel(fountain, MDL_PROJECTILE_GRENADE);
474 entity timer =
new(nade_timer);
476 setattachment(timer, fountain,
"");
480 timer.nextthink =
time;
481 timer.wait = fountain.ltime;
482 timer.owner = fountain;
489 void nade_translocate_boom(
entity this)
505 void nade_spawn_boom(
entity this)
508 entity spawnloc =
new(nade_spawn_loc);
510 setsize(spawnloc, player.mins, player.maxs);
513 spawnloc.drawonlytoclient = player;
515 spawnloc.cnt = autocvar_g_nades_spawn_count;
517 if(player.nade_spawnloc)
518 delete(player.nade_spawnloc);
520 player.nade_spawnloc = spawnloc;
523 void nades_orb_think(
entity this)
533 if(
time >= this.nade_special_time)
535 this.nade_special_time =
time+0.25;
536 this.nade_show_particles = 1;
539 this.nade_show_particles = 0;
547 entity orb =
new(nades_spawn_orb);
549 orb.realowner = realown;
552 orb.orb_lifetime = orb_ltime;
553 orb.ltime =
time + orb.orb_lifetime;
554 orb.bot_dodge =
false;
555 orb.team = realown.team;
560 orb.orb_radius = orb_rad;
562 setsize(orb, -size, size);
564 Net_LinkEntity(orb,
true, 0, orb_send);
568 orb.nextthink =
time;
580 float pushdeltatime =
time - toucher.lastpushtime;
581 if (pushdeltatime > 0.15) pushdeltatime = 0;
582 toucher.lastpushtime =
time;
583 if(!pushdeltatime)
return;
586 toucher.velocity = toucher.velocity * (autocvar_g_nades_entrap_strength ** pushdeltatime);
595 entity show_tint = (
IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
596 STAT(ENTRAP_ORB, show_tint) =
time + 0.1;
598 float tint_alpha = 0.75;
605 void nade_entrap_boom(
entity this)
607 entity orb = nades_spawn_orb(this.
owner, this.
realowner, this.
origin, autocvar_g_nades_entrap_time, autocvar_g_nades_entrap_radius);
609 settouch(orb, nade_entrap_touch);
610 orb.colormod = NADE_TYPE_ENTRAP.m_color;
619 if(!STAT(FROZEN, toucher))
621 health_factor = autocvar_g_nades_heal_rate*
frametime/2;
625 health_factor *= autocvar_g_nades_heal_friend;
627 health_factor *= autocvar_g_nades_heal_foe;
629 if ( health_factor > 0 )
631 maxhealth = (
IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
635 if (this.nade_show_particles)
637 Send_Effect(EFFECT_HEALING, toucher.origin,
'0 0 0', 1);
642 else if ( health_factor < 0 )
651 entity show_red = (
IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
652 STAT(HEALING_ORB, show_red) =
time+0.1;
657 void nade_heal_boom(
entity this)
659 entity orb = nades_spawn_orb(this.
owner, this.
realowner, this.
origin, autocvar_g_nades_heal_time, autocvar_g_nades_nade_radius);
661 settouch(orb, nade_heal_touch);
662 orb.colormod =
'1 0 0';
665 void nade_monster_boom(
entity this)
671 if(autocvar_g_nades_pokenade_monster_lifetime > 0)
672 e.monster_lifetime =
time + autocvar_g_nades_pokenade_monster_lifetime;
680 entity show_tint = (
IS_VEHICLE(toucher) && toucher.owner) ? toucher.owner : toucher;
682 float tint_alpha = 0.75;
686 if(!STAT(VEIL_ORB, show_tint))
688 toucher.nade_veil_prevalpha = toucher.alpha;
692 STAT(VEIL_ORB, show_tint) =
time + 0.1;
697 void nade_veil_boom(
entity this)
699 entity orb = nades_spawn_orb(this.
owner, this.
realowner, this.
origin, autocvar_g_nades_veil_time, autocvar_g_nades_veil_radius);
701 settouch(orb, nade_veil_touch);
702 orb.colormod = NADE_TYPE_VEIL.m_color;
705 void nade_boom(
entity this)
708 bool nade_blast =
true;
710 switch (
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE,
this)) )
712 case NADE_TYPE_NAPALM:
713 nade_blast = autocvar_g_nades_napalm_blast;
714 expef = EFFECT_EXPLOSION_MEDIUM;
718 expef = EFFECT_ELECTRO_COMBO;
720 case NADE_TYPE_TRANSLOCATE:
723 case NADE_TYPE_MONSTER:
724 case NADE_TYPE_SPAWN:
728 case NUM_TEAM_1: expef = EFFECT_SPAWN_RED;
break;
729 case NUM_TEAM_2: expef = EFFECT_SPAWN_BLUE;
break;
730 case NUM_TEAM_3: expef = EFFECT_SPAWN_YELLOW;
break;
731 case NUM_TEAM_4: expef = EFFECT_SPAWN_PINK;
break;
732 default: expef = EFFECT_SPAWN_NEUTRAL;
break;
737 expef = EFFECT_SPAWN_RED;
740 case NADE_TYPE_ENTRAP:
742 expef = EFFECT_SPAWN_YELLOW;
747 expef = EFFECT_SPAWN_NEUTRAL;
751 case NADE_TYPE_NORMAL:
757 Send_Effect(expef, findbetterlocation(this.
origin, 8),
'0 0 0', 1);
772 switch (
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE,
this)) )
774 case NADE_TYPE_NAPALM: nade_napalm_boom(
this);
break;
775 case NADE_TYPE_ICE: nade_ice_boom(
this);
break;
776 case NADE_TYPE_TRANSLOCATE: nade_translocate_boom(
this);
break;
777 case NADE_TYPE_SPAWN: nade_spawn_boom(
this);
break;
778 case NADE_TYPE_HEAL: nade_heal_boom(
this);
break;
779 case NADE_TYPE_MONSTER: nade_monster_boom(
this);
break;
780 case NADE_TYPE_ENTRAP: nade_entrap_boom(
this);
break;
781 case NADE_TYPE_VEIL: nade_veil_boom(
this);
break;
792 void spawn_held_nade(
entity player,
entity nowner,
float ntime,
int ntype,
string pntype);
795 spawn_held_nade(
this, thenade.realowner, autocvar_g_nades_pickup_time, STAT(NADE_BONUS_TYPE, thenade), thenade.pokenade_type);
798 this.nade_refire =
time + autocvar_g_nades_nade_refire;
799 STAT(NADE_TIMER,
this) = 0;
802 this.
nade.nade_time_primed = thenade.nade_time_primed;
805 bool CanThrowNade(
entity this);
814 if(autocvar_g_nades_pickup)
817 if(CanThrowNade(toucher))
820 nade_pickup(toucher,
this);
850 this.
enemy = toucher;
854 void nade_beep(
entity this)
870 if(STAT(NADE_BONUS_TYPE,
this) == NADE_TYPE_TRANSLOCATE.m_id || STAT(NADE_BONUS_TYPE,
this) == NADE_TYPE_SPAWN.m_id)
893 if(!(deathtype & HITTYPE_SECONDARY))
923 if ( STAT(NADE_BONUS_TYPE,
this) != NADE_TYPE_HEAL.m_id ||
IS_PLAYER(attacker) )
929 nade_burn_spawn(
this);
932 void toss_nade(
entity e,
bool set_owner,
vector _velocity,
float _time)
944 Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
952 + (
v_right * autocvar_g_nades_throw_offset.y)
953 + (
v_up * autocvar_g_nades_throw_offset.z);
959 if(STAT(NADES_SMALL, e))
960 setsize(_nade,
'-8 -8 -8',
'8 8 8');
962 setsize(_nade,
'-16 -16 -16',
'16 16 16');
965 tracebox(_nade.origin, _nade.mins, _nade.maxs, _nade.origin,
MOVE_NOMONSTERS, _nade);
970 _nade.velocity =
'0 0 100';
971 else if(autocvar_g_nades_nade_newton_style == 1)
972 _nade.velocity = e.velocity + _velocity;
973 else if(autocvar_g_nades_nade_newton_style == 2)
974 _nade.velocity = _velocity;
981 settouch(_nade, nade_touch);
982 _nade.spawnshieldtime =
time + 0.1;
986 _nade.event_damage = nade_damage;
988 _nade.exteriormodeltoclient =
NULL;
989 _nade.traileffectnum = 0;
990 _nade.teleportable =
true;
991 _nade.pushable =
true;
994 _nade.damagedbycontents =
true;
997 _nade.flags = FL_PROJECTILE;
1000 _nade.projectiledeathtype = DEATH_NADE.m_id;
1001 _nade.toss_time =
time;
1004 if(STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_TRANSLOCATE.m_id || STAT(NADE_BONUS_TYPE, _nade) == NADE_TYPE_SPAWN.m_id)
1014 _nade.nextthink = _time;
1017 e.nade_refire =
time + autocvar_g_nades_nade_refire;
1018 STAT(NADE_TIMER, e) = 0;
1023 if (autocvar_g_nades)
1024 if (autocvar_g_nades_bonus)
1026 if (
IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max)
1027 if (!STAT(FROZEN, player))
1030 if ( STAT(NADE_BONUS_SCORE, player) < 1 )
1031 STAT(NADE_BONUS_SCORE, player) += score/autocvar_g_nades_bonus_score_max;
1033 if ( STAT(NADE_BONUS_SCORE, player) >= 1 )
1035 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_BONUS);
1036 play2(player,
SND(NADE_BONUS));
1037 STAT(NADE_BONUS, player)++;
1038 STAT(NADE_BONUS_SCORE, player) -= 1;
1044 void nades_RemoveBonus(
entity player)
1046 STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
1053 nades_RemoveBonus(player);
1073 this.
traileffectnum = _particleeffectnum(Nade_TrailEffect(nade.m_projectile[
false],
this.team).eent_eff_name);
1081 void spawn_held_nade(
entity player,
entity nowner,
float ntime,
int ntype,
string pntype)
1085 STAT(NADE_BONUS_TYPE, n) =
max(1, ntype);
1086 n.pokenade_type = pntype;
1088 if(
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
1089 STAT(NADE_BONUS_TYPE, n) = NADE_TYPE_NORMAL.m_id;
1095 n.exteriormodeltoclient = player;
1096 setcefc(n, nade_customize);
1097 n.traileffectnum = _particleeffectnum(Nade_TrailEffect(
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_projectile[
false], player.team).eent_eff_name);
1098 n.colormod =
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
1099 n.realowner = nowner;
1100 n.colormap = player.colormap;
1101 n.glowmod = player.glowmod;
1102 n.wait =
time +
max(0, ntime);
1103 n.nade_time_primed =
time;
1105 n.nextthink =
max(n.wait - 3,
time);
1106 n.projectiledeathtype = DEATH_NADE.m_id;
1107 n.weaponentity_fld = weaponentity;
1108 n.nade_lifetime = ntime;
1109 n.alpha =
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
1113 fn.viewmodelforclient = player;
1114 fn.realowner = fn.owner = player;
1115 fn.colormod =
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
1116 fn.colormap = player.colormap;
1117 fn.glowmod = player.glowmod;
1119 fn.nextthink = n.wait;
1120 fn.weaponentity_fld = weaponentity;
1121 fn.alpha =
REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
1124 player.fake_nade = fn;
1127 void nade_prime(
entity this)
1129 if(autocvar_g_nades_bonus_only && !STAT(NADE_BONUS,
this))
1138 delete(this.fake_nade);
1139 this.fake_nade =
NULL;
1142 string pntype = this.pokenade_type;
1144 if(StatusEffects_active(STATUSEFFECT_Strength,
this) && autocvar_g_nades_bonus_onstrength)
1145 ntype = STAT(NADE_BONUS_TYPE,
this);
1146 else if (STAT(NADE_BONUS,
this) >= 1)
1148 ntype = STAT(NADE_BONUS_TYPE,
this);
1149 pntype = this.pokenade_type;
1150 STAT(NADE_BONUS,
this) -= 1;
1154 ntype = ((autocvar_g_nades_client_select) ?
CS_CVAR(
this).cvar_cl_nade_type : autocvar_g_nades_nade_type);
1155 pntype = ((autocvar_g_nades_client_select) ?
CS_CVAR(
this).cvar_cl_pokenade_type : autocvar_g_nades_pokenade_monster_type);
1158 spawn_held_nade(
this,
this, autocvar_g_nades_nade_lifetime, ntype, pntype);
1161 bool CanThrowNade(
entity this)
1166 .bool nade_altbutton;
1168 void nades_CheckThrow(
entity this)
1170 if(!CanThrowNade(
this))
1176 this.nade_altbutton =
true;
1177 if(
time > this.nade_refire)
1180 this.nade_refire =
time + autocvar_g_nades_nade_refire;
1185 this.nade_altbutton =
false;
1186 if (
time >= held_nade.nade_time_primed + 1) {
1188 float _force =
time - held_nade.nade_time_primed;
1189 _force /= autocvar_g_nades_nade_lifetime;
1190 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
1193 toss_nade(
this,
true, dir * _force, 0);
1201 delete(player.nade);
1202 if(player.fake_nade)
1203 delete(player.fake_nade);
1205 player.nade = player.fake_nade =
NULL;
1206 STAT(NADE_TIMER, player) = 0;
1214 toss_nade(player,
true,
'0 0 100',
max(player.nade.wait,
time + 0.05));
1218 METHOD(NadeOffhand, offhand_think,
void(NadeOffhand
this,
entity player,
bool key_pressed))
1220 entity held_nade = player.nade;
1222 if (!CanThrowNade(player))
return;
1223 if (!(
time > player.nade_refire))
return;
1227 held_nade = player.nade;
1229 }
else if (
time >= held_nade.nade_time_primed + 1) {
1232 float _force =
time - held_nade.nade_time_primed;
1233 _force /= autocvar_g_nades_nade_lifetime;
1234 _force = autocvar_g_nades_nade_minforce + (_force * (autocvar_g_nades_nade_maxforce - autocvar_g_nades_nade_minforce));
1237 toss_nade(player,
false, dir * _force, 0);
1242 NadeOffhand OFFHAND_NADE;
1247 OFFHAND_NADE =
NEW(NadeOffhand);
1256 if (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) &
WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
1257 nades_CheckThrow(player);
1262 #ifdef IN_REVIVING_RANGE 1263 #undef IN_REVIVING_RANGE 1267 #define IN_REVIVING_RANGE(player, it, revive_extra_size) \ 1268 (it != player && !IS_DEAD(it) && SAME_TEAM(it, player) \ 1269 && boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax)) 1277 if (player.nade && (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) &
WEPSET(HOOK))))
1278 OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
1280 entity held_nade = player.nade;
1283 STAT(NADE_TIMER, player) =
bound(0, (
time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
1286 held_nade.velocity = player.velocity;
1288 held_nade.angles_y = player.angles.y;
1290 if (
time + 0.1 >= held_nade.wait)
1292 toss_nade(player,
false,
'0 0 0',
time + 0.05);
1293 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_NADE_THROW);
1299 if ( autocvar_g_nades_bonus && autocvar_g_nades )
1302 float key_count = 0;
1307 time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
1309 time_score = autocvar_g_nades_bonus_score_time;
1312 time_score = autocvar_g_nades_bonus_score_time_flagcarrier * key_count;
1314 if(autocvar_g_nades_bonus_client_select)
1316 STAT(NADE_BONUS_TYPE, player) =
CS_CVAR(player).cvar_cl_nade_type;
1317 player.pokenade_type =
CS_CVAR(player).cvar_cl_pokenade_type;
1321 STAT(NADE_BONUS_TYPE, player) = autocvar_g_nades_bonus_type;
1322 player.pokenade_type = autocvar_g_nades_pokenade_monster_type;
1325 STAT(NADE_BONUS_TYPE, player) =
bound(1, STAT(NADE_BONUS_TYPE, player), Nades_COUNT);
1327 if(STAT(NADE_BONUS_SCORE, player) >= 0 && autocvar_g_nades_bonus_score_max)
1328 nades_GiveBonus(player, time_score / autocvar_g_nades_bonus_score_max);
1332 STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
1335 if(STAT(VEIL_ORB, player) && STAT(VEIL_ORB, player) <=
time)
1337 STAT(VEIL_ORB, player) = 0;
1339 player.vehicle.alpha = player.vehicle.nade_veil_prevalpha;
1341 player.alpha = player.nade_veil_prevalpha;
1351 bool player_is_reviving =
false;
1362 player_is_reviving =
true;
1369 revivers_last.chain = it;
1371 if (!revivers_first)
1372 revivers_first = it;
1376 revivers_last.chain =
NULL;
1381 if (!
g_freezetag && !STAT(FROZEN, player) && !player_is_reviving)
1382 STAT(REVIVE_PROGRESS, player) = 0;
1388 STAT(REVIVE_PROGRESS, player) =
bound(0, STAT(REVIVE_PROGRESS, player) +
frametime * player.revive_speed, 1);
1391 if(STAT(REVIVE_PROGRESS, player) >= 1)
1395 Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, revivers_first.netname);
1396 Send_Notification(NOTIF_ONE, revivers_first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
1399 for(
entity it = revivers_first; it; it = it.chain)
1400 STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
1409 if(STAT(ENTRAP_ORB, player) >
time)
1410 STAT(MOVEVARS_HIGHSPEED, player) *= autocvar_g_nades_entrap_speed;
1417 if (STAT(ENTRAP_ORB, mon) >
time)
1419 M_ARGV(1,
float) *= autocvar_g_nades_entrap_speed;
1420 M_ARGV(2,
float) *= autocvar_g_nades_entrap_speed;
1423 if (STAT(VEIL_ORB, mon) && STAT(VEIL_ORB, mon) <=
time)
1425 mon.alpha = mon.nade_veil_prevalpha;
1426 STAT(VEIL_ORB, mon) = 0;
1434 if(autocvar_g_nades_spawn)
1437 player.nade_refire =
time + autocvar_g_nades_nade_refire;
1439 if(autocvar_g_nades_bonus_client_select)
1440 STAT(NADE_BONUS_TYPE, player) =
CS_CVAR(player).cvar_cl_nade_type;
1442 STAT(NADE_TIMER, player) = 0;
1444 if (!player.offhand) player.offhand = OFFHAND_NADE;
1446 if(player.nade_spawnloc)
1448 setorigin(player, player.nade_spawnloc.origin);
1449 player.nade_spawnloc.cnt -= 1;
1451 if(player.nade_spawnloc.cnt <= 0)
1453 delete(player.nade_spawnloc);
1454 player.nade_spawnloc =
NULL;
1464 if(frag_target.nade)
1466 toss_nade(frag_target,
true,
'0 0 100',
max(frag_target.nade.wait,
time + 0.05));
1470 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)
1471 : autocvar_g_nades_bonus_score_minor);
1472 if (
SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
1473 nades_RemoveBonus(frag_attacker);
1476 else if(autocvar_g_nades_bonus_score_spree &&
CS(frag_attacker).killcount > 1)
1478 #define SPREE_ITEM(counta,countb,center,normal,gentle) \ 1479 case counta: { nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_spree); break; } 1480 switch(
CS(frag_attacker).killcount)
1483 default:
nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_minor);
break;
1491 nades_RemoveBonus(frag_target);
1499 float frag_deathtype =
M_ARGV(3,
float);
1502 if(
time - frag_inflictor.toss_time <= 0.1)
1506 Send_Effect(EFFECT_ICEORGLASS, frag_target.origin,
'0 0 0', 3);
1509 Send_Notification(NOTIF_ALL,
NULL, MSG_INFO, INFO_FREEZETAG_REVIVED_NADE, frag_target.netname);
1510 Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_REVIVE_SELF);
1520 if(
DIFF_TEAM(frag_attacker, frag_target))
1529 if(frag_target.nade)
1530 toss_nade(frag_target,
true,
'0 0 0',
time + 0.05);
1533 void nades_RemovePlayer(
entity this)
1536 nades_RemoveBonus(
this);
1545 nades_RemovePlayer(it);
1554 STAT(NADE_TIMER, client) = STAT(NADE_TIMER, spectatee);
1555 STAT(NADE_BONUS_TYPE, client) = STAT(NADE_BONUS_TYPE, spectatee);
1556 client.pokenade_type = spectatee.pokenade_type;
1557 STAT(NADE_BONUS, client) = STAT(NADE_BONUS, spectatee);
1558 STAT(NADE_BONUS_SCORE, client) = STAT(NADE_BONUS_SCORE, spectatee);
1559 STAT(HEALING_ORB, client) = STAT(HEALING_ORB, spectatee);
1560 STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee);
1561 STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
1562 STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
1563 STAT(VEIL_ORB, client) = STAT(VEIL_ORB, spectatee);
1564 STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee);
1574 M_ARGV(0,
string) =
strcat(
M_ARGV(0,
string),
"\n\n^3nades^8 are enabled, press 'g' (dropweapon) to use them\n");
#define round_handler_IsActive()
#define IL_EACH(this, cond, body)
const int PROJECTILE_NAPALM_FOUNTAIN
#define PHYS_INPUT_BUTTON_CROUCH(s)
void SpectateCopy(entity this, entity spectatee)
bool autocvar_hud_panel_ammo_iconalign
entity spawnmonster(entity e, string monster, Monster monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag)
#define PROJECTILE_MAKETRIGGER(e)
Sound SND_GRENADE_BOUNCE_RANDOM()
#define REGISTER_MUTATOR(id, dependence)
vector W_CalculateSpread(vector forward, float spread, float spreadfactor, float spreadstyle)
const int PROJECTILE_NADE
ERASEABLE void RandomSelection_Init()
IntrusiveList g_damagedbycontents
#define REGISTRY_GET(id, i)
ClientState CS(Client this)
void Freeze(entity targ, float revivespeed, int frozen_type, bool show_waypoint)
void nades_Clear(entity player)
#define FOREACH_CLIENT(cond, body)
REPLICATE(cvar_cl_casings, bool, "cl_casings")
void loopsound(entity e, int ch, Sound samp, float vol, float attn)
float DPCONTENTS_PLAYERCLIP
float autocvar_g_freezetag_revive_nade_health
entity EFFECT_NADE_TRAIL(int teamid)
#define round_handler_IsRoundStarted()
bool GameRules_scoring_is_vip(entity player)
#define METHOD(cname, name, prototype)
void CSQCProjectile(entity e, float clientanimate, int type, float docull)
entity EFFECT_NADE_EXPLODE(int teamid)
bool autocvar_hud_panel_ammo_text
void PlayerPreThink(entity this)
#define DEATH_WEAPONOF(t)
float autocvar_g_freezetag_revive_extra_size
IntrusiveList g_bot_dodge
#define IS_REAL_CLIENT(v)
vector WarpZone_UnTransformOrigin(entity wz, vector v)
#define PROJECTILE_TOUCH(e, t)
#define setmodel(this, m)
void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector color)
const int MONSTER_SKILL_INSANE
#define RandomSelection_AddEnt(e, weight, priority)
void Unfreeze(entity targ, bool reset_health)
Nade Nade_FromProjectile(int proj)
bool weaponLocked(entity player)
entity exteriormodeltoclient
const float MOVE_NOMONSTERS
#define drawpic_aspect_skin(pos, pic, sz, color, theAlpha, drawflag)
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void UpdateCSQCProjectile(entity e)
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool autocvar_g_freezetag_revive_nade
void W_PrepareExplosionByDamage(entity this, entity attacker, void(entity this) explode)
entity RandomSelection_chosen_ent
const float CONTENT_WATER
int autocvar_g_projectiles_spread_style
float autocvar_g_freezetag_revive_speed
const int WEP_TYPE_MELEE_SEC
#define TELEPORT_FLAGS_TELEPORTER
const float DRAWFLAG_NORMAL
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
void nades_GiveBonus(entity player, float score)
const int HITTYPE_SECONDARY
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
entity WarpZone_FindRadius(vector org, float rad, bool needlineofsight)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int PROJECTILE_NADE_BURN
#define ITEM_DAMAGE_NEEDKILL(dt)
float autocvar_g_weaponspreadfactor
REGISTER_STAT(MOVEFLAGS, int, MOVEFLAG_VALID|(autocvar_sv_gameplayfix_q2airaccelerate ? MOVEFLAG_Q2AIRACCELERATE :0)|(autocvar_sv_gameplayfix_nogravityonground ? MOVEFLAG_NOGRAVITYONGROUND :0)|(autocvar_sv_gameplayfix_gravityunaffectedbyticrate ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE :0)) .float gravity
cvar loopback
IntrusiveList g_projectiles
#define IN_REVIVING_RANGE(player, it, revive_extra_size)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define ITEM_TOUCH_NEEDKILL()
float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
#define FOR_EACH_KH_KEY(v)
const float SOLID_TRIGGER
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
#define MUTATOR_CALLHOOK(id,...)
#define nade(name, colormin1, colormax1, colormin2, colormax2)
void Drop_Special_Items(entity player)
entity weaponentities[MAX_WEAPONSLOTS]
void Damage_DamageInfo(vector org, float coredamage, float edgedamage, float rad, vector force, int deathtype, float bloodtype, entity dmgowner)
#define MUTATOR_HOOKFUNCTION(...)
const int CH_SHOTS_SINGLE
#define DEATH_ISWEAPON(t, w)
vector W_CalculateProjectileVelocity(entity actor, vector pvelocity, vector mvelocity, float forceAbsolute)
#define sound(e, c, s, v, a)
entity EFFECT_NADE_TRAIL_BURN(int teamid)
float autocvar_g_spawnshieldtime
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
#define FOREACH(list, cond, body)
const int FROZEN_TEMP_DYING
bool isPushable(entity e)
void set_movetype(entity this, int mt)
const int MONSTERFLAG_SPAWNED
const int WEP_TYPE_MELEE_PRI