From: Mario Date: Sat, 15 Jul 2017 20:30:11 +0000 (+1000) Subject: Port motd_actived_time to ClientState X-Git-Tag: xonotic-v0.8.5~2616 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e63e056a32b0684207e9abe642de09ad878f6a1;p=xonotic%2Fxonotic-data.pk3dir.git Port motd_actived_time to ClientState --- 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));