Skip to content

Commit

Permalink
Fix #144: RPM_COLOROVERRIDE was broken by previous optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyOThan committed Sep 13, 2024
1 parent b7d6502 commit 3cd8e5c
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions RasterPropMonitor/Core/RasterPropMonitorComputer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,21 +253,32 @@ public override void OnLoad(ConfigNode node)
{
m_persistentVariables.Load(node);

foreach (var overrideColorSetup in node.GetNodes("RPM_COLOROVERRIDE"))
if (HighLogic.LoadedScene == GameScenes.LOADING)
{
foreach (var colorConfig in overrideColorSetup.GetNodes("COLORDEFINITION"))
foreach (var overrideColorSetup in node.GetNodes("RPM_COLOROVERRIDE"))
{
string name = colorConfig.GetValue("name");
Color32 color = default(Color);

if (name != null && colorConfig.TryGetValue("color", ref color))
foreach (var colorConfig in overrideColorSetup.GetNodes("COLORDEFINITION"))
{
name = "COLOR_" + name.Trim();
string name = colorConfig.GetValue("name");
Color32 color = default(Color);

overrideColors[name] = color;
if (name != null && colorConfig.TryGetValue("color", ref color))
{
name = "COLOR_" + name.Trim();

overrideColors[name] = color;
}
}
}
}
else if (HighLogic.LoadedSceneIsFlight)
{
var modulePrefab = part.partInfo.partPrefab.FindModuleImplementing<RasterPropMonitorComputer>();
if (modulePrefab != null)
{
overrideColors = modulePrefab.overrideColors;
}
}
}

public override void OnSave(ConfigNode node)
Expand Down

0 comments on commit 3cd8e5c

Please sign in to comment.