From cbad5ad545e93cc396ef176a8cd7af89901d27f5 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 17 Sep 2023 23:01:23 +0200 Subject: [PATCH] [MIRROR] heretic sac room is now lazyloaded [MDB IGNORE] (#23743) * heretic sac room is now lazyloaded * Update lazy_templates.dm --------- Co-authored-by: jimmyl <70376633+mc-oofert@users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- .../heretic_sacrifice.dmm} | 0 code/__DEFINES/lazy_templates.dm | 2 ++ code/datums/lazy_template.dm | 4 ++++ .../gamemodes/dynamic/dynamic_rulesets_roundstart.dm | 1 + .../sacrifice_knowledge/sacrifice_knowledge.dm | 11 +++++------ .../knowledge/sacrifice_knowledge/sacrifice_map.dm | 8 -------- 6 files changed, 12 insertions(+), 14 deletions(-) rename _maps/templates/{heretic_sacrifice_template.dmm => lazy_templates/heretic_sacrifice.dmm} (100%) diff --git a/_maps/templates/heretic_sacrifice_template.dmm b/_maps/templates/lazy_templates/heretic_sacrifice.dmm similarity index 100% rename from _maps/templates/heretic_sacrifice_template.dmm rename to _maps/templates/lazy_templates/heretic_sacrifice.dmm diff --git a/code/__DEFINES/lazy_templates.dm b/code/__DEFINES/lazy_templates.dm index d075b1e681a..1e8fab8d92c 100644 --- a/code/__DEFINES/lazy_templates.dm +++ b/code/__DEFINES/lazy_templates.dm @@ -2,11 +2,13 @@ #define LAZY_TEMPLATE_KEY_WIZARDDEN "LT_WIZARDDEN" #define LAZY_TEMPLATE_KEY_NINJA_HOLDING_FACILITY "LT_NINJAHOLDING" #define LAZY_TEMPLATE_KEY_ABDUCTOR_SHIPS "LT_ABDUCTORSHIPS" +#define LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE "LT_HERETICSACRIFICE" #define LAZY_TEMPLATE_KEY_LIST_ALL(...) list( \ "Nukie Base" = LAZY_TEMPLATE_KEY_NUKIEBASE, \ "Wizard Den" = LAZY_TEMPLATE_KEY_WIZARDDEN, \ "Ninja Holding" = LAZY_TEMPLATE_KEY_NINJA_HOLDING_FACILITY, \ "Abductor Ships" = LAZY_TEMPLATE_KEY_ABDUCTOR_SHIPS, \ + "Heretic Sacrifice Level" = LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE, \ "Outpost of Cogs" = LAZY_TEMPLATE_KEY_OUTPOST_OF_COGS, \ ) // SKYRAT EDIT ABOVE - OUTPOST OF COGS diff --git a/code/datums/lazy_template.dm b/code/datums/lazy_template.dm index af6df50e96f..ad50a12e5d7 100644 --- a/code/datums/lazy_template.dm +++ b/code/datums/lazy_template.dm @@ -77,3 +77,7 @@ /datum/lazy_template/abductor_ship key = LAZY_TEMPLATE_KEY_ABDUCTOR_SHIPS map_name = "abductor_ships" + +/datum/lazy_template/heretic_sacrifice_room + key = LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE + map_name = "heretic_sacrifice" diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm index 975b5dc7e2b..df078c462d9 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm @@ -226,6 +226,7 @@ GLOBAL_VAR_INIT(revolutionary_win, FALSE) scaling_cost = 9 requirements = list(101,101,60,30,30,25,20,15,10,10) antag_cap = list("denominator" = 24) + ruleset_lazy_templates = list(LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE) /datum/dynamic_ruleset/roundstart/heretics/pre_execute(population) diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm index 375a1b78590..3e37c173923 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_knowledge.dm @@ -40,18 +40,17 @@ #ifndef UNIT_TESTS // This is a decently hefty thing to generate while unit testing, so we should skip it. if(!heretic_level_generated) heretic_level_generated = TRUE - log_game("Generating z-level for heretic sacrifices...") + log_game("Loading heretic lazytemplate for heretic sacrifices...") INVOKE_ASYNC(src, PROC_REF(generate_heretic_z_level)) #endif /// Generate the sacrifice z-level. /datum/heretic_knowledge/hunt_and_sacrifice/proc/generate_heretic_z_level() - var/datum/map_template/heretic_sacrifice_level/new_level = new() - if(!new_level.load_new_z()) - log_game("The heretic sacrifice z-level failed to load.") - message_admins("The heretic sacrifice z-level failed to load. Heretic sacrifices won't be teleported to the shadow realm. \ + if(!SSmapping.lazy_load_template(LAZY_TEMPLATE_KEY_HERETIC_SACRIFICE)) + log_game("The heretic sacrifice template failed to load.") + message_admins("The heretic sacrifice lazy template failed to load. Heretic sacrifices won't be teleported to the shadow realm. \ If you want, you can spawn an /obj/effect/landmark/heretic somewhere to stop that from happening.") - CRASH("Failed to initialize heretic sacrifice z-level!") + CRASH("Failed to lazy load heretic sacrifice template!") /datum/heretic_knowledge/hunt_and_sacrifice/recipe_snowflake_check(mob/living/user, list/atoms, list/selected_atoms, turf/loc) var/datum/antagonist/heretic/heretic_datum = IS_HERETIC(user) diff --git a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_map.dm b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_map.dm index a31f0a7cc97..942b053ae67 100644 --- a/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_map.dm +++ b/code/modules/antagonists/heretic/knowledge/sacrifice_knowledge/sacrifice_map.dm @@ -3,14 +3,6 @@ /// A global assoc list of all landmarks that denote a heretic sacrifice location. [string heretic path] = [landmark]. GLOBAL_LIST_EMPTY(heretic_sacrifice_landmarks) -/** - * A map template loaded in when heretics are created. - * Hereteic sacrifices are sent here when completed. - */ -/datum/map_template/heretic_sacrifice_level - name = "Heretic Sacrifice Level" - mappath = "_maps/templates/heretic_sacrifice_template.dmm" - /// Lardmarks meant to designate where heretic sacrifices are sent. /obj/effect/landmark/heretic name = "default heretic sacrifice landmark"