Only change relative path for base system, else log a warning

This commit is contained in:
xen-42 2024-08-05 15:35:37 -04:00
parent 78b658f568
commit a6037db562

View File

@ -694,16 +694,28 @@ namespace NewHorizons
if (SystemDict.ContainsKey(starSystemName)) if (SystemDict.ContainsKey(starSystemName))
{ {
// Both changing the Mod and RelativePath are weird and will likely cause incompat issues if two mods both affected the same system
// It's mostly just to fix up the config compared to the default one NH makes for the base StarSystem
if (SystemDict[starSystemName].Config.GlobalMusic == null && SystemDict[starSystemName].Config.Skybox == null) if (SystemDict[starSystemName].Config.GlobalMusic == null && SystemDict[starSystemName].Config.Skybox == null)
{
SystemDict[starSystemName].Mod = mod; SystemDict[starSystemName].Mod = mod;
if (SystemDict[starSystemName].Config.extras == null) }
SystemDict[starSystemName].RelativePath = relativePath;
SystemDict[starSystemName].Config.Merge(starSystemConfig);
// If a mod contains a change to the default system, set the relative path. // If a mod contains a change to the default system, set the relative path.
// Warning: If multiple systems make changes to the default system, only the relativePath will be set to the last mod loaded. // Warning: If multiple systems make changes to the default system, only the relativePath will be set to the last mod loaded.
if (string.IsNullOrEmpty(SystemDict[starSystemName].RelativePath))
{
SystemDict[starSystemName].RelativePath = relativePath; SystemDict[starSystemName].RelativePath = relativePath;
} }
else else
{
NHLogger.LogWarning($"Two (or more) mods are making system changes to {starSystemName} which may result in errors");
}
SystemDict[starSystemName].Config.Merge(starSystemConfig);
}
else
{ {
SystemDict[starSystemName] = new NewHorizonsSystem(starSystemName, starSystemConfig, relativePath, mod); SystemDict[starSystemName] = new NewHorizonsSystem(starSystemName, starSystemConfig, relativePath, mod);
} }