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

Commit f797606

Browse files
committed
TGS Test Merge (#21835)
2 parents 9204a7b + 11d8651 commit f797606

File tree

26 files changed

+23037
-22866
lines changed

26 files changed

+23037
-22866
lines changed

_maps/map_files/debug/MaintStation.dmm

Lines changed: 0 additions & 22832 deletions
This file was deleted.

_maps/map_files/generic/MaintStation.dmm

Lines changed: 22805 additions & 0 deletions
Large diffs are not rendered by default.

code/__DEFINES/admin.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#define ADMIN_PUNISHMENT_SMSPIDER "SM Spider"
8888
#define ADMIN_PUNISHMENT_FLASHBANG "Flashbang"
8989
#define ADMIN_PUNISHMENT_WIBBLY "Wibblify"
90+
#define ADMIN_PUNISHMENT_BACKROOMS "Backrooms"
9091

9192
#define AHELP_ACTIVE 1
9293
#define AHELP_CLOSED 2

code/__DEFINES/maps.dm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ Always compile, always use that verb, and always make sure that it works for wha
150150
ZTRAIT_GRAVITY = TRUE, \
151151
ZTRAIT_NOPHASE = TRUE, \
152152
ZTRAIT_NOXRAY = TRUE, \
153-
ZTRAIT_BASETURF = /turf/open/floor/plating)
153+
ZTRAIT_BOMBCAP_MULTIPLIER = 0.5, \
154+
ZTRAIT_BASETURF = /turf/open/floor/plating/backrooms)
154155

155156
///Z level traits for Away Missions
156157
#define ZTRAITS_AWAY list(ZTRAIT_AWAY = TRUE)

code/__DEFINES/subsystems.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
#define INIT_ORDER_ECHELON -10
172172
#define INIT_ORDER_LIGHTING -20
173173
#define INIT_ORDER_SHUTTLE -21
174+
#define INIT_ORDER_BACKROOMS -30 // relies on basically everything to be initialized first
174175
#define INIT_ORDER_MINOR_MAPPING -40
175176
#define INIT_ORDER_BLUESPACE_LOCKER -45
176177
#define INIT_ORDER_DISCORD -60

code/__DEFINES/{yogs_defines}/mapping.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#define ROOM_RATING_DEATH (1<<3)
2626

2727
//For categorizing rooms
28+
///Random is the default, so it doesn't need to be included in the weighted list to spawn
2829
#define ROOM_TYPE_RANDOM "random"
2930
#define ROOM_TYPE_SPACE "space"
3031
#define ROOM_TYPE_RUIN "ruin"

code/__HELPERS/level_traits.dm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ GLOBAL_VAR(station_level_z_scratch)
3030
#define is_secret_level(z) SSmapping.level_trait(z, ZTRAIT_SECRET)
3131

3232
#define is_reebe(z) SSmapping.level_trait(z, ZTRAIT_REEBE)
33+
34+
#define is_backrooms(z) SSmapping.level_trait(z, ZTRAIT_PROCEDURAL_MAINTS)
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
SUBSYSTEM_DEF(backrooms)
2+
name = "Procedural Generation"
3+
init_order = INIT_ORDER_BACKROOMS
4+
flags = SS_NO_FIRE
5+
6+
var/datum/map_generator/dungeon_generator/backrooms_generator
7+
8+
/datum/controller/subsystem/backrooms/Initialize(timeofday)
9+
#ifdef LOWMEMORYMODE
10+
return SS_INIT_NO_NEED
11+
#endif
12+
#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.
13+
return SS_INIT_NO_NEED
14+
#endif
15+
16+
generate_backrooms()
17+
return SS_INIT_SUCCESS
18+
19+
20+
/datum/controller/subsystem/backrooms/proc/generate_backrooms()
21+
var/list/errorList = list()
22+
SSmapping.LoadGroup(errorList, "Backrooms", "map_files/generic", "MaintStation.dmm", default_traits = ZTRAITS_BACKROOM_MAINTS, silent = TRUE)
23+
if(errorList.len) // failed to load
24+
message_admins("Backrooms failed to load!")
25+
log_game("Backrooms failed to load!")
26+
27+
for(var/area/A as anything in GLOB.areas)
28+
if(istype(A, /area/procedurally_generated/maintenance/the_backrooms))
29+
A.RunGeneration()
30+
backrooms_generator = A.map_generator
31+
break
32+
33+
if(backrooms_generator && istype(backrooms_generator))
34+
var/min_x = backrooms_generator.min_x
35+
var/max_x = backrooms_generator.max_x
36+
var/min_y = backrooms_generator.min_y
37+
var/max_y = backrooms_generator.max_y
38+
var/z_level = backrooms_generator.z_level
39+
40+
for(var/turf/current_turf in block(locate(min_x,min_y,z_level),locate(max_x,max_y,z_level)))
41+
if(current_turf.x == min_x || current_turf.x == max_x || current_turf.y == min_y || current_turf.y == max_y)
42+
current_turf.empty(null, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
43+
current_turf.place_on_top(/turf/closed/indestructible/backrooms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
44+
45+
addtimer(CALLBACK(src, PROC_REF(generate_exit)), 1 MINUTES)
46+
47+
/datum/controller/subsystem/backrooms/proc/generate_exit()
48+
var/list/backrooms_level = SSmapping.levels_by_trait(ZTRAIT_PROCEDURAL_MAINTS)
49+
if(LAZYLEN(backrooms_level))
50+
var/turf/way_out = find_safe_turf(zlevels = backrooms_level, dense_atoms = FALSE)
51+
new /obj/effect/portal/permanent/one_way/backrooms(way_out)
52+
53+
/obj/effect/portal/permanent/one_way/backrooms/get_link_target_turf()
54+
var/list/valid_lockers = typecacheof(typesof(/obj/structure/closet) - typesof(/obj/structure/closet/body_bag)\
55+
- typesof(/obj/structure/closet/secure_closet) - typesof(/obj/structure/closet/cabinet)\
56+
- typesof(/obj/structure/closet/cardboard) \
57+
- typesof(/obj/structure/closet/supplypod) - typesof(/obj/structure/closet/stasis)\
58+
- typesof(/obj/structure/closet/abductor) - typesof(/obj/structure/closet/bluespace), only_root_path = TRUE) //stolen from bluespace lockers
59+
60+
var/list/lockers_list = list()
61+
for(var/obj/structure/closet/L in GLOB.lockers)
62+
if(!is_station_level(L.z))
63+
continue
64+
if(!is_type_in_typecache(L, valid_lockers))
65+
continue
66+
if(L.opened)
67+
continue
68+
lockers_list += L
69+
var/obj/structure/closet/exit = pick(lockers_list)
70+
if(!exit)
71+
exit = new(get_safe_random_station_turf())
72+
return get_turf(exit)
73+
74+
/obj/effect/portal/permanent/one_way/backrooms/teleport(atom/movable/M, force)
75+
. = ..()
76+
if(.)
77+
var/obj/structure/closet/end = locate() in get_turf(M)
78+
if(end)
79+
M.forceMove(end) //get in the locker, nerd
80+
81+
/obj/effect/portal/permanent/backrooms
82+
icon_state = "wooden_tv"
83+
84+
/obj/effect/spawner/backrooms_portal
85+
name = "backrooms two way portal spawner"
86+
87+
/obj/effect/spawner/backrooms_portal/Initialize(mapload)
88+
var/backrooms_level = SSmapping.levels_by_trait(ZTRAIT_PROCEDURAL_MAINTS)
89+
if(LAZYLEN(backrooms_level))
90+
var/turf/way_out = find_safe_turf(zlevels = backrooms_level, dense_atoms = FALSE)
91+
create_portal_pair(get_turf(src), way_out, _lifespan = -1, newtype = /obj/effect/portal/permanent/backrooms)
92+
qdel(src)

code/datums/mapgen/DungeonGenerator.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
var/room_datum_path = /datum/dungeon_room
6969
var/room_theme_path = /datum/dungeon_room_theme
7070

71+
///A list of the probability that a type of room theme can be selected. look at mapping.dm in yog defines
72+
var/list/probability_room_types = list()
73+
7174
///Weighted list of the types that spawns if the turf is open
7275
var/weighted_open_turf_types = list(/turf/open/floor/plating = 10)
7376
///Expanded list of the types that spawns if the turf is open

code/datums/mapgen/dungeon_generators/dungeon_room.dm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@
220220
return
221221
for(var/turf/room_turf in interior)
222222
//we want to remove everything in the loc but don't want to change the loc type in this way
223-
room_turf.empty(null, ignore_typecache = protected_atoms)
223+
room_turf.empty(pickweight(weighted_open_turf_types), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
224224
room_turf.place_on_top(pick(room_theme.get_random_flooring()), flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
225225

226226
return
@@ -251,7 +251,8 @@
251251
if(istype(other_side_of_door, /turf/open/space))
252252
num_of_doors_to_gen--
253253
continue
254-
door_spot.empty(pick(room_theme.get_random_flooring()), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
254+
door_spot.empty(pickweight(weighted_open_turf_types), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
255+
door_spot.place_on_top(pick(room_theme.get_random_flooring()), flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR)
255256
var/door_path = room_theme.get_random_door()
256257
if(ispath(door_path))
257258
var/obj/machinery/door/new_door = new door_path(door_spot)

0 commit comments

Comments
 (0)