Skip to content

Commit

Permalink
Forcefully reset RA CommNet when upgrading TS
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Jun 17, 2024
1 parent 6e1a56f commit 6c71efa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Source/RP0/Utilities/KCTUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,24 @@ public static void SetFacilityLevel(SpaceCenterFacility scf, int level)
upgradable.configNode.SetValue("lvl", normLevel);

// Note that OnKSCFacilityUpgrading and OnKSCFacilityUpgraded events are not fired through this code path
// Still, we need to let RA know that it needs a reset to account for the finished upgrade.
if (scf == SpaceCenterFacility.TrackingStation)
{
ClobberRACommnet();
}
}
}

private static void ClobberRACommnet()
{
var mInf = CommNetScenario.Instance?.GetType().GetMethod("ApplyTSLevelChange", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy);
if (mInf != null)
{
mInf.Invoke(CommNetScenario.Instance, new object[0]);
}
else
{
RP0Debug.LogError($"Failed to call ApplyTSLevelChange() on RA CommNetScenario");
}
}
}
Expand Down

0 comments on commit 6c71efa

Please sign in to comment.