Decompiled source of SmarterStackSim v1.0.0

plugins/SmarterStackSim/SmarterStackSim.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Game.Core.Simulation;
using HarmonyLib;
using SmarterStackSim.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("SmarterStackSim")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SmarterStackSim")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2dd901f0-1bec-4eed-bb8a-88b74ba90f6d")]
[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 SmarterStackSim
{
	[BepInPlugin("com.equinox.SmarterStackSim", "SmarterStackSim", "1.0.0")]
	public class SmarterStackSimPlugin : BaseUnityPlugin
	{
		internal const string MyGUID = "com.equinox.SmarterStackSim";

		private const string PluginName = "SmarterStackSim";

		private const string VersionString = "1.0.0";

		private static readonly Harmony Harmony = new Harmony("com.equinox.SmarterStackSim");

		internal static ManualLogSource Log = new ManualLogSource("SmarterStackSim");

		private void Awake()
		{
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SmarterStackSim, VersionString: 1.0.0 is loading...");
			ApplyPatches();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: SmarterStackSim, VersionString: 1.0.0 has loaded.");
			Log = ((BaseUnityPlugin)this).Logger;
		}

		private void ApplyPatches()
		{
			Harmony.CreateAndPatchAll(typeof(VirtualStackerSimulationPatch), (string)null);
		}
	}
}
namespace SmarterStackSim.Patches
{
	internal class VirtualStackerSimulationPatch
	{
		[HarmonyPatch(typeof(VirtualStackerSimulation), "Update")]
		[HarmonyPostfix]
		private static void PatchName(VirtualStackerSimulation __instance, Ticks startTicks_T, Ticks deltaTicks_T)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_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_0039: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			int amountOfSignalsThisUpdate = SignalSimulation.GetAmountOfSignalsThisUpdate(startTicks_T, deltaTicks_T);
			SignalTick val = SignalTick.FromTicks(startTicks_T);
			SignalTick val2 = default(SignalTick);
			ISignalValue val3 = default(ISignalValue);
			ISignalValue val4 = default(ISignalValue);
			ShapeDefinition val6 = default(ShapeDefinition);
			ShapeDefinition val7 = default(ShapeDefinition);
			for (int i = 0; i < amountOfSignalsThisUpdate; i++)
			{
				((SignalTick)(ref val2))..ctor(val.Value + i);
				((SignalValueBuffer)__instance.Input0Conductor).TryPopValue(startTicks_T, val2, ref val3);
				((SignalValueBuffer)__instance.Input1Conductor).TryPopValue(startTicks_T, val2, ref val4);
				ISignalValue val5 = (ISignalValue)(object)SignalNullValue.Instance;
				bool flag = SignalValueShapeExtensions.TryConvertToShape(val3, ref val6);
				bool flag2 = SignalValueShapeExtensions.TryConvertToShape(val4, ref val7);
				if (flag == flag2)
				{
					break;
				}
				if (flag)
				{
					val5 = val3;
				}
				if (flag2)
				{
					val5 = val4;
				}
				__instance.OutputConductor.PushValue(val5, startTicks_T, val2);
			}
		}
	}
}