diff --git a/RasterPropMonitor/Core/RasterPropMonitorComputer.cs b/RasterPropMonitor/Core/RasterPropMonitorComputer.cs index 231f3537..1468e55e 100644 --- a/RasterPropMonitor/Core/RasterPropMonitorComputer.cs +++ b/RasterPropMonitor/Core/RasterPropMonitorComputer.cs @@ -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(); + if (modulePrefab != null) + { + overrideColors = modulePrefab.overrideColors; + } + } } public override void OnSave(ConfigNode node)