X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qc;h=e8482e6f52c2eaf4999920ffcf9e2ee0c716931f;hb=aa2399ae4512fa9a9c1b7272b6b0b295b16f00c9;hp=68c19f638a0bfbaa4f578b7f41fde53bab809ad2;hpb=3ecb4f377794080b3b216d6be9f131c227e76210;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 68c19f638..e8482e6f5 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -1037,17 +1037,22 @@ void SendWelcomemessage(entity this, bool force_centerprint) { msg_entity = this; WriteHeader(MSG_ONE, TE_CSQC_SERVERWELCOME); - WriteByte(MSG_ONE, boolean(autocvar_g_campaign)); + SendWelcomemessage_msg_type(this, force_centerprint, MSG_ONE); +} + +void SendWelcomemessage_msg_type(entity this, bool force_centerprint, int msg_type) +{ + WriteByte(msg_type, boolean(autocvar_g_campaign)); if (boolean(autocvar_g_campaign)) { - WriteString(MSG_ONE, Campaign_GetTitle()); - WriteByte(MSG_ONE, Campaign_GetLevelNum()); - WriteString(MSG_ONE, Campaign_GetMessage()); + WriteString(msg_type, Campaign_GetTitle()); + WriteByte(msg_type, Campaign_GetLevelNum()); + WriteString(msg_type, Campaign_GetMessage()); return; } - WriteByte(MSG_ONE, force_centerprint); - WriteString(MSG_ONE, autocvar_hostname); - WriteString(MSG_ONE, GetClientVersionMessage(this)); + WriteByte(msg_type, force_centerprint); + WriteString(msg_type, autocvar_hostname); + WriteString(msg_type, GetClientVersionMessage(this)); MUTATOR_CALLHOOK(BuildMutatorsPrettyString, ""); string modifications = M_ARGV(0, string); @@ -1069,7 +1074,7 @@ void SendWelcomemessage(entity this, bool force_centerprint) modifications = strcat(modifications, ", Jet pack"); modifications = substring(modifications, 2, strlen(modifications) - 2); - WriteString(MSG_ONE, modifications); + WriteString(msg_type, modifications); if(cache_lastmutatormsg != autocvar_g_mutatormsg) { @@ -1077,25 +1082,14 @@ void SendWelcomemessage(entity this, bool force_centerprint) strcpy(cache_mutatormsg, cache_lastmutatormsg); } - WriteString(MSG_ONE, cache_mutatormsg); + WriteString(msg_type, cache_mutatormsg); string mutator_msg = ""; MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg); mutator_msg = M_ARGV(0, string); - WriteString(MSG_ONE, mutator_msg); // trust that the mutator will do proper formatting - WriteString(MSG_ONE, strreplace("\\n", "\n", autocvar_sv_motd)); -} - -void SendWelcomemessage_onConnection_think(entity this) -{ - SendWelcomemessage(this, false); -} - -void SendWelcomemessage_onConnection(entity this) -{ - // give the client time to sent its version - defer(this, 0.5, SendWelcomemessage_onConnection_think); + WriteString(msg_type, mutator_msg); // trust that the mutator will do proper formatting + WriteString(msg_type, strreplace("\\n", "\n", autocvar_sv_motd)); } /** @@ -1185,11 +1179,7 @@ void ClientConnect(entity this) CS(this).model_randomizer = random(); if (IS_REAL_CLIENT(this)) - { - if (!autocvar_g_campaign) - SendWelcomemessage_onConnection(this); sv_notice_join(this); - } this.move_qcphysics = autocvar_sv_qcphysics; @@ -1204,6 +1194,9 @@ void ClientConnect(entity this) MUTATOR_CALLHOOK(ClientConnect, this); + if (player_count == 1) + localcmd("\nsv_hook_firstjoin\n"); + if (IS_REAL_CLIENT(this) && !IS_PLAYER(this) && !autocvar_g_campaign) CS(this).motd_actived_time = -1; // the welcome message is shown by the client } @@ -1272,6 +1265,9 @@ void ClientDisconnect(entity this) player_powerups_remove_all(this); // stop powerup sound ONREMOVE(this); + + if (player_count == 0) + localcmd("\nsv_hook_lastleave\n"); } void ChatBubbleThink(entity this) @@ -1977,6 +1973,9 @@ bool ShowTeamSelection(entity this) } void Join(entity this) { + if (autocvar_g_campaign && !campaign_bots_may_start && !game_stopped && time >= game_starttime) + ReadyRestart(true); + TRANSMUTE(Player, this); if(!this.team_selected) @@ -2561,7 +2560,6 @@ void PlayerPreThink (entity this) || (!(autocvar_sv_spectate || autocvar_g_campaign || (Player_GetForcedTeamIndex(this) == TEAM_FORCE_SPECTATOR)) && (!teamplay || autocvar_g_balance_teams))) { - campaign_bots_may_start = true; if(joinAllowed(this)) Join(this); return;