using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("IcarusAtmosphericBoost")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.1.2.0")]
[assembly: AssemblyInformationalVersion("2.1.2+c0353831d77887e7bbf2481e68a820500f2bf56e")]
[assembly: AssemblyProduct("IcarusAtmosphericBoost")]
[assembly: AssemblyTitle("IcarusAtmosphericBoost")]
[assembly: AssemblyVersion("2.1.2.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 IcarusAtmosphericBoost
{
internal static class BoostMath
{
internal const float LaunchCeilingAltitude = 47f;
internal const float SailHandoffAltitude = 50f;
internal static bool ShouldHandoff(double altitude, double outwardSpeed)
{
if (altitude >= 50.0)
{
return outwardSpeed > 0.0;
}
return false;
}
internal static double LaunchSpeed(double requested, double radius, double ceiling)
{
return Math.Min(requested, Math.Max(0.0, ceiling - radius) * 4.0);
}
internal static double MaximumRadialSpeed(double radius, double ceiling, double tangentSpeed, double dt)
{
double num = tangentSpeed * dt;
return (Math.Sqrt(Math.Max(0.0, ceiling * ceiling - num * num)) - radius) / dt;
}
internal static double MaximumTangentSpeed(double radius, double ceiling, double dt)
{
return Math.Sqrt(Math.Max(0.0, ceiling * ceiling - radius * radius)) / dt;
}
internal static double MinimumRadialSpeed(double radius, double ceiling, double tangentSpeed, double dt)
{
double num = tangentSpeed * dt;
return (0.0 - Math.Sqrt(Math.Max(0.0, ceiling * ceiling - num * num)) - radius) / dt;
}
}
internal sealed class HoldGesture
{
internal const double CooldownSeconds = 3.0;
private double startedAt = double.NaN;
private double nextLaunchAt = double.NegativeInfinity;
internal bool Sample(bool pressed, double now, double delay)
{
if (pressed)
{
if (double.IsNaN(startedAt) || now < startedAt)
{
startedAt = now;
}
return false;
}
bool result = now - startedAt >= delay && now >= nextLaunchAt;
CancelHold();
return result;
}
internal void RecordLaunch(double now)
{
nextLaunchAt = now + 3.0;
}
internal void CancelHold()
{
startedAt = double.NaN;
}
internal void Reset()
{
CancelHold();
nextLaunchAt = double.NegativeInfinity;
}
}
internal static class BoostRuntime
{
private const float TickStep = 1f / 60f;
private static readonly HoldGesture Gesture = new HoldGesture();
private static PlayerController trackedController;
private static PlanetData trackedPlanet;
private static bool launchRequested;
private static bool guarded;
private static bool coasting;
private static float outwardBeforeActions;
internal static void Reset()
{
trackedController = null;
trackedPlanet = null;
launchRequested = (guarded = false);
coasting = false;
Gesture.Reset();
}
private static bool IsLocal(PlayerController c)
{
if ((Object)(object)c != (Object)null && c.player != null && c.player == GameMain.mainPlayer)
{
return c.gameData != null;
}
return false;
}
private static bool CanControl(PlayerController c)
{
if (IsLocal(c) && GameMain.isRunning && !GameMain.isPaused && !GameMain.isFullscreenPaused && !DSPGame.IsMenuDemo && !c.gameData.disableController && !c.gameData.guideRunning && c.player.isAlive)
{
return !c.player.respawning;
}
return false;
}
private static bool CanReadJump(PlayerController c)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Invalid comparison between Unknown and I4
if (!CanControl(c) || !Application.isFocused || VFInput.inputing || VFInput.inFullscreenGUI || VFInput.inCombatScreenGUI || VFInput.inScreenshotMode || (int)UIGame.viewMode >= 4)
{
return false;
}
if (((int)c.cmd.type == 5 && !PlayerController.operationWhenBuild) || (c.actionBuild != null && (int)c.actionBuild.blueprintMode > 0))
{
return VFInput._godModeMechaMove;
}
return true;
}
internal static void Refresh(PlayerController c)
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)c != (Object)null) || IsLocal(c))
{
PlanetData val = (IsLocal(c) ? c.gameData.localPlanet : null);
if ((Object)(object)c != (Object)(object)trackedController)
{
Reset();
trackedController = c;
}
if (val != trackedPlanet)
{
trackedPlanet = val;
launchRequested = (guarded = false);
coasting = false;
Gesture.CancelHold();
}
if (!Plugin.Enabled.Value || !CanReadJump(c) || val == null || c.player.warping)
{
launchRequested = false;
Gesture.CancelHold();
}
else if (Gesture.Sample(VFInput._jump.pressing, Time.realtimeSinceStartupAsDouble, Plugin.HoldSeconds.Value))
{
launchRequested = InLaunchRange(c);
}
}
}
private static float Ceiling(PlanetData planet)
{
return planet.realRadius + 47f;
}
private static bool CanModify(PlayerController c)
{
if ((Object)(object)c == (Object)(object)trackedController && Plugin.Enabled.Value && CanControl(c) && trackedPlanet != null)
{
return trackedPlanet == c.gameData.localPlanet;
}
return false;
}
private static bool InLaunchRange(PlayerController c)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
double num;
if (!c.player.sailing)
{
Vector3 position = c.player.position;
num = ((Vector3)(ref position)).magnitude;
}
else
{
VectorLF3 val = c.player.uPosition - trackedPlanet.uPosition;
num = ((VectorLF3)(ref val)).magnitude;
}
double num2 = num;
if (num2 > 1.0 && num2 - (double)trackedPlanet.realRadius <= (double)Plugin.LaunchRange.Value)
{
if (c.mecha.thrusterLevel < 2)
{
if (!c.player.sailing)
{
return num2 < (double)Ceiling(trackedPlanet);
}
return false;
}
return true;
}
return false;
}
internal static void BeginTick(PlayerController c)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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)
Refresh(c);
CorrectPosition(c);
outwardBeforeActions = 0f;
if (CanModify(c) && !c.player.sailing && coasting)
{
Vector3 velocity = c.velocity;
Vector3 position = c.player.position;
outwardBeforeActions = Vector3.Dot(velocity, ((Vector3)(ref position)).normalized);
}
}
internal static void SeparateChargeFromClimb(PlayerController c)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (CanModify(c) && CanReadJump(c) && !c.player.warping && VFInput._jump.pressing && InLaunchRange(c) && c.input1.y > 0f)
{
c.input1.y = 0f;
}
}
internal static void PreserveTakeoffCoast(PlayerController c, ref float force)
{
if (CanModify(c) && c.mecha.thrusterLevel >= 2 && outwardBeforeActions > 0f)
{
force = 0f;
}
}
private static Vector3 LimitVelocity(Vector3 position, Vector3 velocity, float ceiling, float dt)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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_0010: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
float magnitude = ((Vector3)(ref position)).magnitude;
Vector3 val = position / magnitude;
float num = Vector3.Dot(velocity, val);
Vector3 val2 = velocity - val * num;
double num2 = BoostMath.MaximumTangentSpeed(magnitude, ceiling, dt);
if ((double)((Vector3)(ref val2)).magnitude > num2)
{
val2 = ((Vector3)(ref val2)).normalized * (float)num2;
}
double val3 = BoostMath.MaximumRadialSpeed(magnitude, ceiling, ((Vector3)(ref val2)).magnitude, dt);
double val4 = BoostMath.MinimumRadialSpeed(magnitude, ceiling, ((Vector3)(ref val2)).magnitude, dt);
return val2 + val * (float)Math.Max(val4, Math.Min(num, val3));
}
private static bool TryPayForBoost(PlayerController c)
{
Mecha mecha = c.mecha;
double num = mecha.thrustPowerPerAcc * ((VectorLF3)(ref c.universalGravity)).magnitude * mecha.reactorPowerConsRatio * (double)Plugin.BoostPowerMultiplier.Value;
if (double.IsNaN(num) || double.IsInfinity(num))
{
return false;
}
if (num <= 0.0)
{
return true;
}
double num2 = mecha.coreEnergyCap * 0.05;
num = Math.Min(num, num2);
double num3 = default(double);
float num4 = default(float);
mecha.QueryEnergy(num, ref num3, ref num4);
if (num3 < num || mecha.coreEnergy - num < num2)
{
return false;
}
mecha.UseEnergy(num);
mecha.MarkEnergyChange(4, 0.0 - num);
return true;
}
internal static void BeforeForce(PlayerController c, ref VectorLF3 force, ref bool rigidbodySleep)
{
//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_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: 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_015d: 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_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Invalid comparison between Unknown and I4
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
if (!CanModify(c) || c.player.sailing)
{
return;
}
bool flag = c.mecha.thrusterLevel >= 2;
if (flag)
{
guarded = false;
}
Vector3 position = c.player.position;
float magnitude = ((Vector3)(ref position)).magnitude;
bool flag2 = launchRequested;
launchRequested = false;
if (magnitude < 1f)
{
return;
}
float num = Ceiling(trackedPlanet);
Vector3 val = c.velocity;
Vector3 val2 = position / magnitude;
bool flag3 = flag2 && InLaunchRange(c) && TryPayForBoost(c);
if (flag3)
{
double realtimeSinceStartupAsDouble = Time.realtimeSinceStartupAsDouble;
Gesture.RecordLaunch(realtimeSinceStartupAsDouble);
float num2 = (flag ? Plugin.LaunchSpeed.Value : ((float)BoostMath.LaunchSpeed(Plugin.LockedLaunchSpeed.Value, magnitude, num)));
val += val2 * (num2 - Vector3.Dot(val, val2));
force = VectorLF3.op_Implicit(c.localGravity);
rigidbodySleep = false;
c.rigid.WakeUp();
guarded = !flag;
coasting = flag;
}
if (flag && (flag3 || outwardBeforeActions > 0f))
{
if (!flag3)
{
val += val2 * (outwardBeforeActions - Vector3.Dot(val, val2));
}
force = VectorLF3.op_Implicit(c.localGravity);
rigidbodySleep = false;
c.velocity = val;
if (flag3)
{
PlayIgnition(c);
}
if ((int)c.movementStateInFrame == 3 || BoostMath.ShouldHandoff(magnitude - trackedPlanet.realRadius, Vector3.Dot(val, val2)))
{
HandoffToSail(c);
}
return;
}
coasting = false;
if (guarded)
{
float num3 = Mathf.Max(1f / 60f, Time.fixedDeltaTime);
Vector3 val3 = VectorLF3.op_Implicit(force) * Mathf.Clamp(Time.fixedDeltaTime, 1f / 60f, 0.050000004f);
Vector3 val4 = LimitVelocity(position, val + val3, num, num3);
c.velocity = val4 - val3;
if (flag3)
{
PlayIgnition(c);
}
Vector3 val5 = position + val4 * num3;
if (((Vector3)(ref val5)).sqrMagnitude < ((Vector3)(ref position)).sqrMagnitude)
{
guarded = false;
}
}
}
internal static void CorrectPosition(PlayerController c)
{
//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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0057: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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)
if (guarded && CanModify(c) && !c.player.sailing && c.mecha.thrusterLevel < 2)
{
Vector3 val = c.player.position;
float magnitude = ((Vector3)(ref val)).magnitude;
float num = Ceiling(trackedPlanet);
if (!(magnitude <= num))
{
Vector3 val2 = val / magnitude;
val = val2 * (num - 0.01f);
c.player.position = val;
c.rigid.position = val;
c.velocity -= val2 * Mathf.Max(0f, Vector3.Dot(c.velocity, val2));
}
}
}
internal static void BeforeSail(PlayerController c)
{
//IL_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
if (launchRequested && CanModify(c) && c.player.sailing)
{
launchRequested = false;
if (InLaunchRange(c) && TryPayForBoost(c))
{
VectorLF3 val = c.player.uPosition - trackedPlanet.uPosition;
VectorLF3 normalized = ((VectorLF3)(ref val)).normalized;
VectorLF3 val2 = Maths.QInvRotateLF(trackedPlanet.runtimeRotation, val);
VectorLF3 universalVelocityAtLocalPoint = trackedPlanet.GetUniversalVelocityAtLocalPoint(GameMain.gameTime, VectorLF3.op_Implicit(val2));
double num = VectorLF3.Dot(c.player.uVelocity - universalVelocityAtLocalPoint, normalized);
Player player = c.player;
player.uVelocity += normalized * ((double)Plugin.LaunchSpeed.Value - num);
BeginSailCoast(c.actionSail);
Gesture.RecordLaunch(Time.realtimeSinceStartupAsDouble);
PlayIgnition(c);
}
}
}
private static void HandoffToSail(PlayerController c)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Invalid comparison between Unknown and I4
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
coasting = false;
if ((int)c.movementStateInFrame != 3)
{
if ((int)c.cmd.type == 5)
{
((CommandState)(ref c.cmd)).SetNoneCommand();
c.actionBuild.blueprintMode = (EBlueprintMode)0;
}
c.movementStateInFrame = (EMovementState)3;
c.actionSail.ResetSailState();
GameCamera instance = GameCamera.instance;
if (instance != null)
{
instance.SyncForSailMode();
}
GameScenarioLogic gameScenario = GameMain.gameScenario;
if (gameScenario != null)
{
gameScenario.NotifyOnSailModeEnter();
}
}
BeginSailCoast(c.actionSail);
}
private static void PlayIgnition(PlayerController c)
{
PlayerEffect effect = c.player.effect;
if ((Object)(object)effect == (Object)null || effect.backEngineEffect == null)
{
return;
}
ParticleSystem[] backEngineEffect = effect.backEngineEffect;
foreach (ParticleSystem val in backEngineEffect)
{
if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
{
val.Emit(12);
}
}
}
private static void BeginSailCoast(PlayerMove_Sail sail)
{
sail.input_aff_1 = 1.0;
sail.input_aff_2 = 1.0;
}
}
[HarmonyPatch(typeof(PlayerController), "GameTick")]
internal static class ControllerTickPatch
{
[HarmonyPrefix]
private static void Prefix(PlayerController __instance)
{
BoostRuntime.BeginTick(__instance);
}
}
[HarmonyPatch(typeof(PlayerController), "GetInput")]
internal static class ChargeInputPatch
{
[HarmonyPostfix]
private static void Postfix(PlayerController __instance)
{
BoostRuntime.SeparateChargeFromClimb(__instance);
}
}
[HarmonyPatch(typeof(PlayerMove_Fly), "UseThrustEnergy")]
internal static class TakeoffThrustPatch
{
[HarmonyPrefix]
private static void Prefix(PlayerMove_Fly __instance, ref float force)
{
BoostRuntime.PreserveTakeoffCoast(((PlayerAction)__instance).controller, ref force);
}
}
[HarmonyPatch(typeof(PlayerMove_Sail), "GameTick")]
internal static class SailPatch
{
[HarmonyPrefix]
private static void Prefix(PlayerMove_Sail __instance)
{
BoostRuntime.BeforeSail(((PlayerAction)__instance).controller);
}
}
[HarmonyPatch(typeof(PlayerController), "ApplyLocalForce")]
internal static class ForcePatch
{
[HarmonyPrefix]
private static void Prefix(PlayerController __instance, ref VectorLF3 ____lForce, ref bool ___rigidbodySleep)
{
BoostRuntime.BeforeForce(__instance, ref ____lForce, ref ___rigidbodySleep);
}
}
[HarmonyPatch(typeof(PlayerController), "UpdatePhysicsDirect")]
internal static class PhysicsPatch
{
[HarmonyPrefix]
private static void Prefix(PlayerController __instance)
{
BoostRuntime.CorrectPosition(__instance);
}
}
[HarmonyPatch(typeof(PlayerController), "Free")]
internal static class FreePatch
{
[HarmonyPrefix]
private static void Prefix()
{
BoostRuntime.Reset();
}
}
[BepInPlugin("local.dsp.icarusatmosphericboost", "Icarus Atmospheric Boost", "2.1.2")]
[BepInProcess("DSPGAME.exe")]
public sealed class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "local.dsp.icarusatmosphericboost";
public const string PluginName = "Icarus Atmospheric Boost";
public const string PluginVersion = "2.1.2";
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> HoldSeconds;
internal static ConfigEntry<float> LaunchSpeed;
internal static ConfigEntry<float> LockedLaunchSpeed;
internal static ConfigEntry<float> BoostPowerMultiplier;
internal static ConfigEntry<float> LaunchRange;
private Harmony harmony;
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Expected O, but got Unknown
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Expected O, but got Unknown
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Expected O, but got Unknown
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable atmospheric boost.");
HoldSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("General", "HoldSeconds", 0.8f, new ConfigDescription("Minimum time to hold jump before releasing to launch.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>()));
LaunchRange = ((BaseUnityPlugin)this).Config.Bind<float>("General", "LaunchRange", 300f, new ConfigDescription("Maximum height in metres above the planet surface reference radius at release.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 400f), Array.Empty<object>()));
LaunchSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "LaunchSpeed", 300f, new ConfigDescription("Outward speed in m/s after interstellar sailing is unlocked.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 1000f), Array.Empty<object>()));
LockedLaunchSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "LockedLaunchSpeed", 80f, new ConfigDescription("Maximum outward speed before sailing is unlocked. Capped below vanilla sailing altitude.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>()));
BoostPowerMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "BoostPowerMultiplier", 2f, new ConfigDescription("Energy per launch in seconds of vanilla low-altitude hovering. Zero disables the extra cost.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 20f), Array.Empty<object>()));
harmony = new Harmony("local.dsp.icarusatmosphericboost");
harmony.PatchAll(typeof(Plugin).Assembly);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Icarus Atmospheric Boost 2.1.2 loaded. Hold and release jump to launch.");
}
private void Update()
{
BoostRuntime.Refresh((GameMain.mainPlayer == null) ? null : GameMain.mainPlayer.controller);
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
BoostRuntime.Reset();
}
}
}