diff --git a/Source/Harmony/Vessel.cs b/Source/Harmony/Vessel.cs new file mode 100644 index 00000000..8a3e3835 --- /dev/null +++ b/Source/Harmony/Vessel.cs @@ -0,0 +1,34 @@ +using FinePrint.Utilities; +using HarmonyLib; + +namespace RealSolarSystem.Harmony +{ + [HarmonyPatch(typeof(Vessel))] + internal class PatchVessel + { + [HarmonyPostfix] + [HarmonyPatch("Start")] + internal static void Postfix_Start(Vessel __instance) + { + if (__instance.vesselType == VesselType.SpaceObject || + (__instance.vesselType != VesselType.Debris && + VesselUtilities.VesselHasPartName("PotatoRoid", __instance))) + { + ClobberVesselRanges(__instance.vesselRanges.orbit); + ClobberVesselRanges(__instance.vesselRanges.subOrbital); + ClobberVesselRanges(__instance.vesselRanges.escaping); + ClobberVesselRanges(__instance.vesselRanges.flying); + ClobberVesselRanges(__instance.vesselRanges.splashed); + ClobberVesselRanges(__instance.vesselRanges.landed); + } + } + + private static void ClobberVesselRanges(VesselRanges.Situation vr) + { + vr.load = 100000f; + vr.unload = 101000f; + vr.pack = 2600f; + vr.unpack = 2500f; + } + } +} diff --git a/Source/HarmonyPatcher.cs b/Source/HarmonyPatcher.cs new file mode 100644 index 00000000..9197c295 --- /dev/null +++ b/Source/HarmonyPatcher.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace RealSolarSystem +{ + [KSPAddon(KSPAddon.Startup.Instantly, true)] + public class HarmonyPatcher : MonoBehaviour + { + internal void Start() + { + var harmony = new HarmonyLib.Harmony("RSS.HarmonyPatcher"); + harmony.PatchAll(); + } + } +} diff --git a/Source/RealSolarSystem.csproj b/Source/RealSolarSystem.csproj index 75d333a7..bf94ab96 100644 --- a/Source/RealSolarSystem.csproj +++ b/Source/RealSolarSystem.csproj @@ -44,6 +44,8 @@ + + @@ -58,6 +60,9 @@ + + False + False