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

Greatly increase asteroid load and unpack distances #292

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
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
34 changes: 34 additions & 0 deletions Source/Harmony/Vessel.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
14 changes: 14 additions & 0 deletions Source/HarmonyPatcher.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
5 changes: 5 additions & 0 deletions Source/RealSolarSystem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<Compile Include="CameraWrapper.cs" />
<Compile Include="CommNetFixer.cs" />
<Compile Include="GUI.cs" />
<Compile Include="HarmonyPatcher.cs" />
<Compile Include="Harmony\Vessel.cs" />
<Compile Include="InstallationChecker.cs" />
<Compile Include="KopernicusMods\MapSODemandLarge.cs" />
<Compile Include="KopernicusMods\PQSMod_VertexDefineCoastSmooth.cs" />
Expand All @@ -58,6 +60,9 @@
<Compile Include="Watchdogs.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<Private>False</Private>
</Reference>
Expand Down
Loading