#include "client.qh"
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+#include <common/effects/all.qh>
#include "anticheat.qh"
#include "impulse.qh"
#include "player.qh"
#include "teamplay.qh"
#include "playerdemo.qh"
#include "spawnpoints.qh"
+#include "resources.qh"
#include "g_damage.qh"
#include "g_hook.qh"
#include "command/common.qh"
#include "../lib/warpzone/server.qh"
+#include <common/mutators/mutator/overkill/okvortex.qh>
+
STATIC_METHOD(Client, Add, void(Client this, int _team))
{
ClientConnect(this);
if (IS_SPEC(e)) e = e.enemy;
sf = 0;
- if (CS(e).race_completed) sf |= 1; // forced scoreboard
- if (CS(to).spectatee_status) sf |= 2; // spectator ent number follows
- if (CS(e).zoomstate) sf |= 4; // zoomed
- if (autocvar_sv_showspectators) sf |= 16; // show spectators
+ if (CS(e).race_completed) sf |= BIT(0); // forced scoreboard
+ if (CS(to).spectatee_status) sf |= BIT(1); // spectator ent number follows
+ if (CS(e).zoomstate) sf |= BIT(2); // zoomed
+ if (autocvar_sv_showspectators) sf |= BIT(4); // show spectators
WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA);
WriteByte(MSG_ENTITY, sf);
- if (sf & 2)
- {
+ if (sf & BIT(1))
WriteByte(MSG_ENTITY, CS(to).spectatee_status);
- }
- if(sf & 16)
+ if(sf & BIT(4))
{
float specs = CountSpectators(e, to);
WriteByte(MSG_ENTITY, specs);
PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
// always track bots, don't ask for cl_allow_uidtracking
- if (IS_BOT_CLIENT(this)) PlayerStats_GameReport_AddPlayer(this);
+ if (IS_BOT_CLIENT(this))
+ PlayerStats_GameReport_AddPlayer(this);
+ else
+ CS(this).allowed_timeouts = autocvar_sv_timeout_number;
if (autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
}
CS(this).jointime = time;
- CS(this).allowed_timeouts = autocvar_sv_timeout_number;
if (IS_REAL_CLIENT(this))
{
regen_health_stable = M_ARGV(9, float);
regen_health_rotstable = M_ARGV(10, float);
-
if(!mutator_returnvalue)
if(!STAT(FROZEN, this))
{
float mina, maxa, limith, limita;
maxa = autocvar_g_balance_armor_rotstable;
mina = autocvar_g_balance_armor_regenstable;
- limith = autocvar_g_balance_health_limit;
- limita = autocvar_g_balance_armor_limit;
+ limith = GetResourceLimit(this, RESOURCE_HEALTH);
+ limita = GetResourceLimit(this, RESOURCE_ARMOR);
regen_health_rotstable = regen_health_rotstable * max_mod;
regen_health_stable = regen_health_stable * max_mod;
maxf = autocvar_g_balance_fuel_rotstable;
minf = autocvar_g_balance_fuel_regenstable;
- limitf = autocvar_g_balance_fuel_limit;
+ limitf = GetResourceLimit(this, RESOURCE_FUEL);
this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
+ // Ugly hack to make sure the health and armor don't go beyond hard limit.
+ // TODO: Remove this hack when all code uses GivePlayerHealth and
+ // GivePlayerArmor.
+ if (this.health > RESOURCE_AMOUNT_HARD_LIMIT)
+ {
+ this.health = RESOURCE_AMOUNT_HARD_LIMIT;
+ }
+ if (this.armorvalue > RESOURCE_AMOUNT_HARD_LIMIT)
+ {
+ this.armorvalue = RESOURCE_AMOUNT_HARD_LIMIT;
+ }
+ // End hack.
}
bool zoomstate_set;
this.weapons = spectatee.weapons;
this.vortex_charge = spectatee.vortex_charge;
this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
+ this.okvortex_charge = spectatee.okvortex_charge;
+ this.okvortex_chargepool_ammo = spectatee.okvortex_chargepool_ammo;
this.hagar_load = spectatee.hagar_load;
this.arc_heat_percent = spectatee.arc_heat_percent;
this.minelayer_mines = spectatee.minelayer_mines;