#ifdef SVQC
.float strength_finished; // NOTE: this field is used only by map entities, it does not directly apply the strength stat
-const .float invincible_finished = _STAT(INVINCIBLE_FINISHED);
+.float invincible_finished; // ditto
#define spawnfunc_body(item) \
if (!Item_IsDefinitionAllowed(item)) \
if (player.items & ITEM_Speed.m_itemid)
{
- play_countdown(player, player.invincible_finished, SND_POWEROFF);
- if (time > player.invincible_finished)
+ play_countdown(player, STAT(INVINCIBLE_FINISHED, player), SND_POWEROFF);
+ if (time > STAT(INVINCIBLE_FINISHED, player))
{
player.items &= ~ITEM_Speed.m_itemid;
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_POWERDOWN_SPEED);
}
else
{
- if (time < player.invincible_finished)
+ if (time < STAT(INVINCIBLE_FINISHED, player))
{
player.items |= ITEM_Speed.m_itemid;
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERUP_SPEED, player.netname);
if(cmd_name == "followpowerup")
{
- FOREACH_CLIENT(IS_PLAYER(it) && (STAT(STRENGTH_FINISHED, it) > time || it.invincible_finished > time), { return superspec_Spectate(player, it); });
+ FOREACH_CLIENT(IS_PLAYER(it) && (STAT(STRENGTH_FINISHED, it) > time || STAT(INVINCIBLE_FINISHED, it) > time), { return superspec_Spectate(player, it); });
superspec_msg("", "", player, "No active powerup\n", 1);
return true;
if(cmd_name == "followshield")
{
- FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, { return superspec_Spectate(player, it); });
+ FOREACH_CLIENT(IS_PLAYER(it) && STAT(INVINCIBLE_FINISHED, it) > time, { return superspec_Spectate(player, it); });
superspec_msg("", "", player, "No active Shield\n", 1);
return true;
if (item.invincible_finished)
{
pickedup = true;
- player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
+ STAT(INVINCIBLE_FINISHED, player) = max(STAT(INVINCIBLE_FINISHED, player), time) + item.invincible_finished;
}
if (item.superweapons_finished)
{
}
STAT(STRENGTH_FINISHED, e) = max(0, STAT(STRENGTH_FINISHED, e) - time);
- e.invincible_finished = max(0, e.invincible_finished - time);
+ STAT(INVINCIBLE_FINISHED, e) = max(0, STAT(INVINCIBLE_FINISHED, e) - time);
e.superweapons_finished = max(0, e.superweapons_finished - time);
STAT(BUFF_TIME, e) = max(0, STAT(BUFF_TIME, e) - time);
PREGIVE(e, items);
PREGIVE_WEAPONS(e);
PREGIVE(e, stat_STRENGTH_FINISHED);
- PREGIVE(e, invincible_finished);
+ PREGIVE(e, stat_INVINCIBLE_FINISHED);
PREGIVE(e, superweapons_finished);
PREGIVE_RESOURCE(e, RES_BULLETS);
PREGIVE_RESOURCE(e, RES_CELLS);
case "ALL":
got += GiveBit(e, items, ITEM_JetpackRegen.m_itemid, op, val);
got += GiveValue(e, stat_STRENGTH_FINISHED, op, val);
- got += GiveValue(e, invincible_finished, op, val);
+ got += GiveValue(e, stat_INVINCIBLE_FINISHED, op, val);
got += GiveValue(e, superweapons_finished, op, val);
got += GiveBit(e, items, IT_UNLIMITED_AMMO | IT_UNLIMITED_SUPERWEAPONS, op, val);
case "all":
got += GiveValue(e, stat_STRENGTH_FINISHED, op, val);
break;
case "invincible":
- got += GiveValue(e, invincible_finished, op, val);
+ got += GiveValue(e, stat_INVINCIBLE_FINISHED, op, val);
break;
case "superweapons":
got += GiveValue(e, superweapons_finished, op, val);
it.wr_init(it);
});
POSTGIVE_VALUE(e, stat_STRENGTH_FINISHED, 1, SND_POWERUP, SND_POWEROFF);
- POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
+ POSTGIVE_VALUE(e, stat_INVINCIBLE_FINISHED, 1, SND_Shield, SND_POWEROFF);
//POSTGIVE_VALUE(e, superweapons_finished, 1, SND_Null, SND_Null);
POSTGIVE_RESOURCE(e, RES_BULLETS, 0, SND_ITEMPICKUP, SND_Null);
POSTGIVE_RESOURCE(e, RES_CELLS, 0, SND_ITEMPICKUP, SND_Null);
STAT(STRENGTH_FINISHED, e) = 0;
else
STAT(STRENGTH_FINISHED, e) += time;
- if(e.invincible_finished <= 0)
- e.invincible_finished = 0;
+ if(STAT(INVINCIBLE_FINISHED, e) <= 0)
+ STAT(INVINCIBLE_FINISHED, e) = 0;
else
- e.invincible_finished += time;
+ STAT(INVINCIBLE_FINISHED, e) += time;
if(e.superweapons_finished <= 0)
e.superweapons_finished = 0;
else
}
#ifdef SVQC
+ // NOTE: reusing .invincible_finished here as delay counter for the smoke effect
if(vehic.invincible_finished < time)
{
traceline(vehic.origin, vehic.origin - '0 0 256', MOVE_NORMAL, vehic);
});
float desirabledamage;
desirabledamage = enemydamage;
- if(time > actor.invincible_finished && time > actor.spawnshieldtime)
+ if(time > STAT(INVINCIBLE_FINISHED, actor) && time > actor.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
if(teamplay && actor.team)
desirabledamage = desirabledamage - teamdamage;
float desirabledamage;
desirabledamage = enemydamage;
- if(time > actor.invincible_finished && time > actor.spawnshieldtime)
+ if(time > STAT(INVINCIBLE_FINISHED, actor) && time > actor.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
if(teamplay && actor.team)
desirabledamage = desirabledamage - teamdamage;
{
#define ROCKETJUMP_DAMAGE() WEP_CVAR(devastator, damage) * 0.8 \
* ((STAT(STRENGTH_FINISHED, this) > time) ? autocvar_g_balance_powerup_strength_selfdamage : 1) \
- * ((this.invincible_finished > time) ? autocvar_g_balance_powerup_invincible_takedamage : 1)
+ * ((STAT(INVINCIBLE_FINISHED, this) > time) ? autocvar_g_balance_powerup_invincible_takedamage : 1)
// save some CPU cycles by checking trigger_hurt after checking
// that something can be done to evade it (cheaper checks)
{
if (time < STAT(STRENGTH_FINISHED, this) - 1) t += 0.5;
if (time < STAT(STRENGTH_FINISHED, it) - 1) t -= 0.5;
- if (time < this.invincible_finished - 1) t += 0.2;
- if (time < it.invincible_finished - 1) t -= 0.4;
+ if (time < STAT(INVINCIBLE_FINISHED, this) - 1) t += 0.2;
+ if (time < STAT(INVINCIBLE_FINISHED, it) - 1) t -= 0.4;
}
t += max(0, 8 - skill) * 0.05; // less skilled bots attack more mindlessly
ratingscale *= t;
this.personal.pauserotfuel_finished = this.pauserotfuel_finished;
this.personal.pauseregen_finished = this.pauseregen_finished;
STAT(STRENGTH_FINISHED, this.personal) = STAT(STRENGTH_FINISHED, this);
- this.personal.invincible_finished = this.invincible_finished;
+ STAT(INVINCIBLE_FINISHED, this.personal) = STAT(INVINCIBLE_FINISHED, this);
this.personal.teleport_time = time;
break; // this part itself doesn't cheat, so let's not count this
case CHIMPULSE_CLONE_MOVING.impulse:
this.pauserotfuel_finished = time + this.personal.pauserotfuel_finished - this.personal.teleport_time;
this.pauseregen_finished = time + this.personal.pauseregen_finished - this.personal.teleport_time;
STAT(STRENGTH_FINISHED, this) = time + STAT(STRENGTH_FINISHED, this.personal) - this.personal.teleport_time;
- this.invincible_finished = time + this.personal.invincible_finished - this.personal.teleport_time;
+ STAT(INVINCIBLE_FINISHED, this) = time + STAT(INVINCIBLE_FINISHED, this.personal) - this.personal.teleport_time;
if(!autocvar_g_allow_checkpoints)
DID_CHEAT();
this.pain_frame = 0;
this.pain_finished = 0;
STAT(STRENGTH_FINISHED, this) = 0;
- this.invincible_finished = 0;
+ STAT(INVINCIBLE_FINISHED, this) = 0;
this.superweapons_finished = 0;
this.air_finished = 0;
//this.dphitcontentsmask = 0;
this.punchvector = '0 0 0';
STAT(STRENGTH_FINISHED, this) = 0;
- this.invincible_finished = 0;
+ STAT(INVINCIBLE_FINISHED, this) = 0;
this.fire_endtime = -1;
STAT(REVIVE_PROGRESS, this) = 0;
this.revival_time = 0;
}
if (this.items & ITEM_Shield.m_itemid)
{
- play_countdown(this, this.invincible_finished, SND_POWEROFF);
+ play_countdown(this, STAT(INVINCIBLE_FINISHED, this), SND_POWEROFF);
this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > this.invincible_finished)
+ if (time > STAT(INVINCIBLE_FINISHED, this))
{
this.items = this.items - (this.items & ITEM_Shield.m_itemid);
//Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
}
else
{
- if (time < this.invincible_finished)
+ if (time < STAT(INVINCIBLE_FINISHED, this))
{
this.items = this.items | ITEM_Shield.m_itemid;
if(!g_cts)
STAT(LAST_PICKUP, this) = STAT(LAST_PICKUP, spectatee);
STAT(HIT_TIME, this) = STAT(HIT_TIME, spectatee);
STAT(STRENGTH_FINISHED, this) = STAT(STRENGTH_FINISHED, spectatee);
- this.invincible_finished = spectatee.invincible_finished;
+ STAT(INVINCIBLE_FINISHED, this) = STAT(INVINCIBLE_FINISHED, spectatee);
this.superweapons_finished = spectatee.superweapons_finished;
this.air_finished = spectatee.air_finished;
STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
if (!(this.spawnflags & 8))
{
STAT(STRENGTH_FINISHED, actor) = 0;
- actor.invincible_finished = 0;
+ STAT(INVINCIBLE_FINISHED, actor) = 0;
if(STAT(BUFFS, actor)) // TODO: make a dropbuffs function to handle this
{
int buffid = buff_FirstFromFlags(STAT(BUFFS, actor)).m_id;
}
if(time < STAT(STRENGTH_FINISHED, player))
s = strcat(s, "S");
- if(time < player.invincible_finished)
+ if(time < STAT(INVINCIBLE_FINISHED, player))
s = strcat(s, "I");
if(PHYS_INPUT_BUTTON_CHAT(player))
s = strcat(s, "T");