Yogstation 13 - Modules - TypesVar Details - Proc Details

/datum/dungeon_room_theme

Dungeon room themes determine the style of the generated rooms. If you want to create a new dungeon generator for say, Icemeta, Then you would want to create a new subtype of room theme with maybe snow floor tiles, ice or snow walls and some fitting kind of door. Then from there further subtype into hostile, neutral, beneficial and whatever other types of rooms you want to appear in that area.

TLDR: This datum is basically a box of furniture that randomly generted rooms will pull from to build themselves with a cohesive style

Vars

feature_weightThe number of features spawned in a room is: (area inside the room * feature_weight as a percent) rounded up the higher this number, the more features spawned
mob_spawn_chanceThe upper limit of mobs spawned in a room is determined by a logarithmic function using the interior size of the room. This variable is the chance that a mob spawns in each iteration of the spawning loop. For example if a room has an interior size of 20 and has a limit of 5 mobs for the room, If the spawn chance is 50 then each of those 5 spawn attempts has a 50% chance to actually spawn a mob, otherwise it will decrease the number of spawnable mobs by 1 and try again.
room_flagsContains flags pertaining to the qualities of the room, such as ROOM_HAS_FLOORS if it, y'know, has floors
special_featureFor room themes that call for very specific features appearing. Currently just for handling ruins via their landmark object
weighted_feature_spawn_listWeighted list of features you want to spawn. Like unfinished machines, broken mechs, blood splatters. Keep in mind these will be placed randomly
weighted_mob_spawn_listWeighted list of features you want to spawn. Spiders in a room that has webbing, or possums in a room full of trash.
weighted_possible_door_typesWeighted list of doors for the room to choose from
weighted_possible_floor_typesWeighted list of floorings for the room to choose from
weighted_possible_wall_typesWeighted list of walls for the room to choose from
weighted_possible_window_typesIf you want the theme or rooms to include windows, specify the window type here, be it the basic window obj, or a spawner for a preset window
window_weightpercent chance of spawning a window instead of a wall

Procs

InitializeRoom flags are assigned based on which lists have any elements. These flags are checked by the room that owns the theme to determine which furnishing procs need to be called
NewInitialize the new room by sanity checking values and then assigning the bitflags that describe room behavior to the parent room
get_random_doorReturn a random door /obj from the list of door options, selected based on weight. Defaults to basic door if no door is found
get_random_featureReturn a random feature /obj the list of feature options, selected based on weight. Returns null if nothing is found
get_random_flooringReturn a random flooring /turf from the list of flooring options, selected based on weight. Defaults to basic plating if no flooring is found
get_random_mobReturn a random mob /atom the list of mob options, selected based on weight. Returns null if nothing is found The reason it returns an atom rather than a mob specifically is because there are some weird cases where mobs are objects, like specific silicons
get_random_wallReturn a random wall /turf from the list of wall options, selected based on weight. Defaults to basic wall if no wall is found
get_random_windowReturn a random window /obj from the list of window options, selected based on weight. Defaults to basic window spawner if no window is found
get_special_featureReturn the path for the special feature of the room. Returns null if nothing is found
post_generateIf you want to do anything fancy with the mobs or items in the room after you know they exist. Like renaming items, reassigning factions, calling specific procs from them. Whatever your little heart desires
pre_initializeAny sort of room specific logic you need to do before running the Initialize() that will assign room flags. For example if you want to generate a list using subtypes or typesof, which is something you can't do from the base definition and needs to be done in a proc.

Var Details

feature_weight

The number of features spawned in a room is: (area inside the room * feature_weight as a percent) rounded up the higher this number, the more features spawned

I.E. room with a 4x5 inner area has an area of 20, so with a feature weight of 75 results in 75% of 20, therefore 15 features will be spawned in random open spots

mob_spawn_chance

The upper limit of mobs spawned in a room is determined by a logarithmic function using the interior size of the room. This variable is the chance that a mob spawns in each iteration of the spawning loop. For example if a room has an interior size of 20 and has a limit of 5 mobs for the room, If the spawn chance is 50 then each of those 5 spawn attempts has a 50% chance to actually spawn a mob, otherwise it will decrease the number of spawnable mobs by 1 and try again.

room_flags

Contains flags pertaining to the qualities of the room, such as ROOM_HAS_FLOORS if it, y'know, has floors

special_feature

For room themes that call for very specific features appearing. Currently just for handling ruins via their landmark object

weighted_feature_spawn_list

Weighted list of features you want to spawn. Like unfinished machines, broken mechs, blood splatters. Keep in mind these will be placed randomly

weighted_mob_spawn_list

Weighted list of features you want to spawn. Spiders in a room that has webbing, or possums in a room full of trash.

weighted_possible_door_types

Weighted list of doors for the room to choose from

weighted_possible_floor_types

Weighted list of floorings for the room to choose from

weighted_possible_wall_types

Weighted list of walls for the room to choose from

weighted_possible_window_types

If you want the theme or rooms to include windows, specify the window type here, be it the basic window obj, or a spawner for a preset window

window_weight

percent chance of spawning a window instead of a wall

Proc Details

Initialize

Room flags are assigned based on which lists have any elements. These flags are checked by the room that owns the theme to determine which furnishing procs need to be called

New

Initialize the new room by sanity checking values and then assigning the bitflags that describe room behavior to the parent room

get_random_door

Return a random door /obj from the list of door options, selected based on weight. Defaults to basic door if no door is found

get_random_feature

Return a random feature /obj the list of feature options, selected based on weight. Returns null if nothing is found

get_random_flooring

Return a random flooring /turf from the list of flooring options, selected based on weight. Defaults to basic plating if no flooring is found

get_random_mob

Return a random mob /atom the list of mob options, selected based on weight. Returns null if nothing is found The reason it returns an atom rather than a mob specifically is because there are some weird cases where mobs are objects, like specific silicons

get_random_wall

Return a random wall /turf from the list of wall options, selected based on weight. Defaults to basic wall if no wall is found

get_random_window

Return a random window /obj from the list of window options, selected based on weight. Defaults to basic window spawner if no window is found

get_special_feature

Return the path for the special feature of the room. Returns null if nothing is found

post_generate

If you want to do anything fancy with the mobs or items in the room after you know they exist. Like renaming items, reassigning factions, calling specific procs from them. Whatever your little heart desires

pre_initialize

Any sort of room specific logic you need to do before running the Initialize() that will assign room flags. For example if you want to generate a list using subtypes or typesof, which is something you can't do from the base definition and needs to be done in a proc.