-
Notifications
You must be signed in to change notification settings - Fork 220
/
mapped_planet_template.dm
49 lines (39 loc) · 2.34 KB
/
mapped_planet_template.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Base map template for planetoids, which need to instantiate a planetoid data object early during template spawn.
* Can be used to load a planetoid from a map file.
*/
/datum/map_template/planetoid
name = "planetoid"
abstract_type = /datum/map_template/planetoid
template_parent_type = /datum/map_template/planetoid
template_categories = list(MAP_TEMPLATE_CATEGORY_PLANET)
level_data_type = /datum/level_data/planetoid
modify_tag_vars = TRUE
///The type of planetoid data to instantiate for this planetoid. We'll use it as blueprint for the planet.
var/planetoid_data_type = /datum/planetoid_data
/datum/map_template/planetoid/is_runtime_generated()
return FALSE //We're loaded from a map file
///Returns a new instance of a datum used for containing runtime info on the planet generated by this template.
/datum/map_template/planetoid/proc/create_planetoid_instance()
var/datum/planetoid_data/PD = new planetoid_data_type
PD.setup_planetoid() //Run generation/setup
return PD
/datum/map_template/planetoid/load(turf/T, centered = FALSE)
//Main reason for this is, map bounds are up to level_data.
// The /datum/level_data of a level needed to tell how to connect to adjacent levels, define level atmos and map generators.
// And we cannot combine level_data instances or slap the entire stack of z-levels onto a single level.
CRASH("Cannot load a planet template over an existing level")
//The extra datum/planetoid_data/planet_data arg is only for admin spawming exoplanets, since some parameters are taken from the user
/datum/map_template/planetoid/load_new_z(no_changeturf = TRUE, centered = TRUE, var/datum/planetoid_data/planet_data) //centered == false should probably runtime, because it will never work properly
if(!planet_data)
planet_data = create_planetoid_instance()
//Load levels from map files
. = ..(no_changeturf, centered)
//Might as well force these to update if some were manually set
for(var/datum/exoplanet_theme/T in planet_data.themes)
T.after_map_generation(planet_data)
//Create or update the overmap marker for the planet
setup_planet_overmap(planet_data)
///Call after map is fully generated. Setup the overmap obj to match the planet we just generated.
/datum/map_template/planetoid/proc/setup_planet_overmap(var/datum/planetoid_data/planet_data)
planet_data.try_update_overmap_marker()