using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AutoPilotPlus.Patches; using AutoPilotPlus.UI; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CruiseAssistPlus; using CruiseAssistPlus.Api; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AutoPilotPlus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.9.0")] [assembly: AssemblyInformationalVersion("0.2.9+22a084def477c044c536750bd4def8b544161951")] [assembly: AssemblyProduct("AutoPilotPlus")] [assembly: AssemblyTitle("AutoPilotPlus")] [assembly: AssemblyVersion("0.2.9.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace AutoPilotPlus { public class PilotExtension : INavigatorExtension { public enum PState { Inactive, Active } public static PState State = PState.Inactive; public static bool InputSailSpeedUp; public static double EnergyPer; public static double Speed; public static bool HasWarper; public static string LastWarpReason = ""; private static bool _energyStalled; public static bool Launching; private static bool _orbitLaunch; public static string LaunchStatus = ""; private static bool Armed { get { if (AutoPilotPlusPlugin.MasterEnabled != null && AutoPilotPlusPlugin.MasterEnabled.Value) { return State == PState.Active; } return false; } } private static bool HasTarget { get { if (CruiseAssistPlusPlugin.SelectTargetStar == null && CruiseAssistPlusPlugin.SelectTargetPlanet == null && CruiseAssistPlusPlugin.TargetStar == null) { return CruiseAssistPlusPlugin.TargetPlanet != null; } return true; } } public string PanelLabel => "AutoPilot"; public void OnTargetChanged(int astroId) { if (astroId == 0) { State = PState.Inactive; InputSailSpeedUp = false; _orbitLaunch = false; CruiseAssistPlusPlugin.SuppressAutoArrival = false; } else { State = (AutoPilotPlusPlugin.AutoStart.Value ? PState.Active : PState.Inactive); PlanetData localPlanet = GameMain.localPlanet; Player mainPlayer = GameMain.mainPlayer; CruiseAssistPlusPlugin.SuppressAutoArrival = (_orbitLaunch = localPlanet != null && CruiseAssistPlusPlugin.SelectTargetPlanet != null && CruiseAssistPlusPlugin.SelectTargetPlanet.id == localPlanet.id && (mainPlayer == null || !mainPlayer.sailing)); } AutoPilotPlusPlugin.Dbg($"target changed astroId={astroId} -> state={State} orbitLaunch={_orbitLaunch}"); } public void SetInactive() { State = PState.Inactive; InputSailSpeedUp = false; Launching = false; _orbitLaunch = false; CruiseAssistPlusPlugin.SuppressAutoArrival = false; } public static void ToggleArmed() { State = ((State != PState.Active) ? PState.Active : PState.Inactive); if (State == PState.Inactive) { InputSailSpeedUp = false; } } public bool OperateWalk(PlayerMove_Walk m) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (((PlayerAction)m).player == null || (int)((PlayerAction)m).player.movementState != 0) { return false; } if (!LaunchAllowed(((PlayerAction)m).player)) { return false; } ArmForLaunch(); ZeroGravity(((PlayerAction)m).controller); InputSailSpeedUp = false; if (m.mecha == null || m.mecha.thrusterLevel < 1) { LaunchStatus = "need Thruster tech to launch"; if (GameMain.gameTick % 30 == 0L) { AutoPilotPlusPlugin.Dbg($"launch blocked: thrusterLevel={((m.mecha != null) ? m.mecha.thrusterLevel : (-1))}"); } return false; } Launching = true; LaunchStatus = "launching…"; if (GameMain.gameTick % 30 == 0L) { AutoPilotPlusPlugin.Dbg("launch: Walk -> SwitchToFly"); } m.SwitchToFly(); return true; } public bool OperateDrift(PlayerMove_Drift m) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 if (((PlayerAction)m).player == null || (int)((PlayerAction)m).player.movementState != 1) { return false; } if (!LaunchAllowed(((PlayerAction)m).player)) { return false; } ArmForLaunch(); ZeroGravity(((PlayerAction)m).controller); InputSailSpeedUp = false; Launching = true; ((PlayerAction)m).controller.input0.z = 1f; LaunchStatus = "launching…"; return true; } public bool OperateFly(PlayerMove_Fly m) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_013b: Unknown result type (might be due to invalid IL or missing references) if (((PlayerAction)m).player == null || (int)((PlayerAction)m).player.movementState != 2) { return false; } if (!Launching || !LaunchAllowed(((PlayerAction)m).player)) { return false; } ArmForLaunch(); ZeroGravity(((PlayerAction)m).controller); InputSailSpeedUp = false; if (m.navigation != null) { m.navigation.navigating = false; } m.targetAltitude = Mathf.Max(m.targetAltitude, 60f); ((PlayerAction)m).controller.input1.y = 1f; ((PlayerAction)m).controller.input0.y = 1f; LaunchStatus = $"launching (alt {m.currentAltitude:0} m)"; if (GameMain.gameTick % 30 == 0L) { AutoPilotPlusPlugin.Dbg($"launch climb: alt={m.currentAltitude:0} horz={((PlayerAction)m).controller.horzSpeed:0.0} " + $"thruster={((m.mecha != null) ? m.mecha.thrusterLevel : (-1))}"); } if (m.currentAltitude > 45f && m.mecha != null && m.mecha.thrusterLevel >= 2) { ((PlayerAction)m).controller.movementStateInFrame = (EMovementState)3; ((PlayerAction)m).controller.actionSail.ResetSailState(); GameCamera.instance.SyncForSailMode(); GameScenarioLogic gameScenario = GameMain.gameScenario; if (gameScenario != null) { gameScenario.NotifyOnSailModeEnter(); } AutoPilotPlusPlugin.Dbg($"launch: Fly -> Sail (alt={m.currentAltitude:0} horz={((PlayerAction)m).controller.horzSpeed:0.0})"); } return true; } private static bool LaunchAllowed(Player player) { if (player != null && AutoPilotPlusPlugin.MasterEnabled.Value && AutoPilotPlusPlugin.AutoLaunch.Value) { return HasTarget; } return false; } private static void ArmForLaunch() { if (State != PState.Active) { State = PState.Active; AutoPilotPlusPlugin.Dbg("ground launch -> armed"); } } private static void ZeroGravity(PlayerController controller) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)controller != (Object)null && AutoPilotPlusPlugin.IgnoreGravity.Value) { controller.universalGravity = VectorLF3.zero; controller.localGravity = Vector3.zero; } } public bool OperateSail(PlayerMove_Sail move) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) if (!Armed) { InputSailSpeedUp = false; return false; } Player player = ((PlayerAction)move).player; Mecha val = move.mecha ?? ((player != null) ? player.mecha : null); if (player == null || val == null) { Launching = false; return false; } if (!player.sailing) { return false; } EnergyPer = ((val.coreEnergyCap > 0.0) ? (val.coreEnergy / val.coreEnergyCap * 100.0) : 0.0); Speed = ((VectorLF3)(ref move.visual_uvel)).magnitude; HasWarper = val.HasWarper(); if (player.warping) { Launching = false; return false; } if (!HasTarget) { InputSailSpeedUp = false; Launching = false; return false; } if (AutoPilotPlusPlugin.IgnoreGravity.Value) { player.controller.universalGravity = VectorLF3.zero; player.controller.localGravity = Vector3.zero; } PlanetData localPlanet = GameMain.localPlanet; VectorLF3 val2; double num; if (localPlanet != null) { val2 = player.uPosition - localPlanet.uPosition; num = ((VectorLF3)(ref val2)).magnitude - (double)localPlanet.realRadius; } else { num = double.MaxValue; } double num2 = num; bool flag = localPlanet == null || num2 > (double)AutoPilotPlusPlugin.SpaceAltitude.Value; if (_orbitLaunch) { return HandleOrbitLaunch(player, localPlanet, num2); } if (localPlanet != null && !flag && (CruiseAssistPlusPlugin.TargetPlanet == null || CruiseAssistPlusPlugin.TargetPlanet.id != localPlanet.id)) { Launching = true; return ClimbToSpace(player, localPlanet, num2); } Launching = false; bool flag2 = EnergyReadyToBoost(); InputSailSpeedUp = flag && flag2 && Speed < (double)AutoPilotPlusPlugin.MaxSpeed.Value; LaunchStatus = ((!flag2) ? $"low energy ({EnergyPer:0}%) — recharging" : (flag ? "cruising" : "approaching…")); if (GameMain.gameTick % 60 == 0L) { AutoPilotPlusPlugin.Dbg($"sail inSpace={flag} boost={InputSailSpeedUp} energy={EnergyPer:0}% " + $"speed={Speed:0} range={CruiseAssistPlusPlugin.TargetRange:0} onPlanet={localPlanet != null}"); } if (localPlanet == null) { PlanetData targetPlanet = CruiseAssistPlusPlugin.TargetPlanet; if (targetPlanet != null) { double num3 = CruiseAssistPlusPlugin.TargetRange - (double)targetPlanet.realRadius; float value = AutoPilotPlusPlugin.ApproachBrakeRange.Value; if (num3 < (double)value) { InputSailSpeedUp = false; float value2 = AutoPilotPlusPlugin.ApproachSpeedCap.Value; float num4 = Mathf.Clamp((float)(num3 / (double)value) * (float)AutoPilotPlusPlugin.MaxSpeed.Value, value2, (float)AutoPilotPlusPlugin.MaxSpeed.Value); val2 = player.uVelocity; double magnitude = ((VectorLF3)(ref val2)).magnitude; if (magnitude > (double)num4) { player.uVelocity = VectorLF3.op_Implicit(VectorLF3.op_Implicit(player.uVelocity) * (float)((double)num4 / magnitude)); } LaunchStatus = $"arriving — braking ({num3:0} m)"; if (GameMain.gameTick % 30 == 0L) { AutoPilotPlusPlugin.Dbg($"approach brake range={num3:0} cap={num4:0} speed={magnitude:0}"); } return false; } } TryWarp(move, player, val); return false; } return ApproachOrDepart(player, localPlanet); } private static bool EnergyReadyToBoost() { if (EnergyPer < (double)AutoPilotPlusPlugin.MinEnergyPer.Value) { _energyStalled = true; } else if (EnergyPer >= (double)AutoPilotPlusPlugin.ResumeEnergyPer.Value) { _energyStalled = false; } return !_energyStalled; } private bool HandleOrbitLaunch(Player player, PlanetData localPlanet, double altitude) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) CruiseAssistPlusPlugin.SuppressAutoArrival = true; if (localPlanet != null && !(altitude >= (double)AutoPilotPlusPlugin.OrbitAltitude.Value)) { Launching = true; InputSailSpeedUp = false; Vector3 val = VectorLF3.op_Implicit(player.uPosition - localPlanet.uPosition); Vector3 normalized = ((Vector3)(ref val)).normalized; float num = AutoPilotPlusPlugin.LaunchClimbSpeed.Value; float num2 = Mathf.Clamp01((float)(altitude / (double)Mathf.Max(1f, AutoPilotPlusPlugin.OrbitAltitude.Value))); float num3 = num * Mathf.Lerp(0.3f, 1f, Mathf.Clamp01(num2 / 0.5f)); player.uVelocity = VectorLF3.op_Implicit(normalized * num3); LaunchStatus = $"launching to orbit… ({altitude:0} m)"; if (GameMain.gameTick % 30 == 0L) { AutoPilotPlusPlugin.Dbg($"orbit climb alt={altitude:0} climbSpeed={num3:0}"); } return true; } Launching = false; InputSailSpeedUp = false; VectorLF3 uVelocity = player.uVelocity; double magnitude = ((VectorLF3)(ref uVelocity)).magnitude; if (magnitude > 20.0) { player.uVelocity = VectorLF3.op_Implicit(VectorLF3.op_Implicit(player.uVelocity) * (float)(20.0 / magnitude)); } LaunchStatus = "in orbit"; AutoPilotPlusPlugin.Dbg($"orbit launch complete alt={altitude:0} -> hold + clear"); _orbitLaunch = false; CruiseAssistPlusPlugin.SuppressAutoArrival = false; CruiseAssistPlusPlugin.ClearSelection(); return true; } private bool ClimbToSpace(Player player, PlanetData localPlanet, double altitude) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) LaunchStatus = $"climbing to space… ({altitude:0} m)"; InputSailSpeedUp = false; Vector3 val = VectorLF3.op_Implicit(player.uPosition - localPlanet.uPosition); Vector3 normalized = ((Vector3)(ref val)).normalized; val = VectorLF3.op_Implicit(CruiseAssistPlusPlugin.TargetUPos - player.uPosition); Vector3 normalized2 = ((Vector3)(ref val)).normalized; float num = Mathf.Clamp01((float)(altitude / (double)Mathf.Max(1f, AutoPilotPlusPlugin.SpaceAltitude.Value))); Vector3 val2 = Vector3.Slerp(normalized, normalized2, num * 0.75f); if (Vector3.Dot(val2, normalized) < 0.2f) { val = val2 + normalized; val2 = ((Vector3)(ref val)).normalized; } float num2 = (float)AutoPilotPlusPlugin.LaunchClimbSpeed.Value * Mathf.Lerp(0.3f, 1f, Mathf.Clamp01(num / 0.5f)); player.uVelocity = VectorLF3.op_Implicit(val2 * num2); if (GameMain.gameTick % 60 == 0L) { AutoPilotPlusPlugin.Dbg($"climb-out alt={altitude:0} climbSpeed={num2:0} " + $"climbFrac={num:0.00} energy={EnergyPer:0}%"); } return true; } private void TryWarp(PlayerMove_Sail move, Player player, Mecha mecha) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) StarData targetStar = CruiseAssistPlusPlugin.TargetStar; StarData localStar = GameMain.localStar; if (!AutoPilotPlusPlugin.LocalWarp.Value && localStar != null && (targetStar == null || targetStar.id == localStar.id)) { LastWarpReason = "same-system"; return; } double num = (float)AutoPilotPlusPlugin.WarpMinRangeAU.Value * AutoPilotPlusPlugin.UnitsPerAU.Value; if (CruiseAssistPlusPlugin.TargetRange < num) { LastWarpReason = "too close"; } else if (Speed < (double)AutoPilotPlusPlugin.SpeedToWarp.Value) { LastWarpReason = "too slow"; } else if (!HasWarper) { LastWarpReason = "no warper"; } else if (mecha.coreEnergy <= mecha.warpStartPowerPerSpeed * (double)move.maxWarpSpeed) { LastWarpReason = "low energy"; } else if (mecha.UseWarper()) { player.warpCommand = true; VFAudio.Create("warp-begin", player.transform, Vector3.zero, true, 0, -1, -1L); LastWarpReason = "WARP!"; AutoPilotPlusPlugin.Dbg("engaged warp"); } } private static void SteerToward(Player player, VectorLF3 targetUPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) VectorLF3 uVelocity = player.uVelocity; double magnitude = ((VectorLF3)(ref uVelocity)).magnitude; if (!(magnitude < 1.0)) { VectorLF3 val = targetUPos - player.uPosition; float num = Vector3.Angle(VectorLF3.op_Implicit(val), VectorLF3.op_Implicit(player.uVelocity)); float num2 = AutoPilotPlusPlugin.ApproachTurnRate.Value / Mathf.Max(AutoPilotPlusPlugin.ApproachMinAngle.Value, num); player.uVelocity = VectorLF3.op_Implicit(Vector3.Slerp(VectorLF3.op_Implicit(player.uVelocity), VectorLF3.op_Implicit(((VectorLF3)(ref val)).normalized * magnitude), num2)); } } private bool ApproachOrDepart(Player player, PlanetData localPlanet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) VectorLF3 val = player.uPosition - localPlanet.uPosition; double num = ((VectorLF3)(ref val)).magnitude - (double)localPlanet.realRadius; float value = AutoPilotPlusPlugin.ApproachSpeedCap.Value; float value2 = AutoPilotPlusPlugin.MinClearance.Value; if (Speed > (double)value && num > (double)Math.Max(localPlanet.realRadius, value2)) { SteerToward(player, CruiseAssistPlusPlugin.TargetUPos); return true; } VectorLF3 targetUPos = CruiseAssistPlusPlugin.TargetUPos; VectorLF3 val2 = targetUPos - localPlanet.uPosition; VectorLF3 val3 = ((Vector3.Angle(VectorLF3.op_Implicit(val), VectorLF3.op_Implicit(val2)) > 90f) ? val : (targetUPos - player.uPosition)); double num2 = Math.Min(Speed, value); if (CruiseAssistPlusPlugin.TargetPlanet != null && CruiseAssistPlusPlugin.TargetPlanet.id == localPlanet.id && AutoPilotPlusPlugin.AutoLand.Value) { InputSailSpeedUp = false; num2 = Mathf.Clamp((float)num, 8f, value); if (num < (double)value2 * 0.25 && Speed < 20.0) { AutoPilotPlusPlugin.Dbg("auto-land: releasing control to game"); return false; } } float num3 = Vector3.Angle(VectorLF3.op_Implicit(val3), VectorLF3.op_Implicit(player.uVelocity)); float num4 = AutoPilotPlusPlugin.ApproachTurnRate.Value / Mathf.Max(AutoPilotPlusPlugin.ApproachMinAngle.Value, num3); player.uVelocity = VectorLF3.op_Implicit(Vector3.Slerp(VectorLF3.op_Implicit(player.uVelocity), VectorLF3.op_Implicit(((VectorLF3)(ref val3)).normalized * num2), num4)); return true; } public void OnGUI() { PilotUI.OnGUI(); } public void TogglePanel() { PilotUI.Visible = !PilotUI.Visible; } } [BepInPlugin("com.livinginstinkt.dsp.autopilotplus", "AutoPilotPlus", "0.2.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class AutoPilotPlusPlugin : BaseUnityPlugin { public const string Guid = "com.livinginstinkt.dsp.autopilotplus"; public const string Name = "AutoPilotPlus"; public const string Version = "0.2.9"; internal static ManualLogSource Log; internal static AutoPilotPlusPlugin Instance; internal static ConfigEntry MasterEnabled; internal static ConfigEntry AutoStart; internal static ConfigEntry MinEnergyPer; internal static ConfigEntry ResumeEnergyPer; internal static ConfigEntry LaunchClimbSpeed; internal static ConfigEntry MaxSpeed; internal static ConfigEntry WarpMinRangeAU; internal static ConfigEntry SpeedToWarp; internal static ConfigEntry LocalWarp; internal static ConfigEntry IgnoreGravity; internal static ConfigEntry AutoLand; internal static ConfigEntry AutoLaunch; internal static ConfigEntry HidePanelWhenNotInSpace; internal static ConfigEntry ApproachSpeedCap; internal static ConfigEntry MinClearance; internal static ConfigEntry ApproachTurnRate; internal static ConfigEntry ApproachMinAngle; internal static ConfigEntry UnitsPerAU; internal static ConfigEntry WarperItemId; internal static ConfigEntry SpaceAltitude; internal static ConfigEntry ApproachBrakeRange; internal static ConfigEntry OrbitAltitude; internal static ConfigEntry DebugLog; internal static ConfigEntry DebugWindow; private Harmony _harmony; private PilotExtension _extension; private void Awake() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Instance = this; MasterEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Master switch for AutoPilotPlus."); AutoStart = ((BaseUnityPlugin)this).Config.Bind("General", "AutoStart", true, "Arm autopilot automatically when a target is selected. When off, arm it from the AutoPilot window."); MinEnergyPer = ((BaseUnityPlugin)this).Config.Bind("Flight", "MinEnergyPer", 20, new ConfigDescription("Stop boosting below this mecha core energy %.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); LaunchClimbSpeed = ((BaseUnityPlugin)this).Config.Bind("Flight", "LaunchClimbSpeed", 250, new ConfigDescription("Top speed (units/s) the ground-launch uses to climb straight out of the gravity well to space — driven directly, WITHOUT boost, so it's as fast as possible on thrust alone. Ramps up to this as altitude builds.", (AcceptableValueBase)(object)new AcceptableValueRange(40, 2000), Array.Empty())); ResumeEnergyPer = ((BaseUnityPlugin)this).Config.Bind("Flight", "ResumeEnergyPer", 50, new ConfigDescription("After energy drops below MinEnergyPer, don't boost again until it recharges to this %. Prevents a stall/boost loop where boost restarts the instant energy crosses MinEnergyPer and immediately drains back to empty without building speed (leaves you frozen, drifting).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 100), Array.Empty())); MaxSpeed = ((BaseUnityPlugin)this).Config.Bind("Flight", "MaxSpeed", 2000, new ConfigDescription("Sail boost speed cap.", (AcceptableValueBase)(object)new AcceptableValueRange(100, 5000), Array.Empty())); WarpMinRangeAU = ((BaseUnityPlugin)this).Config.Bind("Flight", "WarpMinRangeAU", 2, new ConfigDescription("Minimum distance (AU) to the target before warp is allowed.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 60), Array.Empty())); SpeedToWarp = ((BaseUnityPlugin)this).Config.Bind("Flight", "SpeedToWarp", 1200, new ConfigDescription("Minimum sail speed before warp engages.", (AcceptableValueBase)(object)new AcceptableValueRange(100, 5000), Array.Empty())); LocalWarp = ((BaseUnityPlugin)this).Config.Bind("Flight", "LocalWarp", false, "Allow warp within the current star system."); IgnoreGravity = ((BaseUnityPlugin)this).Config.Bind("Flight", "IgnoreGravity", true, "Zero gravity while automating (cleaner take-off)."); AutoLand = ((BaseUnityPlugin)this).Config.Bind("Flight", "AutoLand", true, "Decelerate and settle onto the destination planet on arrival."); AutoLaunch = ((BaseUnityPlugin)this).Config.Bind("Flight", "AutoLaunch", true, "When armed with a target while on the ground, auto-launch into orbit (Walk->Fly->Sail) and cruise to it. Needs Thruster tech."); HidePanelWhenNotInSpace = ((BaseUnityPlugin)this).Config.Bind("UI", "HidePanelWhenNotInSpace", false, "Auto-hide the AutoPilot+ window while walking/building on a planet; show it in space."); ApproachSpeedCap = ((BaseUnityPlugin)this).Config.Bind("Tuning", "ApproachSpeedCap", 120f, "Speed cap while manoeuvring near a planet."); MinClearance = ((BaseUnityPlugin)this).Config.Bind("Tuning", "MinClearance", 800f, "Altitude (units above surface) considered 'clear' of a planet."); ApproachTurnRate = ((BaseUnityPlugin)this).Config.Bind("Tuning", "ApproachTurnRate", 1.6f, "Slerp numerator for approach steering."); ApproachMinAngle = ((BaseUnityPlugin)this).Config.Bind("Tuning", "ApproachMinAngle", 10f, "Slerp angle floor for approach steering."); UnitsPerAU = ((BaseUnityPlugin)this).Config.Bind("Tuning", "UnitsPerAU", 40000f, "Game units per AU (used for the warp distance check)."); WarperItemId = ((BaseUnityPlugin)this).Config.Bind("Tuning", "WarperItemId", 1210, "Item id of the Space Warper."); SpaceAltitude = ((BaseUnityPlugin)this).Config.Bind("Tuning", "SpaceAltitude", 600f, "Altitude (m above surface) above which the mecha is considered 'in space' and may boost/thrust. Below this it coasts out on launch momentum to save energy."); ApproachBrakeRange = ((BaseUnityPlugin)this).Config.Bind("Tuning", "ApproachBrakeRange", 6000f, new ConfigDescription("Distance (m above the destination surface) at which the approach starts braking. Inside this range the mecha bleeds speed proportional to remaining distance so it settles into a slow high orbit instead of coasting in at cruise speed and crashing.", (AcceptableValueBase)(object)new AcceptableValueRange(1000f, 40000f), Array.Empty())); OrbitAltitude = ((BaseUnityPlugin)this).Config.Bind("Tuning", "OrbitAltitude", 1500f, new ConfigDescription("Target altitude (m above surface) for 'launch to orbit' — selecting the planet you're standing on climbs to roughly this altitude and holds there instead of flying off to another target.", (AcceptableValueBase)(object)new AcceptableValueRange(600f, 20000f), Array.Empty())); DebugLog = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugLog", false, "Verbose per-tick autopilot logging (why warp did/didn't fire, etc)."); DebugWindow = ((BaseUnityPlugin)this).Config.Bind("Debug", "DebugWindow", false, "Show the AutoPilot debug overlay."); PilotUI.LoadFromConfig(((BaseUnityPlugin)this).Config); _harmony = new Harmony("com.livinginstinkt.dsp.autopilotplus"); _harmony.PatchAll(typeof(VFInputPatch)); _extension = new PilotExtension(); CruiseAssistPlusPlugin.RegisterExtension((INavigatorExtension)(object)_extension); Log.LogInfo((object)"AutoPilotPlus v0.2.9 loaded."); } private void OnDestroy() { CruiseAssistPlusPlugin.UnregisterExtension(typeof(PilotExtension)); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } _harmony = null; } internal static void Dbg(string msg) { if (DebugLog != null && DebugLog.Value) { Log.LogInfo((object)("[ap] " + msg)); } } } } namespace AutoPilotPlus.UI { public static class PilotConfigUI { [CompilerGenerated] private static class <>O { public static WindowFunction <0>__Draw; } private const int WinId = 68302; public static Rect Rect = new Rect(410f, 470f, 340f, 460f); public static bool Visible = false; private static ConfigEntry _left; private static ConfigEntry _top; public static void LoadFromConfig(ConfigFile cfg) { _left = cfg.Bind("Window", "PilotConfigLeft", 410f, (ConfigDescription)null); _top = cfg.Bind("Window", "PilotConfigTop", 470f, (ConfigDescription)null); ((Rect)(ref Rect)).x = _left.Value; ((Rect)(ref Rect)).y = _top.Value; } public static void OnGUI() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (Visible) { Rect rect = Rect; object obj = <>O.<0>__Draw; if (obj == null) { WindowFunction val = Draw; <>O.<0>__Draw = val; obj = (object)val; } Rect = GUILayout.Window(68302, rect, (WindowFunction)obj, "AutoPilot+ Config", Array.Empty()); if (_left != null) { _left.Value = ((Rect)(ref Rect)).x; _top.Value = ((Rect)(ref Rect)).y; } } } private static void Draw(int id) { GUILayout.BeginVertical(Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("✕", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { Visible = false; } GUILayout.EndHorizontal(); AutoPilotPlusPlugin.MasterEnabled.Value = GUILayout.Toggle(AutoPilotPlusPlugin.MasterEnabled.Value, "Enabled (master)", Array.Empty()); GUILayout.Space(4f); GUILayout.Label("Automation", Bold(), Array.Empty()); AutoPilotPlusPlugin.AutoStart.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoStart.Value, "Auto-arm on target select", Array.Empty()); AutoPilotPlusPlugin.AutoLaunch.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoLaunch.Value, "Auto-launch from ground", Array.Empty()); AutoPilotPlusPlugin.AutoLand.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoLand.Value, "Auto-land on arrival", Array.Empty()); AutoPilotPlusPlugin.IgnoreGravity.Value = GUILayout.Toggle(AutoPilotPlusPlugin.IgnoreGravity.Value, "Ignore gravity while automating", Array.Empty()); GUILayout.Space(4f); GUILayout.Label("Warp", Bold(), Array.Empty()); AutoPilotPlusPlugin.LocalWarp.Value = GUILayout.Toggle(AutoPilotPlusPlugin.LocalWarp.Value, "Allow warp within the current system", Array.Empty()); GUILayout.Label($"Min warp range: {AutoPilotPlusPlugin.WarpMinRangeAU.Value} AU", Array.Empty()); AutoPilotPlusPlugin.WarpMinRangeAU.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.WarpMinRangeAU.Value, 1f, 60f, Array.Empty())); GUILayout.Label($"Speed to warp: {AutoPilotPlusPlugin.SpeedToWarp.Value}", Array.Empty()); AutoPilotPlusPlugin.SpeedToWarp.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.SpeedToWarp.Value, 100f, 5000f, Array.Empty()) / 50f) * 50; GUILayout.Space(4f); GUILayout.Label("Flight", Bold(), Array.Empty()); GUILayout.Label($"Min core energy to boost: {AutoPilotPlusPlugin.MinEnergyPer.Value}%", Array.Empty()); AutoPilotPlusPlugin.MinEnergyPer.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.MinEnergyPer.Value, 0f, 100f, Array.Empty())); GUILayout.Label($"Resume-boost energy: {AutoPilotPlusPlugin.ResumeEnergyPer.Value}%", Array.Empty()); AutoPilotPlusPlugin.ResumeEnergyPer.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.ResumeEnergyPer.Value, 0f, 100f, Array.Empty())); GUILayout.Label($"Max sail speed: {AutoPilotPlusPlugin.MaxSpeed.Value}", Array.Empty()); AutoPilotPlusPlugin.MaxSpeed.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.MaxSpeed.Value, 100f, 5000f, Array.Empty()) / 50f) * 50; GUILayout.Label($"Launch climb speed (no boost): {AutoPilotPlusPlugin.LaunchClimbSpeed.Value}", Array.Empty()); AutoPilotPlusPlugin.LaunchClimbSpeed.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)AutoPilotPlusPlugin.LaunchClimbSpeed.Value, 40f, 2000f, Array.Empty()) / 10f) * 10; GUILayout.Label($"Space altitude (climb-out target): {AutoPilotPlusPlugin.SpaceAltitude.Value:0} m", Array.Empty()); AutoPilotPlusPlugin.SpaceAltitude.Value = Mathf.Round(GUILayout.HorizontalSlider(AutoPilotPlusPlugin.SpaceAltitude.Value, 100f, 2000f, Array.Empty()) / 50f) * 50f; GUILayout.Label($"Approach brake range: {AutoPilotPlusPlugin.ApproachBrakeRange.Value:0} m", Array.Empty()); AutoPilotPlusPlugin.ApproachBrakeRange.Value = Mathf.Round(GUILayout.HorizontalSlider(AutoPilotPlusPlugin.ApproachBrakeRange.Value, 1000f, 40000f, Array.Empty()) / 500f) * 500f; GUILayout.Label($"Orbit altitude (launch-to-orbit): {AutoPilotPlusPlugin.OrbitAltitude.Value:0} m", Array.Empty()); AutoPilotPlusPlugin.OrbitAltitude.Value = Mathf.Round(GUILayout.HorizontalSlider(AutoPilotPlusPlugin.OrbitAltitude.Value, 600f, 20000f, Array.Empty()) / 100f) * 100f; GUILayout.Space(4f); GUILayout.Label("UI", Bold(), Array.Empty()); AutoPilotPlusPlugin.HidePanelWhenNotInSpace.Value = GUILayout.Toggle(AutoPilotPlusPlugin.HidePanelWhenNotInSpace.Value, "Hide panel when not in space", Array.Empty()); GUILayout.Space(4f); GUILayout.Label("Debug", Bold(), Array.Empty()); AutoPilotPlusPlugin.DebugLog.Value = GUILayout.Toggle(AutoPilotPlusPlugin.DebugLog.Value, "Verbose debug logging", Array.Empty()); AutoPilotPlusPlugin.DebugWindow.Value = GUILayout.Toggle(AutoPilotPlusPlugin.DebugWindow.Value, "Show debug overlay", Array.Empty()); GUILayout.EndVertical(); GUI.DragWindow(); } private static GUIStyle Bold() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown return new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1 }; } } public static class PilotUI { [CompilerGenerated] private static class <>O { public static WindowFunction <0>__Draw; } private const int WinId = 68301; public static Rect Rect = new Rect(100f, 470f, 300f, 230f); public static bool Visible = true; public static bool Collapsed = false; private static ConfigEntry _left; private static ConfigEntry _top; private static ConfigEntry _collapsed; public static void LoadFromConfig(ConfigFile cfg) { _left = cfg.Bind("Window", "PilotLeft", 100f, (ConfigDescription)null); _top = cfg.Bind("Window", "PilotTop", 470f, (ConfigDescription)null); _collapsed = cfg.Bind("Window", "PilotCollapsed", false, (ConfigDescription)null); ((Rect)(ref Rect)).x = _left.Value; ((Rect)(ref Rect)).y = _top.Value; Collapsed = _collapsed.Value; PilotConfigUI.LoadFromConfig(cfg); } public static void OnGUI() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown PilotConfigUI.OnGUI(); if (Visible && (!AutoPilotPlusPlugin.HidePanelWhenNotInSpace.Value || CruiseAssistPlusPlugin.InSpace)) { ((Rect)(ref Rect)).height = (Collapsed ? 40 : 230); Rect rect = Rect; object obj = <>O.<0>__Draw; if (obj == null) { WindowFunction val = Draw; <>O.<0>__Draw = val; obj = (object)val; } Rect = GUILayout.Window(68301, rect, (WindowFunction)obj, "AutoPilot+", Array.Empty()); if (_left != null) { _left.Value = ((Rect)(ref Rect)).x; _top.Value = ((Rect)(ref Rect)).y; _collapsed.Value = Collapsed; } } } private static void Header() { GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(Collapsed ? "+" : "–", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { Collapsed = !Collapsed; } GUILayout.FlexibleSpace(); if (GUILayout.Button("Config", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) })) { PilotConfigUI.Visible = !PilotConfigUI.Visible; } if (GUILayout.Button("✕", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(26f) })) { Visible = false; } GUILayout.EndHorizontal(); } private static void Draw(int id) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty()); Header(); if (!Collapsed) { bool flag = PilotExtension.State == PilotExtension.PState.Active; GUIStyle val = new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1 }; val.normal.textColor = (flag ? Color.green : Color.gray); GUILayout.Label(flag ? "● ARMED" : "○ Inactive", val, Array.Empty()); if (!string.IsNullOrEmpty(PilotExtension.LaunchStatus)) { GUILayout.Label("Status: " + PilotExtension.LaunchStatus, Array.Empty()); } GUILayout.Label($"Energy: {PilotExtension.EnergyPer:0}% Speed: {PilotExtension.Speed:0}", Array.Empty()); GUILayout.Label("Warper: " + (PilotExtension.HasWarper ? "yes" : "no") + " Warp: " + PilotExtension.LastWarpReason, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); bool value = AutoPilotPlusPlugin.MasterEnabled.Value; if (GUILayout.Button(value ? "On" : "Off", Array.Empty())) { AutoPilotPlusPlugin.MasterEnabled.Value = !value; } if (GUILayout.Button(flag ? "Disarm" : "Arm", Array.Empty())) { PilotExtension.ToggleArmed(); } GUILayout.EndHorizontal(); AutoPilotPlusPlugin.AutoStart.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoStart.Value, "Auto-arm on target select", Array.Empty()); AutoPilotPlusPlugin.AutoLaunch.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoLaunch.Value, "Auto-launch from ground", Array.Empty()); AutoPilotPlusPlugin.AutoLand.Value = GUILayout.Toggle(AutoPilotPlusPlugin.AutoLand.Value, "Auto-land on arrival", Array.Empty()); AutoPilotPlusPlugin.IgnoreGravity.Value = GUILayout.Toggle(AutoPilotPlusPlugin.IgnoreGravity.Value, "Ignore gravity", Array.Empty()); AutoPilotPlusPlugin.LocalWarp.Value = GUILayout.Toggle(AutoPilotPlusPlugin.LocalWarp.Value, "Allow local warp", Array.Empty()); } GUILayout.EndVertical(); GUI.DragWindow(); } } } namespace AutoPilotPlus.Patches { public static class VFInputPatch { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void SailSpeedUpPostfix(ref bool __result) { if (AutoPilotPlusPlugin.MasterEnabled != null && AutoPilotPlusPlugin.MasterEnabled.Value && PilotExtension.State == PilotExtension.PState.Active && PilotExtension.InputSailSpeedUp) { __result = true; } } } }