Skip to content

Commit

Permalink
Halves Our Init Times By Disabling Unnecessary Zs (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
RimiNosha authored May 27, 2024
1 parent ae7c17e commit df6cb2f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/overmap.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Comment this out to enable planets and space Z generation.
// Disabled by default cause we don't have the player count on live, and it adds a notable amount to init times.
#define DISABLE_OVERMAP_ZS

//Bitflags for overmap_flags
#define OV_SHOWS_ON_SENSORS (1<<0)
#define OV_CAN_BE_TARGETED (1<<1)
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,11 @@ Used by the AI doomsday and the self-destruct nuke.
qdel(query_round_map_name)

#ifndef LOWMEMORYMODE
#ifndef DISABLE_OVERMAP_ZS
while (space_levels_so_far < config.space_ruin_levels)
++space_levels_so_far
add_new_zlevel("Ruins Area [space_levels_so_far]", ZTRAITS_SPACE, overmap_obj = new /datum/overmap_object/ruins(SSovermap.main_system, rand(1,SSovermap.main_system.maxx), rand(1,SSovermap.main_system.maxy)))
#endif
//Load planets
if(config.minetype == "lavaland")
var/datum/planet_template/lavaland_template = planet_templates[/datum/planet_template/lavaland]
Expand Down
5 changes: 5 additions & 0 deletions code/modules/overmap/planets/planet_templates.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
var/ore_node_seeder_type = /datum/ore_node_seeder

/datum/planet_template/proc/LoadTemplate(datum/overmap_sun_system/system, coordinate_x, coordinate_y)
#ifndef DISABLE_OVERMAP_ZS
var/old_z = world.maxz
var/datum/overmap_object/linked_overmap_object = new overmap_type(system, coordinate_x, coordinate_y)
var/picked_rock_color = CHECK_AND_PICK_OR_NULL(rock_color)
Expand Down Expand Up @@ -73,6 +74,7 @@
WARNING("No area type passed on planet generation")
if(!generator_type)
WARNING("No generator type passed on planet generation")

var/datum/space_level/new_level = SSmapping.add_new_zlevel(name, default_traits_input, overmap_obj = linked_overmap_object)
if(picked_rock_color)
new_level.rock_color = picked_rock_color
Expand Down Expand Up @@ -113,6 +115,9 @@

//Pass them to the ruin seeder
SeedRuins(z_levels)
#else
return
#endif

//Due to the particular way ruins are seeded right now this will be handled through a proc, rather than data-driven as of now
/datum/planet_template/proc/SeedRuins(list/z_levels)
Expand Down

0 comments on commit df6cb2f

Please sign in to comment.