Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Moltijoe committed Apr 11, 2024
1 parent 6662dc5 commit 028c14a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion _maps/map_files/generic/MaintStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -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) = {"
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/{yogs_defines}/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions code/datums/mapgen/DungeonGenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions code/datums/mapgen/dungeon_generators/dungeon_room.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 028c14a

Please sign in to comment.