Skip to content

Commit

Permalink
DisableMapUpdateInFlight : fixed phantom map markers on flight scene …
Browse files Browse the repository at this point in the history
…load
  • Loading branch information
gotmachine committed Jul 14, 2022
1 parent 65fc06a commit 728204a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GameData/KSPCommunityFixes/KSPCommunityFixes.version
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"NAME": "KSPCommunityFixes",
"URL": "https://raw.githubusercontent.com/KSPModdingLibs/KSPCommunityFixes/master/GameData/KSPCommunityFixes/KSPCommunityFixes.version",
"DOWNLOAD": "https://github.com/KSPModdingLibs/KSPCommunityFixes/releases",
"VERSION": {"MAJOR": 1, "MINOR": 19, "PATCH": 0, "BUILD": 0},
"VERSION": {"MAJOR": 1, "MINOR": 19, "PATCH": 1, "BUILD": 0},
"KSP_VERSION": {"MAJOR": 1, "MINOR": 12, "PATCH": 3},
"KSP_VERSION_MIN": {"MAJOR": 1, "MINOR": 8, "PATCH": 0},
"KSP_VERSION_MAX": {"MAJOR": 1, "MINOR": 12, "PATCH": 3}
Expand Down
26 changes: 26 additions & 0 deletions KSPCommunityFixes/Performance/DisableMapUpdateInFlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,38 @@ class DisableMapUpdateInFlight : BasePatch

protected override void ApplyPatches(List<PatchInfo> patches)
{
patches.Add(new PatchInfo(
PatchMethodType.Postfix,
AccessTools.Method(typeof(OrbitRendererBase), nameof(OrbitRendererBase.Start)),
this));

patches.Add(new PatchInfo(
PatchMethodType.Prefix,
AccessTools.Method(typeof(OrbitRendererBase), nameof(OrbitRendererBase.LateUpdate)),
this));
}

static void OrbitRendererBase_Start_Postfix(OrbitRendererBase __instance)
{
if (HighLogic.LoadedScene == GameScenes.FLIGHT && !MapView.fetch.updateMap)
{
if (__instance.objectNode.IsNotNullRef())
__instance.objectNode.gameObject.SetActive(false);

if (__instance.ascNode.IsNotNullRef())
__instance.ascNode.gameObject.SetActive(false);

if (__instance.descNode.IsNotNullRef())
__instance.descNode.gameObject.SetActive(false);

if (__instance.apNode.IsNotNullRef())
__instance.apNode.gameObject.SetActive(false);

if (__instance.peNode.IsNotNullRef())
__instance.peNode.gameObject.SetActive(false);
}
}

static bool OrbitRendererBase_LateUpdate_Prefix()
{
return MapView.fetch.updateMap;
Expand Down
4 changes: 2 additions & 2 deletions KSPCommunityFixes/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.19.0.0")]
[assembly: AssemblyFileVersion("1.19.0.0")]
[assembly: AssemblyVersion("1.19.1.0")]
[assembly: AssemblyFileVersion("1.19.1.0")]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ If doing so in the `Debug` configuration and if your KSP install is modified to

### Changelog

##### 1.19.1
- DisableMapUpdateInFlight : fixed phantom map markers on flight scene load

##### 1.19.0
- New performance patch : [CommNetThrottling](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/56) (contributed by @JonnyOThan)
- New performance patch : [DisableMapOrbitsInFlight](https://github.com/KSPModdingLibs/KSPCommunityFixes/issues/59) (contributed by @JonnyOThan)
Expand Down

0 comments on commit 728204a

Please sign in to comment.