From 4e63e056a32b0684207e9abe642de09ad878f6a1 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 16 Jul 2017 06:30:11 +1000 Subject: [PATCH] Port motd_actived_time to ClientState --- qcsrc/server/client.qc | 30 +++++++++++++++--------------- qcsrc/server/client.qh | 1 + 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index f34ca30fa..009d12995 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1268,7 +1268,7 @@ void ClientConnect(entity this) { if (!autocvar_g_campaign && !IS_PLAYER(this)) { - this.motd_actived_time = -1; + CS(this).motd_actived_time = -1; Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this)); } } @@ -2051,46 +2051,46 @@ void checkSpectatorBlock(entity this) void PrintWelcomeMessage(entity this) { - if(this.motd_actived_time == 0) + if(CS(this).motd_actived_time == 0) { if (autocvar_g_campaign) { if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) { - this.motd_actived_time = time; + CS(this).motd_actived_time = time; Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message); } } else { if (PHYS_INPUT_BUTTON_INFO(this)) { - this.motd_actived_time = time; + CS(this).motd_actived_time = time; Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this)); } } } - else if(this.motd_actived_time > 0) // showing MOTD or campaign message + else if(CS(this).motd_actived_time > 0) // showing MOTD or campaign message { if (autocvar_g_campaign) { if (PHYS_INPUT_BUTTON_INFO(this)) - this.motd_actived_time = time; - else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released - this.motd_actived_time = 0; + CS(this).motd_actived_time = time; + else if ((time - CS(this).motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released + CS(this).motd_actived_time = 0; Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD); } } else { if (PHYS_INPUT_BUTTON_INFO(this)) - this.motd_actived_time = time; - else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released - this.motd_actived_time = 0; + CS(this).motd_actived_time = time; + else if (time - CS(this).motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released + CS(this).motd_actived_time = 0; Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD); } } } - else //if(this.motd_actived_time < 0) // just connected, motd is active + else //if(CS(this).motd_actived_time < 0) // just connected, motd is active { if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD - this.motd_actived_time = -2; // wait until BUTTON_INFO gets released - else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this)) + CS(this).motd_actived_time = -2; // wait until BUTTON_INFO gets released + else if(CS(this).motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this)) { // instanctly hide MOTD - this.motd_actived_time = 0; + CS(this).motd_actived_time = 0; Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD); } } diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index a358816a3..0780a4a6e 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -80,6 +80,7 @@ CLASS(Client, Object) ATTRIB(Client, teamkill_soundtime, float, this.teamkill_soundtime); ATTRIB(Client, teamkill_soundsource, entity, this.teamkill_soundsource); ATTRIB(Client, usekeypressed, bool, this.usekeypressed); + ATTRIB(Client, motd_actived_time, float, this.motd_actived_time); METHOD(Client, m_unwind, bool(Client this)); -- 2.39.2