Decompiled source of Random Engines v1.0.2

RandomEngine.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RandomEngine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RandomEngine")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8d80b71c-ebbe-4b41-9c19-5a6d1360ad0b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RandomEngine;

[BepInPlugin("com.comradecheeses.randomengine", "RandomEngine", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
	internal static ConfigFile config;

	internal static ConfigEntry<int> platformForce;

	public void Awake()
	{
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RandomEngine by ComradeCheese loaded!");
		config = ((BaseUnityPlugin)this).Config;
		platformForce = config.Bind<int>("Settings", "Platform Force Range", 300, "Force from -x to x (Max is 5000)");
		if (platformForce.Value < 0)
		{
			platformForce.Value = Math.Abs(platformForce.Value);
		}
		if (platformForce.Value > 5000)
		{
			platformForce.Value = 5000;
		}
		Harmony val = new Harmony("com.comradecheeses.randomengine");
		val.PatchAll(typeof(Patches));
	}
}
internal class Patches
{
	[HarmonyPatch(typeof(RocketEngine), "UpdateSim")]
	[HarmonyPrefix]
	public static void Patch(ref bool ___isEngineOn, ref Fix ___timeSinceEngineStarted, ref BoplBody ___groundBody, ref StickyRoundedRectangle ___srr, ref DPhysicsBox ___hitbox, RocketEngine __instance)
	{
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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_0041: 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)
		//IL_0047: 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_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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: 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_007a: 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_008e: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		___isEngineOn = true;
		___timeSinceEngineStarted = (Fix)1L;
		Vec2 val = ___srr.PositionFromLocalPlayerPos(__instance.LocalPlatformPosition, Fix.Zero);
		Vec2 val2 = ___srr.currentNormal(val);
		Vec2 val3 = __instance.ForceAnim.Evaluate((Fix)1L) * -val2 * ___hitbox.Scale;
		___groundBody.AddForceAtPosition(-val3, val, (ForceMode2D)0);
		int value = Plugin.platformForce.Value;
		Vec2 val4 = default(Vec2);
		((Vec2)(ref val4))..ctor(Updater.RandomFix((Fix)(long)(-value), (Fix)(long)value), Updater.RandomFix((Fix)(long)(-value), (Fix)(long)value));
		___groundBody.AddForceAtPosition(val4, val, (ForceMode2D)0);
	}
}