Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/controllers/configuration/entries/general.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 19 additions & 5 deletions code/controllers/subsystem/backrooms.dm
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,16 +18,19 @@ 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
#ifdef UNIT_TESTS // This whole subsystem just introduces a lot of odd confounding variables into unit test situations, so let's just not bother with doing an initialize here.
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()
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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