Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes maploader landmark. #3617

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to past-me in #3330 this isn't feasible because this should never run during Initialize() in SSatoms? it should only run at compiletime or in SSmapping, i could be wrong about that though, i can always just revert/issue a fix if it breaks downstream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really get what past-you means since the only time this would run the actual load logic in Initialize() is if someone spawns it, which is already strongly discouraged. Could mark the type as unspawnable to really formalize that though.

. = ..()
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