#include "nades.qh"
+#include "../overkill/okmachinegun.qh"
+
#ifdef SVQC
bool autocvar_g_nades_nade_small;
float autocvar_g_nades_spread = 0.04;
REGISTER_MUTATOR(cl_nades, true);
MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
{
+ // TODO: make a common orb state!
if (STAT(HEALING_ORB) > time)
{
M_ARGV(0, vector) = NADE_TYPE_HEAL.m_color;
M_ARGV(1, float) = STAT(ENTRAP_ORB_ALPHA);
return true;
}
+ if (STAT(VEIL_ORB) > time)
+ {
+ M_ARGV(0, vector) = NADE_TYPE_VEIL.m_color;
+ M_ARGV(1, float) = STAT(VEIL_ORB_ALPHA);
+ return true;
+ }
return false;
}
MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
settouch(proj, func_null);
proj.scale = 1.5;
proj.avelocity = randomvec() * 720;
+ proj.alphamod = nade_type.m_alpha;
if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
proj.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
#include <common/gamemodes/_mod.qh>
#include <common/monsters/sv_spawn.qh>
#include <common/monsters/sv_monsters.qh>
-#include <server/g_subs.qh>
REGISTER_MUTATOR(nades, autocvar_g_nades);
{
frost_target.frozen_by = freezefield.realowner;
Send_Effect(EFFECT_ELECTRO_IMPACT, frost_target.origin, '0 0 0', 1);
- Freeze(frost_target, 1 / freezetime, 3, false);
+ Freeze(frost_target, 1 / freezetime, FROZEN_TEMP_DYING, false);
Drop_Special_Items(frost_target);
}
float current_freeze_time = this.ltime - time - 0.1;
- FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_nades_nade_radius, it != this && it.takedamage && !IS_DEAD(it) && GetResourceAmount(it, RESOURCE_HEALTH) > 0 && current_freeze_time > 0,
+ 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,
{
if(!autocvar_g_nades_ice_teamcheck || (DIFF_TEAM(it, this.realowner) || it == this.realowner))
if(!it.revival_time || ((time - it.revival_time) >= 1.5))
if ( health_factor > 0 )
{
maxhealth = (IS_MONSTER(toucher)) ? toucher.max_health : g_pickup_healthmega_max;
- float hp = GetResourceAmount(toucher, RESOURCE_HEALTH);
+ float hp = GetResource(toucher, RES_HEALTH);
if (hp < maxhealth)
{
if (this.nade_show_particles)
{
Send_Effect(EFFECT_HEALING, toucher.origin, '0 0 0', 1);
}
- GiveResourceWithLimit(toucher, RESOURCE_HEALTH, health_factor, maxhealth);
+ GiveResourceWithLimit(toucher, RES_HEALTH, health_factor, maxhealth);
}
}
else if ( health_factor < 0 )
e.monster_skill = MONSTER_SKILL_INSANE;
}
+void nade_veil_touch(entity this, entity toucher)
+{
+ if ( IS_REAL_CLIENT(toucher) || IS_VEHICLE(toucher) || IS_MONSTER(toucher) )
+ {
+ entity show_tint = (IS_VEHICLE(toucher)) ? toucher.owner : toucher;
+
+ float tint_alpha = 0.75;
+ if(SAME_TEAM(toucher, this.realowner))
+ {
+ tint_alpha = 0.45;
+ if(!STAT(VEIL_ORB, show_tint))
+ {
+ toucher.nade_veil_prevalpha = toucher.alpha;
+ toucher.alpha = -1;
+ }
+ }
+ STAT(VEIL_ORB, show_tint) = time + 0.1;
+ STAT(VEIL_ORB_ALPHA, show_tint) = tint_alpha * (this.ltime - time) / this.orb_lifetime;
+ }
+}
+
+void nade_veil_boom(entity this)
+{
+ entity orb = nades_spawn_orb(this.owner, this.realowner, this.origin, autocvar_g_nades_veil_time, autocvar_g_nades_veil_radius);
+
+ settouch(orb, nade_veil_touch);
+ orb.colormod = NADE_TYPE_VEIL.m_color;
+}
+
void nade_boom(entity this)
{
entity expef = NULL;
expef = EFFECT_SPAWN_YELLOW;
break;
+ case NADE_TYPE_VEIL:
+ nade_blast = false;
+ expef = EFFECT_SPAWN_NEUTRAL;
+ break;
+
default:
case NADE_TYPE_NORMAL:
expef = EFFECT_NADE_EXPLODE(this.realowner.team);
case NADE_TYPE_HEAL: nade_heal_boom(this); break;
case NADE_TYPE_MONSTER: nade_monster_boom(this); break;
case NADE_TYPE_ENTRAP: nade_entrap_boom(this); break;
+ case NADE_TYPE_VEIL: nade_veil_boom(this); break;
}
IL_EACH(g_projectiles, it.classname == "grapplinghook" && it.aiment == this,
if(autocvar_g_nades_pickup)
if(time >= this.spawnshieldtime)
- if(!toucher.nade && GetResourceAmount(this, RESOURCE_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
+ if(!toucher.nade && GetResource(this, RES_HEALTH) == this.max_health) // no boosted shot pickups, thank you very much
if(CanThrowNade(toucher)) // prevent some obvious things, like dead players
if(IS_REAL_CLIENT(toucher)) // above checks for IS_PLAYER, don't need to do it here
{
//setsize(this, '-2 -2 -2', '2 2 2');
//UpdateCSQCProjectile(this);
- if(GetResourceAmount(this, RESOURCE_HEALTH) == this.max_health)
+ if(GetResource(this, RES_HEALTH) == this.max_health)
{
spamsound(this, CH_SHOTS, SND_GRENADE_BOUNCE_RANDOM(), VOL_BASE, ATTEN_NORM);
return;
force *= 0.5; // too much
damage = 0;
}
- else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER))
+ else if(DEATH_ISWEAPON(deathtype, WEP_VORTEX) || DEATH_ISWEAPON(deathtype, WEP_VAPORIZER) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_NEX))
{
force *= 6;
damage = this.max_health * 0.55;
}
- else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN))
+ else if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN) || DEATH_ISWEAPON(deathtype, WEP_OVERKILL_MACHINEGUN))
damage = this.max_health * 0.1;
else if(DEATH_ISWEAPON(deathtype, WEP_SHOCKWAVE) || DEATH_ISWEAPON(deathtype, WEP_SHOTGUN)) // WEAPONTODO
{
if(damage <= 0 || ((IS_ONGROUND(this)) && IS_PLAYER(attacker)))
return;
- float hp = GetResourceAmount(this, RESOURCE_HEALTH);
+ float hp = GetResource(this, RES_HEALTH);
if(hp == this.max_health)
{
sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
}
hp -= damage;
- SetResourceAmount(this, RESOURCE_HEALTH, hp);
+ SetResource(this, RES_HEALTH, hp);
if ( STAT(NADE_BONUS_TYPE, this) != NADE_TYPE_HEAL.m_id || IS_PLAYER(attacker) )
settouch(_nade, nade_touch);
_nade.spawnshieldtime = time + 0.1; // prevent instantly picking up again
- SetResourceAmount(_nade, RESOURCE_HEALTH, autocvar_g_nades_nade_health);
- _nade.max_health = _nade.health;
+ SetResource(_nade, RES_HEALTH, autocvar_g_nades_nade_health);
+ _nade.max_health = GetResource(_nade, RES_HEALTH);
_nade.takedamage = DAMAGE_AIM;
_nade.event_damage = nade_damage;
setcefc(_nade, func_null);
if (autocvar_g_nades_bonus)
if (IS_REAL_CLIENT(player))
if (IS_PLAYER(player) && STAT(NADE_BONUS, player) < autocvar_g_nades_bonus_max)
- if (STAT(FROZEN, player) == 0)
+ if (!STAT(FROZEN, player))
if (!IS_DEAD(player))
{
if ( STAT(NADE_BONUS_SCORE, player) < 1 )
n.projectiledeathtype = DEATH_NADE.m_id;
n.weaponentity_fld = weaponentity;
n.nade_lifetime = ntime;
+ n.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
setmodel(fn, MDL_NADE_VIEW);
- setattachment(fn, player.(weaponentity), "");
+ //setattachment(fn, player.(weaponentity), "");
+ fn.viewmodelforclient = player;
fn.realowner = fn.owner = player;
fn.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
fn.colormap = player.colormap;
setthink(fn, SUB_Remove);
fn.nextthink = n.wait;
fn.weaponentity_fld = weaponentity;
+ fn.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
player.nade = n;
player.fake_nade = fn;
if (!autocvar_g_nades)
return false; // allow turning them off mid match
- if(forbidWeaponUse(this))
+ if (weaponLocked(this))
return false;
if (!IS_PLAYER(this))
{
entity player = M_ARGV(0, entity);
- if (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
+ if (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK)) || autocvar_g_nades_override_dropweapon) {
nades_CheckThrow(player);
return true;
}
}
+#ifdef IS_REVIVING
+ #undef IS_REVIVING
+#endif
+
+// returns true if player is reviving it
+#define IS_REVIVING(player, it, revive_extra_size) \
+ (it != player && !STAT(FROZEN, it) && !IS_DEAD(it) && SAME_TEAM(it, player) \
+ && boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
+
MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
{
entity player = M_ARGV(0, entity);
if (!IS_PLAYER(player)) { return; }
- if (player.nade && (player.offhand != OFFHAND_NADE || (player.weapons & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
+ if (player.nade && (player.offhand != OFFHAND_NADE || (STAT(WEAPONS, player) & WEPSET(HOOK)))) OFFHAND_NADE.offhand_think(OFFHAND_NADE, player, player.nade_altbutton);
entity held_nade = player.nade;
if (held_nade)
{
STAT(NADE_BONUS, player) = STAT(NADE_BONUS_SCORE, player) = 0;
}
+
+ if(STAT(VEIL_ORB, player) && STAT(VEIL_ORB, player) <= time)
+ {
+ STAT(VEIL_ORB, player) = 0;
+ if(player.vehicle)
+ player.vehicle.alpha = player.vehicle.nade_veil_prevalpha;
+ else
+ player.alpha = player.nade_veil_prevalpha;
+ }
}
int n = 0;
- entity o = NULL;
+
+ IntrusiveList reviving_players = NULL;
+
if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout)
n = -1;
- else if(STAT(FROZEN, player) == 3)
+ else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING)
{
vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
n = 0;
- FOREACH_CLIENT(IS_PLAYER(it) && it != player, {
- if(!IS_DEAD(it) && STAT(FROZEN, it) == 0 && SAME_TEAM(it, player))
- if(boxesoverlap(player.absmin - revive_extra_size, player.absmax + revive_extra_size, it.absmin, it.absmax))
- {
- if(!o)
- o = it;
- it.reviving = true;
- ++n;
- }
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
+ if (!reviving_players)
+ reviving_players = IL_NEW();
+ IL_PUSH(reviving_players, it);
+ ++n;
});
}
- if(n > 0 && STAT(FROZEN, player) == 3) // OK, there is at least one teammate reviving us
+ if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // OK, there is at least one teammate reviving us
{
STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
- SetResourceAmount(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
+ SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health));
if(STAT(REVIVE_PROGRESS, player) >= 1)
{
- Unfreeze(player);
+ Unfreeze(player, false);
- Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, o.netname);
- Send_Notification(NOTIF_ONE, o, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
+ entity first = IL_FIRST(reviving_players);
+ Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname);
+ Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname);
}
- FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
+ IL_EACH(reviving_players, true, {
STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player);
- it.reviving = false;
});
}
+ if (reviving_players)
+ IL_DELETE(reviving_players);
}
MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats)
M_ARGV(1, float) *= autocvar_g_nades_entrap_speed; // run speed
M_ARGV(2, float) *= autocvar_g_nades_entrap_speed; // walk speed
}
+
+ if (STAT(VEIL_ORB, mon) && STAT(VEIL_ORB, mon) <= time)
+ {
+ mon.alpha = mon.nade_veil_prevalpha;
+ STAT(VEIL_ORB, mon) = 0;
+ }
}
MUTATOR_HOOKFUNCTION(nades, PlayerSpawn)
entity frag_target = M_ARGV(2, entity);
float frag_deathtype = M_ARGV(3, float);
- if(STAT(FROZEN, frag_target))
- if(autocvar_g_freezetag_revive_nade)
- if(frag_attacker == frag_target)
- if(frag_deathtype == DEATH_NADE.m_id)
+ if(autocvar_g_freezetag_revive_nade && STAT(FROZEN, frag_target) && frag_attacker == frag_target && frag_deathtype == DEATH_NADE.m_id)
if(time - frag_inflictor.toss_time <= 0.1)
{
- Unfreeze(frag_target);
- SetResourceAmount(frag_target, RESOURCE_HEALTH, autocvar_g_freezetag_revive_nade_health);
+ Unfreeze(frag_target, false);
+ SetResource(frag_target, RES_HEALTH, autocvar_g_freezetag_revive_nade_health);
Send_Effect(EFFECT_ICEORGLASS, frag_target.origin, '0 0 0', 3);
M_ARGV(4, float) = 0;
M_ARGV(6, vector) = '0 0 0';
STAT(HEALING_ORB_ALPHA, client) = STAT(HEALING_ORB_ALPHA, spectatee);
STAT(ENTRAP_ORB, client) = STAT(ENTRAP_ORB, spectatee);
STAT(ENTRAP_ORB_ALPHA, client) = STAT(ENTRAP_ORB_ALPHA, spectatee);
+ STAT(VEIL_ORB, client) = STAT(VEIL_ORB, spectatee);
+ STAT(VEIL_ORB_ALPHA, client) = STAT(VEIL_ORB_ALPHA, spectatee);
}
REPLICATE(cvar_cl_nade_type, int, "cl_nade_type");