diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 73c223c6623a..de746d12624d 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -555,3 +555,8 @@ /datum/config_entry/flag/demos_enabled /datum/config_entry/flag/toast_notification_on_init + +/// Whether the backrooms will spawn at roundstart or not. This is a very intensive process that can tack an extra 30+ seconds to roundstart +/// and creates an extra z-level full of mobs that will add extra load to the server. Only enable this if you're sure you want it. Or optimize it for me. +/datum/config_entry/flag/backrooms_enabled + default = FALSE diff --git a/code/controllers/subsystem/backrooms.dm b/code/controllers/subsystem/backrooms.dm index 77b33bc13519..3f567e6852fb 100644 --- a/code/controllers/subsystem/backrooms.dm +++ b/code/controllers/subsystem/backrooms.dm @@ -1,7 +1,9 @@ SUBSYSTEM_DEF(backrooms) - name = "Procedural Generation" + name = "Backrooms Procedural Generation" init_order = INIT_ORDER_BACKROOMS - flags = SS_NO_FIRE + flags = SS_TICKER | SS_BACKGROUND | SS_NO_FIRE + + var/noNeed = FALSE var/datum/map_generator/dungeon_generator/backrooms_generator var/datum/generator_theme/picked_theme = /datum/generator_theme @@ -16,8 +18,7 @@ SUBSYSTEM_DEF(backrooms) /obj/item/toy/plush/lizard/azeel = 5000 ) -/datum/controller/subsystem/backrooms/Initialize(timeofday) - var/noNeed = FALSE +/datum/controller/subsystem/backrooms/PreInit() #ifdef LOWMEMORYMODE noNeed = TRUE #endif @@ -25,7 +26,11 @@ SUBSYSTEM_DEF(backrooms) noNeed = TRUE #endif - if(noNeed) //we do it this way so things can pass linter while in low memory mode or unit tests +/datum/controller/subsystem/backrooms/Initialize(timeofday) + if(!CONFIG_GET(flag/backrooms_enabled)) + noNeed = TRUE + + if(noNeed) return SS_INIT_NO_NEED pick_theme() @@ -34,6 +39,15 @@ SUBSYSTEM_DEF(backrooms) spawn_loot() return SS_INIT_SUCCESS +/datum/controller/subsystem/backrooms/stat_entry(msg) + if(noNeed || !CONFIG_GET(flag/backrooms_enabled)) + msg = "DISABLED" + else if(!noNeed && !initialized) + msg = "Generating..." + else + msg = "Theme: [picked_theme]" + return ..() + /datum/controller/subsystem/backrooms/proc/pick_theme() var/list/themes = typesof(/datum/generator_theme) for(var/datum/generator_theme/possible as anything in themes) //assign the weight diff --git a/config/config.txt b/config/config.txt index a5490c4c3724..f1630dc346eb 100644 --- a/config/config.txt +++ b/config/config.txt @@ -463,3 +463,6 @@ MAX_SHUTTLE_SIZE 300 ## Comment to disable sending a toast notification on the host server when initializations complete. ## Even if this is enabled, a notification will only be sent if there are no clients connected. TOAST_NOTIFICATION_ON_INIT + +## Enable/Disable Backrooms z-level generation at startup +BACKROOMS_ENABLED