From cc109f787398a8a99be7ea95c2da38399f233f30 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 16 Jul 2017 02:10:57 +1000 Subject: [PATCH] Port killindicator_teamchange to ClientState --- qcsrc/server/client.qc | 14 +++++++------- qcsrc/server/client.qh | 1 + qcsrc/server/defs.qh | 1 - qcsrc/server/mutators/mutator/gamemode_ca.qc | 2 +- qcsrc/server/player.qc | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index db62a801f..2f1630321 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -855,19 +855,19 @@ Called when a client types 'kill' in the console .float clientkill_nexttime; void ClientKill_Now_TeamChange(entity this) { - if(this.killindicator_teamchange == -1) + if(CS(this).killindicator_teamchange == -1) { JoinBestTeam( this, false, true ); } - else if(this.killindicator_teamchange == -2) + else if(CS(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, this.killindicator_teamchange - 1); - this.killindicator_teamchange = 0; + SV_ChangeTeam(this, CS(this).killindicator_teamchange - 1); + CS(this).killindicator_teamchange = 0; } void ClientKill_Now(entity this) @@ -875,7 +875,7 @@ void ClientKill_Now(entity this) if(this.vehicle) { vehicles_exit(this.vehicle, VHEF_RELEASE); - if(!this.killindicator_teamchange) + if(!CS(this).killindicator_teamchange) { this.vehicle_health = -1; Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0'); @@ -887,7 +887,7 @@ void ClientKill_Now(entity this) this.killindicator = NULL; - if(this.killindicator_teamchange) + if(CS(this).killindicator_teamchange) ClientKill_Now_TeamChange(this); if(!IS_SPEC(this) && !IS_OBSERVER(this)) @@ -950,7 +950,7 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change, return; killtime = M_ARGV(1, float); - this.killindicator_teamchange = targetteam; + CS(this).killindicator_teamchange = targetteam; if(!this.killindicator) { diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index e85419cfe..15c49034c 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -35,6 +35,7 @@ CLASS(Client, Object) ATTRIB(Client, parm_idlesince, int, this.parm_idlesince); ATTRIB(Client, muted, bool, this.muted); + ATTRIB(Client, killindicator_teamchange, int, this.killindicator_teamchange); METHOD(Client, m_unwind, bool(Client this)); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 7a155fddd..6d1c7e317 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -226,7 +226,6 @@ int have_team_spawns_forteams; // if Xth bit is 1 then team X has spawns else it // set when showing a kill countdown .entity killindicator; -.float killindicator_teamchange; void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); diff --git a/qcsrc/server/mutators/mutator/gamemode_ca.qc b/qcsrc/server/mutators/mutator/gamemode_ca.qc index fc06e50e2..8ef0a859e 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ca.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ca.qc @@ -289,7 +289,7 @@ MUTATOR_HOOKFUNCTION(ca, MakePlayerObserver) if (!IS_DEAD(player)) ca_LastPlayerForTeam_Notify(player); - if (player.killindicator_teamchange == -2) // player wants to spectate + if (CS(player).killindicator_teamchange == -2) // player wants to spectate player.caplayer = 0; if (player.caplayer) player.frags = FRAGS_LMS_LOSER; diff --git a/qcsrc/server/player.qc b/qcsrc/server/player.qc index fcb29523c..2ee496065 100644 --- a/qcsrc/server/player.qc +++ b/qcsrc/server/player.qc @@ -536,7 +536,7 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, { delete(this.killindicator); this.killindicator = NULL; - if(this.killindicator_teamchange) + if(CS(this).killindicator_teamchange) defer_ClientKill_Now_TeamChange = true; if(this.classname == "body") -- 2.39.2