#include "../common/triggers/func/conveyor.qh"
#include "../common/triggers/teleporters.qh"
+#include "../common/triggers/target/spawnpoint.qh"
#include "../common/vehicles/all.qh"
#include "../lib/warpzone/server.qh"
+#include <common/mutators/mutator/overkill/oknex.qh>
+
STATIC_METHOD(Client, Add, void(Client this, int _team))
{
ClientConnect(this);
if (this.alivetime)
{
if (!warmup_stage)
- PS_GR_P_ADDVAL(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
+ PlayerStats_GameReport_Event_Player(this, PLAYERSTATS_ALIVETIME, time - this.alivetime);
this.alivetime = 0;
}
this.weapons = '0 0 0';
this.drawonlytoclient = this;
+ this.viewloc = NULL;
+
+ //this.spawnpoint_targ = NULL; // keep it so they can return to where they were?
+
this.weaponmodel = "";
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
accuracy_resend(this);
if (this.team < 0)
- JoinBestTeam(this, false, true);
+ JoinBestTeam(this, true);
entity spot = SelectSpawnPoint(this, false);
if (!spot) {
this.health = start_health;
this.armorvalue = start_armorvalue;
this.weapons = start_weapons;
+ if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
+ {
+ GiveRandomWeapons(this, random_start_weapons_count,
+ autocvar_g_random_start_weapons, random_start_ammo);
+ }
}
SetSpectatee_status(this, 0);
this.pauserothealth_finished = time + autocvar_g_balance_pause_health_rot_spawn;
this.pauserotfuel_finished = time + autocvar_g_balance_pause_fuel_rot_spawn;
this.pauseregen_finished = time + autocvar_g_balance_pause_health_regen_spawn;
- // extend the pause of rotting if client was reset at the beginning of the countdown
- if (!autocvar_sv_ready_restart_after_countdown && time < game_starttime) { // TODO why is this cvar NOTted?
+ if (!sv_ready_restart_after_countdown && time < game_starttime)
+ {
float f = game_starttime - time;
this.spawnshieldtime += f;
this.pauserotarmor_finished += f;
this.pauserothealth_finished += f;
this.pauseregen_finished += f;
}
+
this.damageforcescale = 2;
this.death_time = 0;
this.respawn_flags = 0;
this.fire_endtime = -1;
this.revive_progress = 0;
this.revival_time = 0;
+
this.air_finished = time + 12;
+ this.waterlevel = WATERLEVEL_NONE;
+ this.watertype = CONTENT_EMPTY;
entity spawnevent = new_pure(spawnevent);
spawnevent.owner = this;
this.viewloc = NULL;
+ for(int slot = 0; slot < MAX_AXH; ++slot)
+ {
+ entity axh = this.(AuxiliaryXhair[slot]);
+ this.(AuxiliaryXhair[slot]) = NULL;
+
+ if(axh.owner == this && axh != NULL && !wasfreed(axh))
+ delete(axh);
+ }
+
+ this.spawnpoint_targ = NULL;
+
this.crouch = false;
this.view_ofs = STAT(PL_VIEW_OFS, this);
setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
setorigin(this, spot.origin + '0 0 1' * (1 - this.mins.z - 24));
// don't reset back to last position, even if new position is stuck in solid
this.oldorigin = this.origin;
- this.lastteleporttime = time; // prevent insane speeds due to changing origin
if(this.conveyor)
IL_REMOVE(g_conveyed, this);
this.conveyor = NULL; // prevent conveyors at the previous location from moving a freshly spawned player
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
+ // player was spectator
if (CS(this).killcount == FRAGS_SPECTATOR) {
PlayerScore_Clear(this);
CS(this).killcount = 0;
+ CS(this).startplaytime = time;
}
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
.float clientkill_nexttime;
void ClientKill_Now_TeamChange(entity this)
{
- if(CS(this).killindicator_teamchange == -1)
+ if(this.killindicator_teamchange == -1)
{
- JoinBestTeam( this, false, true );
+ JoinBestTeam( this, true );
}
- else if(CS(this).killindicator_teamchange == -2)
+ else if(this.killindicator_teamchange == -2)
{
if(blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
PutObserverInServer(this);
}
else
- SV_ChangeTeam(this, CS(this).killindicator_teamchange - 1);
- CS(this).killindicator_teamchange = 0;
+ SV_ChangeTeam(this, this.killindicator_teamchange - 1);
+ this.killindicator_teamchange = 0;
}
void ClientKill_Now(entity this)
if(this.vehicle)
{
vehicles_exit(this.vehicle, VHEF_RELEASE);
- if(!CS(this).killindicator_teamchange)
+ if(!this.killindicator_teamchange)
{
this.vehicle_health = -1;
Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
this.killindicator = NULL;
- if(CS(this).killindicator_teamchange)
+ if(this.killindicator_teamchange)
ClientKill_Now_TeamChange(this);
if (!IS_SPEC(this) && !IS_OBSERVER(this) && MUTATOR_CALLHOOK(ClientKill_Now, this) == false)
return;
killtime = M_ARGV(1, float);
- CS(this).killindicator_teamchange = targetteam;
+ this.killindicator_teamchange = targetteam;
if(!this.killindicator)
{
}
if (!teamplay && this.team_forced > 0) this.team_forced = 0;
- {
- int id = this.playerid;
- this.playerid = 0; // silent
- JoinBestTeam(this, false, false); // if the team number is valid, keep it
- this.playerid = id;
- }
+ int playerid_save = this.playerid;
+ this.playerid = 0; // silent
+ JoinBestTeam(this, false); // if the team number is valid, keep it
+ this.playerid = playerid_save;
if (autocvar_sv_spectate || autocvar_g_campaign || this.team_forced < 0) {
TRANSMUTE(Observer, this);
CS(this).just_joined = true; // stop spamming the eventlog with additional lines when the client connects
- CS(this).netname_previous = strzone(this.netname);
-
if(teamplay && IS_PLAYER(this))
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_JOIN_CONNECT_TEAM), this.netname);
else
this.ammo_nails = spectatee.ammo_nails;
this.ammo_rockets = spectatee.ammo_rockets;
this.ammo_fuel = spectatee.ammo_fuel;
- this.clip_load = spectatee.clip_load;
- this.clip_size = spectatee.clip_size;
this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
this.health = spectatee.health;
CS(this).impulse = 0;
this.superweapons_finished = spectatee.superweapons_finished;
STAT(PRESSED_KEYS, this) = STAT(PRESSED_KEYS, spectatee);
this.weapons = spectatee.weapons;
- this.vortex_charge = spectatee.vortex_charge;
- this.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
- this.hagar_load = spectatee.hagar_load;
- this.arc_heat_percent = spectatee.arc_heat_percent;
- this.minelayer_mines = spectatee.minelayer_mines;
this.punchangle = spectatee.punchangle;
this.view_ofs = spectatee.view_ofs;
this.velocity = spectatee.velocity;
setsize(this, spectatee.mins, spectatee.maxs);
SetZoomState(this, CS(spectatee).zoomstate);
- for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
- {
- .entity weaponentity = weaponentities[slot];
- this.(weaponentity) = spectatee.(weaponentity);
- }
-
- for(int slot = 0; slot < MAX_AXH; ++slot)
- {
- this.(AuxiliaryXhair[slot]) = spectatee.(AuxiliaryXhair[slot]);
- }
-
anticheat_spectatecopy(this, spectatee);
this.hud = spectatee.hud;
if(spectatee.vehicle)
if(!this.team_selected)
if(autocvar_g_campaign || autocvar_g_balance_teams)
- JoinBestTeam(this, false, true);
+ JoinBestTeam(this, true);
if(autocvar_g_campaign)
campaign_bots_may_start = true;
{
.entity weaponentity = weaponentities[slot];
W_WeaponFrame(this, weaponentity);
-
- if(slot == 0)
- {
- this.clip_load = this.(weaponentity).clip_load;
- this.clip_size = this.(weaponentity).clip_size;
- }
}
this.items_added = 0;
// WORKAROUND: only use dropclient in server frames (frametime set).
// Never use it in cl_movement frames (frametime zero).
checkSpectatorBlock(this);
- }
+ }
zoomstate_set = false;
// Check for nameless players
- if (isInvisibleString(this.netname)) {
- this.netname = strzone(sprintf("Player#%d", this.playerid));
- // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
- }
- if (this.netname != CS(this).netname_previous) {
- if (autocvar_sv_eventlog) {
+ if (this.netname == "" || this.netname != CS(this).netname_previous)
+ {
+ bool assume_unchanged = (CS(this).netname_previous == "");
+ if (isInvisibleString(this.netname))
+ {
+ this.netname = strzone(sprintf("Player#%d", this.playerid));
+ assume_unchanged = false;
+ // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+ }
+ if (!assume_unchanged && autocvar_sv_eventlog)
GameLogEcho(strcat(":name:", ftos(this.playerid), ":", playername(this, false)));
- }
if (CS(this).netname_previous) strunzone(CS(this).netname_previous);
CS(this).netname_previous = strzone(this.netname);
}
void DrownPlayer(entity this)
{
- if(IS_DEAD(this))
+ if(IS_DEAD(this) || game_stopped || time < game_starttime)
return;
if (this.waterlevel != WATERLEVEL_SUBMERGED || this.vehicle)