Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forcefully reset RA CommNet when upgrading TS #2382

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading