Description
As @KANAjetzt suggested on Discord, if we add another singleton before ModLoader
, we can use it to hold all the data that we might want to share between ModLoader core and all its associated methods.
This fixes an issue where you can't refer to the local variables in mod_loader.gd during its _init
phase, because it's not ready yet.
This will help us to address these issues, which are currently (mostly) blocked by this problem:
- Add option to disable certain mods via JSON #109
- Logging: Track logged messages #140
- Logging: Add arg for
only_once
#141 - Store certain local variables in a dictionary (detailed notes) #146
- feat: ✨ ML Options: Add the groundwork for loading custom options #145 (implement the remaining options)
- Splitting up long files (utils/core) #153
It may also provide us with more optimisation options, eg for _get_verbosity
(mod_loader_utils.gd) we can store the command line arg overrides once and refer back to them later, rather than checking them every time a log is performed.
Additionally, we can refactor out code to be simpler with less repetition, eg. currently in the 2 places that get_local_folder_dir("configs")
is used, it's immediately followed by a check to see if there's a CLI override; we could simply store the path to use once, then refer to that single point of data instead.