Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 7cad57f

Browse files
Config setting for Backrooms to determine roundstart spawn or not (#22997)
* config, stat panel message, and rename * no fire flag and stat entry lied if the subsystem hadn't initialized yet
1 parent 3712a7b commit 7cad57f

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

code/controllers/configuration/entries/general.dm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,3 +555,8 @@
555555
/datum/config_entry/flag/demos_enabled
556556

557557
/datum/config_entry/flag/toast_notification_on_init
558+
559+
/// Whether the backrooms will spawn at roundstart or not. This is a very intensive process that can tack an extra 30+ seconds to roundstart
560+
/// 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.
561+
/datum/config_entry/flag/backrooms_enabled
562+
default = FALSE

code/controllers/subsystem/backrooms.dm

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
SUBSYSTEM_DEF(backrooms)
2-
name = "Procedural Generation"
2+
name = "Backrooms Procedural Generation"
33
init_order = INIT_ORDER_BACKROOMS
4-
flags = SS_NO_FIRE
4+
flags = SS_TICKER | SS_BACKGROUND | SS_NO_FIRE
5+
6+
var/noNeed = FALSE
57

68
var/datum/map_generator/dungeon_generator/backrooms_generator
79
var/datum/generator_theme/picked_theme = /datum/generator_theme
@@ -16,16 +18,19 @@ SUBSYSTEM_DEF(backrooms)
1618
/obj/item/toy/plush/lizard/azeel = 5000
1719
)
1820

19-
/datum/controller/subsystem/backrooms/Initialize(timeofday)
20-
var/noNeed = FALSE
21+
/datum/controller/subsystem/backrooms/PreInit()
2122
#ifdef LOWMEMORYMODE
2223
noNeed = TRUE
2324
#endif
2425
#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.
2526
noNeed = TRUE
2627
#endif
2728

28-
if(noNeed) //we do it this way so things can pass linter while in low memory mode or unit tests
29+
/datum/controller/subsystem/backrooms/Initialize(timeofday)
30+
if(!CONFIG_GET(flag/backrooms_enabled))
31+
noNeed = TRUE
32+
33+
if(noNeed)
2934
return SS_INIT_NO_NEED
3035

3136
pick_theme()
@@ -34,6 +39,15 @@ SUBSYSTEM_DEF(backrooms)
3439
spawn_loot()
3540
return SS_INIT_SUCCESS
3641

42+
/datum/controller/subsystem/backrooms/stat_entry(msg)
43+
if(noNeed || !CONFIG_GET(flag/backrooms_enabled))
44+
msg = "DISABLED"
45+
else if(!noNeed && !initialized)
46+
msg = "Generating..."
47+
else
48+
msg = "Theme: [picked_theme]"
49+
return ..()
50+
3751
/datum/controller/subsystem/backrooms/proc/pick_theme()
3852
var/list/themes = typesof(/datum/generator_theme)
3953
for(var/datum/generator_theme/possible as anything in themes) //assign the weight

config/config.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,3 +463,6 @@ MAX_SHUTTLE_SIZE 300
463463
## Comment to disable sending a toast notification on the host server when initializations complete.
464464
## Even if this is enabled, a notification will only be sent if there are no clients connected.
465465
TOAST_NOTIFICATION_ON_INIT
466+
467+
## Enable/Disable Backrooms z-level generation at startup
468+
BACKROOMS_ENABLED

0 commit comments

Comments
 (0)