From bb037f9da7008b52e12268a9421357de674e3010 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 16 Jul 2017 06:40:53 +1000 Subject: [PATCH] Port spectatortime to ClientState --- qcsrc/server/client.qc | 6 +++--- qcsrc/server/client.qh | 1 + qcsrc/server/command/sv_cmd.qc | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index aa19f060e..128ef3dd6 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -291,7 +291,7 @@ void PutObserverInServer(entity this) accuracy_resend(this); - this.spectatortime = time; + CS(this).spectatortime = time; if(this.bot_attack) IL_REMOVE(g_bot_targets, this); this.bot_attack = false; @@ -1224,7 +1224,7 @@ void ClientConnect(entity this) bot_relinkplayerlist(); - this.spectatortime = time; + CS(this).spectatortime = time; if (blockSpectators) { Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); @@ -2042,7 +2042,7 @@ void checkSpectatorBlock(entity this) if(!this.caplayer) if(IS_REAL_CLIENT(this)) { - if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { + if( time > (CS(this).spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING); dropclient(this); } diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 510a6e271..03ff47757 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -82,6 +82,7 @@ CLASS(Client, Object) ATTRIB(Client, usekeypressed, bool, this.usekeypressed); ATTRIB(Client, motd_actived_time, float, this.motd_actived_time); ATTRIB(Client, jointime, float, this.jointime); + ATTRIB(Client, spectatortime, float, this.spectatortime); METHOD(Client, m_unwind, bool(Client this)); diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 145e75952..4d181c465 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1144,7 +1144,7 @@ void GameCommand_nospectators(float request) FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA( if(!it.caplayer) { - it.spectatortime = time; + CS(it).spectatortime = time; Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); } )); -- 2.39.2