]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'terencehill/campaign_restart_level' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 097cafda03813137afac5c0c28f57fe0c6841c8d..7b0c7ba29e8d226ca42a1847490bb92bdbda0ab8 100644 (file)
@@ -1174,6 +1174,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
 }
@@ -1242,6 +1245,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)
@@ -1947,6 +1953,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)
@@ -2531,7 +2540,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;