level_data
Keeps details on how to generate, maintain and access a zlevel.
Vars | |
_has_warned_uninitialized_strata | This is set to prevent spamming the log when a turf has tried to grab our strata before we've been initialized |
---|---|
_level_setup_completed | Whether the level data was setup already. |
ambient_light_color | Colour of ambient light for turfs on this level. |
ambient_light_level | Ambient lighting light intensity turfs on this level should have. Value from 0 to 1. |
base_area | The default area type for the whole level. It will be applied to all turfs in the level on creation, unless loaded by map. |
base_turf | The default base turf type for the whole level. It will be the base turf type for the z level, unless loaded by map. filler_turf overrides what turfs the level will be created with. |
border_filler | The turf to fill the border area beyond the bounds of the level with. If null, nothing will be placed in the border area. (This is also placed when a border cannot be looped if loop_unconnected_borders is TRUE) |
cached_connections | A cached list of connected directions to their connected level id. Filled up at runtime. |
connected_levels | A associative list of all level_ids to a direction bitflag. Indicates what direction of the map connects to what level |
daycycle_id | If not null, this level will register with a daycycle id/type on New(). |
daycycle_type | Type provided to the above. |
exterior_atmos_temp | Temperature of standard exterior atmosphere. |
exterior_atmosphere | Gas mixture datum returned to exterior return_air. Set to assoc list of material to moles to initialize the gas datum. |
fall_depth | Multiplier applied to damage when falling through this level. |
filler_turf | When the level is created dynamically, all turfs on the map will be changed to this one type. If null, will use the base_turf instead. |
forbid_strata | Strata types to forbid from generating on this level. |
level_flags | Various flags indicating what this level functions as. |
level_generators | A list of /datum/random_map types to apply to this level if we're running level generation. May run before or after parent level gen |
level_id | A unique string identifier for this particular z-level. Used to fetch a level without knowing its z-level. |
level_inner_height | Filled by map gen on init. Indicates the height of the accessible area within the transition edges. |
level_inner_max_x | Filled by map gen on init. Indicates where the accessible level area starts past the transition edge. |
level_inner_max_y | Filled by map gen on init. Indicates where the accessible level area starts past the transition edge. |
level_inner_min_x | Filled by map gen on init. Indicates where the accessible level area starts past the transition edge. |
level_inner_min_y | Filled by map gen on init. Indicates where the accessible level area starts past the transition edge. |
level_inner_width | Filled by map gen on init. Indicates the width of the accessible area within the transition edges. |
level_max_height | The desired height of the level, including the TRANSITIONEDGE. If world.maxy is bigger, the exceeding area will be filled with turfs of "border_filler" type if defined, or base_turf otherwise. |
level_max_width | The desired width of the level, including the TRANSITIONEDGE. If world.maxx is bigger, the exceeding area will be filled with turfs of "border_filler" type if defined, or base_turf otherwise. |
level_z | The z-level that was assigned to this level_data |
loop_turf_type | If set we will put a looping edge on every unconnected edge of the map. If null, will not loop unconnected edges. If an unconnected edge is facing a connected edge, it will be instead filled with "border_filler" instead, if defined. |
name | Name displayed to the player to refer to this level in user interfaces and etc. If null, one will be generated. |
origin_is_world_center | Determines if edge turfs should be centered on the map dimensions. |
strata | The mineral strata assigned to this level if any. Set to a path at definition, then to a decl/strata instance at runtime. |
strata_base_material | The base material randomly chosen from the strata for this level. |
template_edge_padding | Extra spacing needed between any random level templates and the transition edge of a level. Note that this is more or less unnecessary if you are using a mapped area that doesn't stretch to the edge of the level. |
transition_turf_type | The turf type to use for zlevel lateral connections |
use_global_exterior_ambience | Set to false to override with our own. |
z_volume_level_x | Used to apply x offsets to distance checking in this volume. |
z_volume_level_y | Used to apply y offsets to distance checking in this volume. |
z_volume_level_z | Used to apply z offsets to distance checking in this volume. |
Procs | |
adapt_location_name | Changes anything named we may need to rename accordingly to the parent location name. For instance, exoplanets levels. |
after_generate_level | Called during level setup. Run anything that should happen only after the map is fully generated. |
after_template_load | Called after a map_template has been loaded on our z-level. Only apply to templates loaded onto new z-levels. |
apply_map_generators | Apply the parent entity's map generators. (Planets generally) This proc is to give a chance to level_data subtypes to individually chose to ignore the parent generators. |
before_template_generation | Called before a runtime generated template is generated on our z-level. Only applies to templates generated onto new z-levels. Is never called by templates which are loaded from file! |
build_border | Builds the map's transition edge if applicable |
build_border_corners | Handle preparing the level's border's corners after we've stup the edges. |
build_border_edge | Apply the specified edge type to the specified edge's turfs |
compute_level_edges_states | Loop through the edges of the level and determine if they're connected, looping, filled, or untouched. |
copy_from | Handle copying data from a previous level_data we're replacing. |
generate_level | Called when setting up the level. Apply generators and anything that modifies the turfs of the level. |
get_all_connected_level_data | Returns recursively a list of level_data for each connected levels. |
get_all_connected_level_ids | Returns recursively a list of level_ids for each connected levels. |
get_all_connected_level_z | Returns recursively a list of z-level indices for each connected levels. Parameter is to keep trakc |
get_base_area_instance | Returns the instance of the base area for this level |
get_subtemplate_blacklist | Helper proc for subtemplate generation. Returns a bitflag of template flags that must not be present for a subtemplate to be considered available. |
get_subtemplate_budget | Helper proc for subtemplate generation. Returns a point budget to spend on subtemplates. |
get_subtemplate_category | Helper proc for subtemplate generation. Returns a string identifier for a general category of template. |
get_subtemplate_whitelist | Helper proc for subtemplate generation. Returns a bitflag of template flags that must be present for a subtemplate to be considered available. |
initialize_level_id | Generates a level_id if none were specified in the datum definition. |
initialize_new_level | Initialize the turfs on the z-level. |
load_subtemplate | Actually handles loading a template template at the given turf. |
replace_with | Handle a new level_data datum overwriting us. |
setup_ambient | Setup ambient lighting for the level |
setup_exterior_atmosphere | Setup/generate atmosphere for exterior turfs on the level. |
setup_level_bounds | Calculate the bounds of the level, the border area, and the inner accessible area. Basically, by default levels are assumed to be loaded relative to the world center, so if they're smaller than the world they get their origin offset so they're in the middle of the world. By default templates are always loaded at origin 1,1. so that's useful to know and have control over! |
setup_level_data | Prepare level for being used. Setup borders, lateral z connections, ambient lighting, atmosphere, etc.. |
setup_strata | Pick a strata for the given level if applicable. |
spawn_subtemplates | Try to allocate the given amount of POIs onto our level. Returns the template types that were spawned |
try_place_subtemplate | Attempts several times to find turfs where a subtemplate can be placed. |
warn_bad_strata | Warns exactly once about a turf trying to initialize it's strata from us when we haven't completed setup. |
Var Details
_has_warned_uninitialized_strata
This is set to prevent spamming the log when a turf has tried to grab our strata before we've been initialized
_level_setup_completed
Whether the level data was setup already.
ambient_light_color
Colour of ambient light for turfs on this level.
ambient_light_level
Ambient lighting light intensity turfs on this level should have. Value from 0 to 1.
base_area
The default area type for the whole level. It will be applied to all turfs in the level on creation, unless loaded by map.
base_turf
The default base turf type for the whole level. It will be the base turf type for the z level, unless loaded by map. filler_turf overrides what turfs the level will be created with.
border_filler
The turf to fill the border area beyond the bounds of the level with. If null, nothing will be placed in the border area. (This is also placed when a border cannot be looped if loop_unconnected_borders is TRUE)
cached_connections
A cached list of connected directions to their connected level id. Filled up at runtime.
connected_levels
A associative list of all level_ids to a direction bitflag. Indicates what direction of the map connects to what level
daycycle_id
If not null, this level will register with a daycycle id/type on New().
daycycle_type
Type provided to the above.
exterior_atmos_temp
Temperature of standard exterior atmosphere.
exterior_atmosphere
Gas mixture datum returned to exterior return_air. Set to assoc list of material to moles to initialize the gas datum.
fall_depth
Multiplier applied to damage when falling through this level.
filler_turf
When the level is created dynamically, all turfs on the map will be changed to this one type. If null, will use the base_turf instead.
forbid_strata
Strata types to forbid from generating on this level.
level_flags
Various flags indicating what this level functions as.
level_generators
A list of /datum/random_map types to apply to this level if we're running level generation. May run before or after parent level gen
level_id
A unique string identifier for this particular z-level. Used to fetch a level without knowing its z-level.
level_inner_height
Filled by map gen on init. Indicates the height of the accessible area within the transition edges.
level_inner_max_x
Filled by map gen on init. Indicates where the accessible level area starts past the transition edge.
level_inner_max_y
Filled by map gen on init. Indicates where the accessible level area starts past the transition edge.
level_inner_min_x
Filled by map gen on init. Indicates where the accessible level area starts past the transition edge.
level_inner_min_y
Filled by map gen on init. Indicates where the accessible level area starts past the transition edge.
level_inner_width
Filled by map gen on init. Indicates the width of the accessible area within the transition edges.
level_max_height
The desired height of the level, including the TRANSITIONEDGE. If world.maxy is bigger, the exceeding area will be filled with turfs of "border_filler" type if defined, or base_turf otherwise.
level_max_width
The desired width of the level, including the TRANSITIONEDGE. If world.maxx is bigger, the exceeding area will be filled with turfs of "border_filler" type if defined, or base_turf otherwise.
level_z
The z-level that was assigned to this level_data
loop_turf_type
If set we will put a looping edge on every unconnected edge of the map. If null, will not loop unconnected edges. If an unconnected edge is facing a connected edge, it will be instead filled with "border_filler" instead, if defined.
name
Name displayed to the player to refer to this level in user interfaces and etc. If null, one will be generated.
origin_is_world_center
Determines if edge turfs should be centered on the map dimensions.
strata
The mineral strata assigned to this level if any. Set to a path at definition, then to a decl/strata instance at runtime.
strata_base_material
The base material randomly chosen from the strata for this level.
template_edge_padding
Extra spacing needed between any random level templates and the transition edge of a level. Note that this is more or less unnecessary if you are using a mapped area that doesn't stretch to the edge of the level.
transition_turf_type
The turf type to use for zlevel lateral connections
use_global_exterior_ambience
Set to false to override with our own.
z_volume_level_x
Used to apply x offsets to distance checking in this volume.
z_volume_level_y
Used to apply y offsets to distance checking in this volume.
z_volume_level_z
Used to apply z offsets to distance checking in this volume.
Proc Details
adapt_location_name
Changes anything named we may need to rename accordingly to the parent location name. For instance, exoplanets levels.
after_generate_level
Called during level setup. Run anything that should happen only after the map is fully generated.
after_template_load
Called after a map_template has been loaded on our z-level. Only apply to templates loaded onto new z-levels.
apply_map_generators
Apply the parent entity's map generators. (Planets generally) This proc is to give a chance to level_data subtypes to individually chose to ignore the parent generators.
before_template_generation
Called before a runtime generated template is generated on our z-level. Only applies to templates generated onto new z-levels. Is never called by templates which are loaded from file!
build_border
Builds the map's transition edge if applicable
build_border_corners
Handle preparing the level's border's corners after we've stup the edges.
build_border_edge
Apply the specified edge type to the specified edge's turfs
compute_level_edges_states
Loop through the edges of the level and determine if they're connected, looping, filled, or untouched.
copy_from
Handle copying data from a previous level_data we're replacing.
generate_level
Called when setting up the level. Apply generators and anything that modifies the turfs of the level.
get_all_connected_level_data
Returns recursively a list of level_data for each connected levels.
get_all_connected_level_ids
Returns recursively a list of level_ids for each connected levels.
get_all_connected_level_z
Returns recursively a list of z-level indices for each connected levels. Parameter is to keep trakc
get_base_area_instance
Returns the instance of the base area for this level
get_subtemplate_blacklist
Helper proc for subtemplate generation. Returns a bitflag of template flags that must not be present for a subtemplate to be considered available.
get_subtemplate_budget
Helper proc for subtemplate generation. Returns a point budget to spend on subtemplates.
get_subtemplate_category
Helper proc for subtemplate generation. Returns a string identifier for a general category of template.
get_subtemplate_whitelist
Helper proc for subtemplate generation. Returns a bitflag of template flags that must be present for a subtemplate to be considered available.
initialize_level_id
Generates a level_id if none were specified in the datum definition.
initialize_new_level
Initialize the turfs on the z-level.
load_subtemplate
Actually handles loading a template template at the given turf.
replace_with
Handle a new level_data datum overwriting us.
setup_ambient
Setup ambient lighting for the level
setup_exterior_atmosphere
Setup/generate atmosphere for exterior turfs on the level.
setup_level_bounds
Calculate the bounds of the level, the border area, and the inner accessible area. Basically, by default levels are assumed to be loaded relative to the world center, so if they're smaller than the world they get their origin offset so they're in the middle of the world. By default templates are always loaded at origin 1,1. so that's useful to know and have control over!
setup_level_data
Prepare level for being used. Setup borders, lateral z connections, ambient lighting, atmosphere, etc..
setup_strata
Pick a strata for the given level if applicable.
spawn_subtemplates
Try to allocate the given amount of POIs onto our level. Returns the template types that were spawned
try_place_subtemplate
Attempts several times to find turfs where a subtemplate can be placed.
warn_bad_strata
Warns exactly once about a turf trying to initialize it's strata from us when we haven't completed setup.