Skip to content

Commit

Permalink
Patch so experiments < 40km at earth show as Invalid Situation rather…
Browse files Browse the repository at this point in the history
… than Waiting, hopefully reduces confusion. Close #2222
  • Loading branch information
NathanKell committed Sep 11, 2023
1 parent ece47d0 commit 9332d6d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Source/Harmony/KerbalismPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,27 @@ internal static bool Prefix_Check(ProtoCrewMember c, ref bool __result)
return true;
}
}

[HarmonyPatch]
internal class PatchKerbalism_Experiment
{
static MethodBase TargetMethod() => AccessTools.TypeByName("KERBALISM.Experiment").GetMethod("RunningUpdate", AccessTools.all);

static string invalidSitString = null;
static FieldInfo fi = AccessTools.Field("KERBALISM.Local:Module_Experiment_issue1");

[HarmonyPostfix]
internal static void Postfix_RunningUpdate(Vessel v, ref string mainIssue)
{
if (v.loaded && v.orbit.referenceBody.isHomeWorld && v.altitude < v.orbit.referenceBody.scienceValues.flyingAltitudeThreshold)
{
if (invalidSitString == null)
{
invalidSitString = (string)fi.GetValue(null);
}
mainIssue = invalidSitString;
}
}
}
}
}

0 comments on commit 9332d6d

Please sign in to comment.