]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/world.qc
Implement autopause for empty dedicated servers
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / world.qc
index c04b188fa4cd6addfb74e65809b6e2522d56c11f..defb079c7c1046176a24aac58ebd50b215cbe34d 100644 (file)
@@ -387,6 +387,7 @@ void cvar_changes_init()
                BADCVAR("leadlimit_override");
                BADCVAR("pausable");
                BADCVAR("sv_announcer");
+               BADCVAR("sv_autopause");
                BADCVAR("sv_checkforpacketsduringsleep");
                BADCVAR("sv_damagetext");
                BADCVAR("sv_db_saveasdump");
@@ -1043,6 +1044,10 @@ spawnfunc(worldspawn)
 
        WinningConditionHelper(this); // set worldstatus
 
+       if (autocvar_sv_autopause && server_is_dedicated && !wantrestart)
+               // INITPRIO_LAST is to soon: bots either didn't join yet or didn't leave yet, see: bot_fixcount()
+               defer(this, 5, Pause_TryPause_Dedicated);
+
        world_initialized = 1;
        __spawnfunc_spawn_all();
 }