From 8f047b2bf56863e9c1255cb586c60c22f3f76de2 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 20 Jan 2022 03:52:23 +0100 Subject: [PATCH] [MIRROR] Fixes Modular Map Loading Runtimes [MDB IGNORE] (#10822) * Fixes Modular Map Loading Runtimes (#64212) ## About The Pull Request Moves the modmap root object's load_map() call to New(). This changes something about where it falls in init order that stops it from causing a flood of lighting runtimes. Don't ask my why, it just does. ## Why It's Good For The Game Fixes #64192 * Fixes Modular Map Loading Runtimes Co-authored-by: Thunder12345 --- code/modules/mapping/modular_map_loader/README.md | 2 ++ code/modules/mapping/modular_map_loader/modular_map_loader.dm | 2 ++ 2 files changed, 4 insertions(+) diff --git a/code/modules/mapping/modular_map_loader/README.md b/code/modules/mapping/modular_map_loader/README.md index dd77c65e9b4..7ce7509d040 100644 --- a/code/modules/mapping/modular_map_loader/README.md +++ b/code/modules/mapping/modular_map_loader/README.md @@ -14,6 +14,8 @@ This root object handled picking and loading in map modules. It has two variable * `var/key` - A string, used to pull a list of `.dmm` files from the configuration file. * `load_map()` - Called asynchronously in the root's `Initialize()`. This proc creates a new instance of `/datum/map_template/map_module`, ingests the configuration file `config_file` points to, and picks a `.dmm` file path which maps to the root's `key`, by picking a random filename from among those which `key` maps to, and appending it to a folder path. This file path is passed into the map templace instance's `load()`, and the template takes over. +INITIALIZE_IMMEDIATE is used to ensure the ruins are loaded at the right time to avoid runtime errors related to lighting. + ### /datum/map_template/map_module This map templace subtype is responsible for loading in the module, it has two variables and two relevant procs. diff --git a/code/modules/mapping/modular_map_loader/modular_map_loader.dm b/code/modules/mapping/modular_map_loader/modular_map_loader.dm index 29399be8aa0..d753c4a439e 100644 --- a/code/modules/mapping/modular_map_loader/modular_map_loader.dm +++ b/code/modules/mapping/modular_map_loader/modular_map_loader.dm @@ -11,6 +11,8 @@ /// Key used to look up the appropriate map paths in the associated .toml file var/key = null +INITIALIZE_IMMEDIATE(/obj/modular_map_root) + /obj/modular_map_root/Initialize(mapload) . = ..() INVOKE_ASYNC(src, .proc/load_map)