Skip to content

Commit

Permalink
Merge pull request #3617 from MistakeNot4892/loaderfix
Browse files Browse the repository at this point in the history
Fixes maploader landmark.
  • Loading branch information
out-of-phaze authored Jan 26, 2024
2 parents bb56fc0 + 7777c39 commit 44be7ec
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
13 changes: 7 additions & 6 deletions code/__defines/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ if(other_init) { \
#define ADJUST_TAG_VAR(variable, map_hash) (istext(variable) && (variable += map_hash))

/// Map template categories for mass retrieval.
#define MAP_TEMPLATE_CATEGORY_EXOPLANET "exoplanet_template"
#define MAP_TEMPLATE_CATEGORY_EXOPLANET_SITE "exoplanet_site_template"
#define MAP_TEMPLATE_CATEGORY_PLANET "planet_template"
#define MAP_TEMPLATE_CATEGORY_PLANET_SITE "planet_site_template"
#define MAP_TEMPLATE_CATEGORY_SPACE "space_template"
#define MAP_TEMPLATE_CATEGORY_AWAYSITE "awaysite_template"
#define MAP_TEMPLATE_CATEGORY_EXOPLANET "exoplanet_template"
#define MAP_TEMPLATE_CATEGORY_EXOPLANET_SITE "exoplanet_site_template"
#define MAP_TEMPLATE_CATEGORY_PLANET "planet_template"
#define MAP_TEMPLATE_CATEGORY_PLANET_SITE "planet_site_template"
#define MAP_TEMPLATE_CATEGORY_SPACE "space_template"
#define MAP_TEMPLATE_CATEGORY_AWAYSITE "awaysite_template"
#define MAP_TEMPLATE_CATEGORY_LANDMARK_LOADED "landmark_template"
5 changes: 5 additions & 0 deletions code/controllers/subsystems/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ SUBSYSTEM_DEF(mapping)
for(var/datum/map_template/MT as anything in get_all_template_instances())
register_map_template(MT)

// Load any queued map template markers.
for(var/obj/abstract/landmark/map_load_mark/queued_mark in queued_markers)
queued_mark.load_subtemplate()
queued_markers.Cut()

// Populate overmap.
if(length(global.using_map.overmap_ids))
for(var/overmap_id in global.using_map.overmap_ids)
Expand Down
11 changes: 8 additions & 3 deletions code/modules/maps/helper_landmarks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
var/centered = TRUE
var/list/map_template_names //list of template names to pick from

/obj/abstract/landmark/map_load_mark/New(loc)
..()
INITIALIZE_IMMEDIATE(/obj/abstract/landmark/map_load_mark)
/obj/abstract/landmark/map_load_mark/Initialize()
. = ..()
if(Master.map_loading) // If we're created while a map is being loaded
return // Let after_load() handle us
if(!SSmapping.initialized) // If we're being created prior to SSmapping
Expand All @@ -14,11 +15,15 @@
// How did we get here?
// These should only be loaded from compiled maps or map templates.
PRINT_STACK_TRACE("map_load_mark created outside of maploading")
load_subtemplate()
init_load_subtemplate()

/obj/abstract/landmark/map_load_mark/proc/get_subtemplate()
. = LAZYLEN(map_template_names) && pick(map_template_names)

/obj/abstract/landmark/map_load_mark/proc/init_load_subtemplate()
set waitfor = FALSE
load_subtemplate()

/obj/abstract/landmark/map_load_mark/proc/load_subtemplate()
// Commenting this out temporarily as DMMS breaks when asychronously
// loading overlapping map templates. TODO: more robust queuing behavior
Expand Down
1 change: 1 addition & 0 deletions code/unit_tests/~unit_test_subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ SUBSYSTEM_DEF(unit_tests)
MAP_TEMPLATE_CATEGORY_AWAYSITE,
MAP_TEMPLATE_CATEGORY_PLANET,
MAP_TEMPLATE_CATEGORY_EXOPLANET,
MAP_TEMPLATE_CATEGORY_LANDMARK_LOADED
)

/datum/controller/subsystem/unit_tests/Initialize(timeofday)
Expand Down
2 changes: 1 addition & 1 deletion test/check-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exactly 0 "incorrect indentations" '^( {4,})' -P
exactly 24 "text2path uses" 'text2path'
exactly 4 "update_icon() override" '/update_icon\((.*)\)' -P
exactly 0 "goto uses" 'goto '
exactly 6 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\('
exactly 5 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\('
exactly 1 "decl/New uses" '^/decl.*/New\('
exactly 0 "tag uses" '\stag = ' -P '**/*.dmm'
exactly 3 "unmarked globally scoped variables" -P '^(/|)var/(?!global)'
Expand Down

0 comments on commit 44be7ec

Please sign in to comment.