From 028c14aea1e7486ced018da13f176d81cd171add Mon Sep 17 00:00:00 2001 From: Molti Date: Wed, 10 Apr 2024 21:55:20 -0500 Subject: [PATCH] stuff --- _maps/map_files/generic/MaintStation.dmm | 2 +- code/__DEFINES/{yogs_defines}/mapping.dm | 1 + code/datums/mapgen/DungeonGenerator.dm | 3 +++ .../mapgen/dungeon_generators/dungeon_room.dm | 5 +++-- .../maintenance_generator.dm | 6 +++++- .../maintenance_generator/maintenance_room.dm | 19 +++++++++++-------- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/_maps/map_files/generic/MaintStation.dmm b/_maps/map_files/generic/MaintStation.dmm index 85305c6c524e..97663ccf1fe1 100644 --- a/_maps/map_files/generic/MaintStation.dmm +++ b/_maps/map_files/generic/MaintStation.dmm @@ -3,7 +3,7 @@ /turf/open/genturf, /area/procedurally_generated/maintenance/the_backrooms) "l" = ( -/turf/closed/wall/r_wall, +/turf/closed/indestructible/riveted, /area/space) (1,1,1) = {" diff --git a/code/__DEFINES/{yogs_defines}/mapping.dm b/code/__DEFINES/{yogs_defines}/mapping.dm index 7e997ad3d6af..4c53a669c6dc 100644 --- a/code/__DEFINES/{yogs_defines}/mapping.dm +++ b/code/__DEFINES/{yogs_defines}/mapping.dm @@ -25,6 +25,7 @@ #define ROOM_RATING_DEATH (1<<3) //For categorizing rooms +///Random is the default, so it doesn't need to be included in the weighted list to spawn #define ROOM_TYPE_RANDOM "random" #define ROOM_TYPE_SPACE "space" #define ROOM_TYPE_RUIN "ruin" diff --git a/code/datums/mapgen/DungeonGenerator.dm b/code/datums/mapgen/DungeonGenerator.dm index 4f9f82a9fbe0..71067cbf705a 100644 --- a/code/datums/mapgen/DungeonGenerator.dm +++ b/code/datums/mapgen/DungeonGenerator.dm @@ -68,6 +68,9 @@ var/room_datum_path = /datum/dungeon_room var/room_theme_path = /datum/dungeon_room_theme + ///A list of the probability that a type of room theme can be selected. look at mapping.dm in yog defines + var/list/probability_room_types = list() + ///Weighted list of the types that spawns if the turf is open var/weighted_open_turf_types = list(/turf/open/floor/plating = 10) ///Expanded list of the types that spawns if the turf is open diff --git a/code/datums/mapgen/dungeon_generators/dungeon_room.dm b/code/datums/mapgen/dungeon_generators/dungeon_room.dm index e80c000a1942..56ebedc204de 100644 --- a/code/datums/mapgen/dungeon_generators/dungeon_room.dm +++ b/code/datums/mapgen/dungeon_generators/dungeon_room.dm @@ -223,7 +223,7 @@ return for(var/turf/room_turf in interior) //we want to remove everything in the loc but don't want to change the loc type in this way - room_turf.empty(null, ignore_typecache = protected_atoms) + room_turf.empty(pickweight(weighted_open_turf_types), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR) room_turf.place_on_top(pick(room_theme.get_random_flooring()), flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR) return @@ -254,7 +254,8 @@ if(istype(other_side_of_door, /turf/open/space)) num_of_doors_to_gen-- continue - door_spot.empty(pick(room_theme.get_random_flooring()), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR) + door_spot.empty(pickweight(weighted_open_turf_types), ignore_typecache = protected_atoms, flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR) + door_spot.place_on_top(pick(room_theme.get_random_flooring()), flags = CHANGETURF_DEFER_CHANGE | CHANGETURF_IGNORE_AIR) var/door_path = room_theme.get_random_door() if(ispath(door_path)) var/obj/machinery/door/new_door = new door_path(door_spot) diff --git a/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_generator.dm b/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_generator.dm index 0e7e132b3639..1d15b6b944f0 100644 --- a/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_generator.dm +++ b/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_generator.dm @@ -11,6 +11,8 @@ weighted_closed_turf_types = list(/turf/closed/wall = 5, /turf/closed/wall/rust = 2 ) room_datum_path = /datum/dungeon_room/maintenance room_theme_path = /datum/dungeon_room_theme/maintenance + + probability_room_types = list(ROOM_TYPE_RUIN = 75, ROOM_TYPE_SPACE = 20) ///Boolean, whether or not firelocks are added to the maintenance var/atmos_control = ATMOS_CONTROL_FIREDOORS @@ -299,8 +301,10 @@ /turf/open/floor/plating/rust = 1, ) + probability_room_types = list(ROOM_TYPE_RUIN = 75) + //removes firelocks and apcs as the area is large enough that it annihilates the server if it has a bunch of firelocks - atmos_control = ATMOS_CONTROL_FANS + atmos_control = null include_apcs = FALSE /turf/open/floor/plating/backrooms diff --git a/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_room.dm b/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_room.dm index e03d4635720e..4621be42875e 100644 --- a/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_room.dm +++ b/code/datums/mapgen/dungeon_generators/maintenance_generator/maintenance_room.dm @@ -4,19 +4,22 @@ /datum/dungeon_room/maintenance/generate_room_theme() if(!room_type) - if(completed_room && is_ruin_compatible() && prob(75)) - //because ruins are a special type we overwrite the previous flags so the only possible theme is the ruin type - room_type = ROOM_TYPE_RUIN - - else if(completed_room && prob(20)) - room_type = ROOM_TYPE_SPACE - else + var/list/room_types = generator_ref.probability_room_types + + //if the room is a completed room, decide what special room type it should roll + if(completed_room) + for(var/type_check in room_types) //go through all types that the generator allows + if(type_check == ROOM_TYPE_RUIN && !is_ruin_compatible()) //the ruin type is special and needs to have a specific shape of room to work + continue + if(prob(room_types[type_check])) //get the probability of that ruin type from the list + room_type = type_check + + if(!room_type) //if a room type wasn't picked, default to random room_type = ROOM_TYPE_RANDOM if(!room_danger_level) if(completed_room && prob(50)) room_danger_level = ROOM_RATING_HOSTILE - else room_danger_level = ROOM_RATING_SAFE