Decompiled source of IIsUpdatable v2.0.0

IUpdateable.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Mathematics;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("IUpdateable")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("IUpdateable")]
[assembly: AssemblyTitle("IUpdateable")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 IUpdateable
{
	public class Updater_i : MonoBehaviour
	{
		public class UpdatableComparer : IComparer<IUpdatable>
		{
			public int Compare(IUpdatable x, IUpdatable y)
			{
				if (x.GetHashCode() != y.GetHashCode())
				{
					int hierarchyNumber = x.HierarchyNumber;
					int hierarchyNumber2 = y.HierarchyNumber;
				}
				return x.HierarchyNumber - y.HierarchyNumber;
			}
		}

		public static bool LoadedALevelThisUpdate = false;

		public static List<IUpdatable> toDestroyBuffer = new List<IUpdatable>();

		public static List<IUpdatable> updatables = new List<IUpdatable>();

		public static List<IUpdatable> toBeAddedUpdatables = new List<IUpdatable>();

		public static int addedUpdatables = 0;

		public static UpdatableComparer updateComparer = new UpdatableComparer();

		public static List<IUpdatable> toBeAddedPrefab = new List<IUpdatable>();

		public static int prefabsAdded = 0;

		public static bool registeringAPrefab = false;

		public static Random random = new Random(37u);

		public static int hitStopFrames;

		public static Fix standardFixedDeltaTime = (Fix)(1f / 60f);

		public static Fix SimTimePassed = Fix.Zero;

		public static Fix SimTimeSinceLevelLoaded = Fix.Zero;

		public static int SimulationTicks = 0;

		public static bool gameHasStopped = false;

		public bool autoUpdate;

		public float autoUpdateAccum;

		public static int AddedUpdatables => addedUpdatables;

		public static void PreLevelLoad()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = PlayerHandler.Get().PlayerList();
			for (int i = 0; i < list.Count; i++)
			{
				int id = list[i].Id;
				list[i].isProtectedFromTimeStop = false;
				list[i].isInvisible = false;
				list[i].timeSpentInvisible = Fix.Zero;
				list[i].timeSinceEnteredAbility = Fix.Zero;
			}
			GameTime.PlayerTimeScale = (Fix)1L;
			toDestroyBuffer.Clear();
			updatables.Clear();
			toBeAddedUpdatables.Clear();
			toBeAddedPrefab.Clear();
			SimTimeSinceLevelLoaded = Fix.Zero;
		}

		public static void PostLevelLoad()
		{
			LoadedALevelThisUpdate = true;
		}

		public static void DestroyFix(GameObject go)
		{
			go.GetComponentsInChildren<IUpdatable>(true, toDestroyBuffer);
			FixTransform component = go.GetComponent<FixTransform>();
			for (int i = 0; i < toDestroyBuffer.Count; i++)
			{
				toDestroyBuffer[i].IsDestroyed = true;
			}
			if ((Object)(object)component != (Object)null)
			{
				component.IsDestroyed = true;
			}
			Object.Destroy((Object)(object)go);
		}

		public static void DestroyFix(MonoBehaviour mb)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (mb is IUpdatable)
			{
				((IUpdatable)mb).IsDestroyed = true;
			}
			if (mb is FixTransform)
			{
				((FixTransform)mb).IsDestroyed = true;
			}
			Object.Destroy((Object)(object)mb);
		}

		public static void ReInit()
		{
			//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_000b: 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)
			SimTimePassed = Fix.Zero;
			SimTimeSinceLevelLoaded = Fix.Zero;
			SimulationTicks = 0;
			updatables.Clear();
			toBeAddedPrefab.Clear();
			toBeAddedUpdatables.Clear();
			addedUpdatables = 0;
			prefabsAdded = 0;
			registeringAPrefab = false;
		}

		public static void BeginRegisterPrefab()
		{
			registeringAPrefab = true;
		}

		public static void EndRegisterPrefab()
		{
			registeringAPrefab = false;
			for (int i = 0; i < toBeAddedPrefab.Count; i++)
			{
				toBeAddedPrefab[i].HierarchyNumber += prefabsAdded + 100000000;
				toBeAddedUpdatables.Add(toBeAddedPrefab[i]);
			}
			prefabsAdded += toBeAddedPrefab.Count;
			toBeAddedPrefab.Clear();
		}

		public static void RegisterUpdatable(IUpdatable updatable)
		{
			if (registeringAPrefab)
			{
				addedUpdatables++;
				toBeAddedPrefab.Add(updatable);
			}
			else
			{
				addedUpdatables++;
				toBeAddedUpdatables.Add(updatable);
			}
		}

		public static void HitStop(int frames)
		{
			hitStopFrames = frames;
		}

		public static bool InHitstop()
		{
			return hitStopFrames > 0;
		}

		public static void InitSeed(uint seed)
		{
			((Random)(ref random)).InitState(seed);
		}

		public static int RandomInt(int from, int to)
		{
			return ((Random)(ref random)).NextInt(from, to);
		}

		public static Vec2 RandomInsideUnitCircle()
		{
			//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_000b: 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_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_0029: 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)
			return new Vec2(RandomFix(Fix.Zero, Fix.PiTimes2)) * RandomFix(Fix.Zero, Fix.One);
		}

		public static Vec2 RandomUnitVector()
		{
			//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_000b: 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_0015: 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)
			return new Vec2(RandomFix(Fix.Zero, Fix.PiTimes2));
		}

		public static Fix RandomFix(Fix from, Fix to)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_005a: 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_0067: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_0026: 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_0043: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (Fix.Floor(from) == Fix.Floor(to))
			{
				uint num = (uint)(from.m_rawValue & -1);
				uint num2 = (uint)(to.m_rawValue & -1);
				uint num3 = ((Random)(ref random)).NextUInt(num, num2);
				return Fix.FromRaw(Fix.Floor(from).m_rawValue + num3);
			}
			int num4 = (int)(long)Fix.Floor(from);
			int num5 = (int)(long)Fix.Floor(to);
			long num6 = ((Random)(ref random)).NextInt(num4, num5);
			uint num7 = (uint)(from.m_rawValue & -1);
			uint num8 = uint.MaxValue;
			uint num9 = ((Random)(ref random)).NextUInt(num7, num8);
			return Fix.FromRaw((num6 << 32) + num9);
		}

		public static void TickSimulation(Fix deltaTime)
		{
			//IL_0359: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0670: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			//IL_0685: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Unknown result type (might be due to invalid IL or missing references)
			//IL_0727: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_072d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			//IL_0737: Unknown result type (might be due to invalid IL or missing references)
			//IL_073c: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = PlayerHandler.Get().PlayerList();
			if (LoadedALevelThisUpdate)
			{
				gameHasStopped = false;
			}
			if (!TutorialGameHandler.isInTutorial && !GameLobby.isOnlineGame && !gameHasStopped && Host.recordReplay && !GameLobby.isPlayingAReplay)
			{
				if (LoadedALevelThisUpdate || SimulationTicks == 0)
				{
					uint tickCount = (uint)Environment.TickCount;
					InitSeed(tickCount);
					StartRequestPacket val = default(StartRequestPacket);
					val.seed = tickCount;
					val.seqNum = 1;
					val.frameBufferSize = 0;
					val.isDemoMask = byte.MaxValue;
					val.nrOfAbilites = (byte)Settings.Get().NumberOfAbilities;
					val.currentLevel = GameSession.CurrentLevel();
					val.nrOfPlayers = (byte)list.Count;
					StartRequestPacket val2 = val;
					NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
					for (int i = 0; i < list.Count; i++)
					{
						byte b = (byte)abilityIcons.IndexOf(((Object)list[i].Abilities[0]).name);
						switch (list[i].Id)
						{
						case 1:
							val2.p1_color = 1;
							val2.p1_id = 1uL;
							val2.p1_team = (byte)list[i].Team;
							val2.p1_ability1 = b;
							break;
						case 2:
							val2.p2_color = 2;
							val2.p2_id = 2uL;
							val2.p2_team = (byte)list[i].Team;
							val2.p2_ability1 = b;
							break;
						case 3:
							val2.p3_color = 3;
							val2.p3_id = 3uL;
							val2.p3_team = (byte)list[i].Team;
							val2.p3_ability1 = b;
							break;
						case 4:
							val2.p4_color = 4;
							val2.p4_id = 4uL;
							val2.p4_team = (byte)list[i].Team;
							val2.p4_ability1 = b;
							break;
						}
						if (val2.nrOfAbilites > 1)
						{
							b = (byte)abilityIcons.IndexOf(((Object)list[i].Abilities[1]).name);
							switch (list[i].Id)
							{
							case 1:
								val2.p1_ability2 = b;
								break;
							case 2:
								val2.p2_ability2 = b;
								break;
							case 3:
								val2.p3_ability2 = b;
								break;
							case 4:
								val2.p4_ability2 = b;
								break;
							}
						}
						if (val2.nrOfAbilites > 2)
						{
							b = (byte)abilityIcons.IndexOf(((Object)list[i].Abilities[2]).name);
							switch (list[i].Id)
							{
							case 1:
								val2.p1_ability3 = b;
								break;
							case 2:
								val2.p2_ability3 = b;
								break;
							case 3:
								val2.p3_ability3 = b;
								break;
							case 4:
								val2.p4_ability3 = b;
								break;
							}
						}
					}
					SteamManager.instance.EncodeCurrentStartParameters_forReplay(ref SteamManager.instance.networkClient.EncodedStartRequest, val2, true);
				}
				InputPacketQuad val3 = default(InputPacketQuad);
				for (int j = 0; j < list.Count; j++)
				{
					InputPacket val4 = Host.CurrentInputAsPacket(list[j].Id, (uint)(SimulationTicks + 1), (TimedInputPacket[])null);
					switch (list[j].Id)
					{
					case 1:
						val3.p1 = val4;
						break;
					case 2:
						val3.p2 = val4;
						break;
					case 3:
						val3.p3 = val4;
						break;
					case 4:
						val3.p4 = val4;
						break;
					}
				}
				SteamManager instance = SteamManager.instance;
				if ((Object)(object)instance != (Object)null)
				{
					Host networkClient = instance.networkClient;
					if ((Object)(object)networkClient != (Object)null)
					{
						networkClient.RecordReplayFrame(val3);
					}
				}
			}
			for (int k = 0; k < list.Count; k++)
			{
				list[k].UpdateFRAMEDependentInputs();
			}
			for (int num = toBeAddedUpdatables.Count - 1; num >= 0; num--)
			{
				if (toBeAddedUpdatables[num] == null || toBeAddedUpdatables[num].IsDestroyed)
				{
					toBeAddedUpdatables.RemoveAt(num);
				}
			}
			for (int l = 0; l < toBeAddedUpdatables.Count; l++)
			{
				IUpdatable value = toBeAddedUpdatables[l];
				toBeAddedUpdatables[l] = value;
			}
			toBeAddedUpdatables.Sort(updateComparer);
			for (int m = 0; m < toBeAddedUpdatables.Count; m++)
			{
				if (toBeAddedUpdatables[m] != null && !toBeAddedUpdatables[m].IsDestroyed)
				{
					toBeAddedUpdatables[m].Init();
				}
			}
			for (int n = 0; n < toBeAddedUpdatables.Count; n++)
			{
				updatables.Add(toBeAddedUpdatables[n]);
			}
			toBeAddedUpdatables.Clear();
			for (int num2 = updatables.Count - 1; num2 >= 0; num2--)
			{
				if (updatables[num2].IsDestroyed)
				{
					updatables[num2].OnDestroyUpdatable();
					updatables.RemoveAt(num2);
				}
			}
			for (int num3 = 0; num3 < updatables.Count; num3++)
			{
				if (updatables[num3] != null && updatables[num3].IsEnabled())
				{
					updatables[num3].UpdateSim(deltaTime);
				}
			}
			if (LoadedALevelThisUpdate)
			{
				SimTimePassed += deltaTime;
				SimTimeSinceLevelLoaded += deltaTime;
				SimulationTicks++;
				LoadedALevelThisUpdate = false;
				return;
			}
			DetPhysics.Get().Simulate(deltaTime);
			for (int num4 = 0; num4 < updatables.Count; num4++)
			{
				if (updatables[num4] != null && updatables[num4].IsEnabled())
				{
					updatables[num4].LateUpdateSim(deltaTime);
				}
			}
			DetPhysics.Get().VeryLateRopeUpdate();
			DetPhysics.Get().UpdateRopeMesh_parallell();
			SimTimePassed += deltaTime;
			SimTimeSinceLevelLoaded += deltaTime;
			SimulationTicks++;
		}

		public static ulong ComputeChecksum()
		{
			//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_0043: 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_0026: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			FixTransform[] array = Object.FindObjectsOfType<FixTransform>();
			Fix val = Fix.Zero;
			for (int i = 0; i < array.Length; i++)
			{
				if (!array[i].IsDestroyed)
				{
					val = Fix.SlowAdd(val, array[i].ComputeCheckSum());
				}
			}
			return (ulong)val.m_rawValue;
		}

		public static string SerializeState()
		{
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
			FixTransform[] array = Object.FindObjectsOfType<FixTransform>();
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("----------------");
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].IsDestroyed)
				{
					continue;
				}
				IUpdatable[] components = ((Component)array[i]).GetComponents<IUpdatable>();
				if (components != null)
				{
					stringBuilder.Append(((Object)((Component)array[i]).gameObject).name + " hierarchyNumbers = ");
					for (int j = 0; j < components.Length; j++)
					{
						if (components[j].IsDestroyed)
						{
							stringBuilder.Append("[DESTROYED]");
						}
						stringBuilder.Append(components[j].HierarchyNumber);
						stringBuilder.Append(", ");
					}
				}
				else
				{
					stringBuilder.Append(((Object)((Component)array[i]).gameObject).name);
				}
				stringBuilder.Append("\n");
				stringBuilder.Append("posX = ");
				stringBuilder.Append(array[i].position.x);
				stringBuilder.Append(", posY = ");
				stringBuilder.Append(array[i].position.y);
				stringBuilder.Append(", rotation = ");
				stringBuilder.Append(array[i].rotation);
				stringBuilder.AppendLine("----------------");
			}
			return stringBuilder.ToString();
		}

		public void Update()
		{
			//IL_003f: 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_0069: 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_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_0082: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			if (!autoUpdate || GameLobby.isOnlineGame || GameLobby.isPlayingAReplay)
			{
				return;
			}
			autoUpdateAccum += Time.deltaTime;
			while (autoUpdateAccum > 0f)
			{
				autoUpdateAccum -= (float)GameTime.FixedTimeStep;
				if (hitStopFrames > 0)
				{
					hitStopFrames--;
					SimTimePassed += GameTime.FixedTimeStep;
					SimTimeSinceLevelLoaded += GameTime.FixedTimeStep;
					SimulationTicks++;
				}
				else
				{
					TickSimulation(GameTime.FixedTimeStep);
				}
			}
		}
	}
	[BepInPlugin("com.erwer.IUpdateable", "IUpdateable", "2.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.erwer.IUpdateable";

		public const string PLUGIN_NAME = "IUpdateable";

		public const string PLUGIN_VERSION = "2.0.0";

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.erwer.IUpdateable is loaded! Added IUpdateable to game..");
			Harmony val = new Harmony("com.erwer.IUpdateable");
			val.PatchAll(typeof(Patches));
		}
	}
	public class Patches
	{
		[HarmonyPatch(typeof(Updater), "Update")]
		[HarmonyPrefix]
		public static bool Update(Updater __instance)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_008d: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.autoUpdate && !GameLobby.isOnlineGame && !GameLobby.isPlayingAReplay)
			{
				__instance.autoUpdateAccum += Time.deltaTime;
				while (__instance.autoUpdateAccum > 0f)
				{
					__instance.autoUpdateAccum -= (float)GameTime.FixedTimeStep;
					if (Updater.hitStopFrames > 0)
					{
						Updater.hitStopFrames--;
						Updater.SimTimePassed += GameTime.FixedTimeStep;
						Updater.SimTimeSinceLevelLoaded += GameTime.FixedTimeStep;
						Updater.SimulationTicks++;
						Updater_i.hitStopFrames--;
						Updater_i.SimTimePassed += GameTime.FixedTimeStep;
						Updater_i.SimTimeSinceLevelLoaded += GameTime.FixedTimeStep;
						Updater_i.SimulationTicks++;
					}
					else
					{
						Updater.TickSimulation(GameTime.FixedTimeStep);
						Updater_i.TickSimulation(GameTime.FixedTimeStep);
					}
				}
			}
			return true;
		}
	}
	public interface IUpdatable
	{
		bool IsDestroyed { get; set; }

		int HierarchyNumber { get; set; }

		void Init();

		void UpdateSim(Fix SimDeltaTime);

		void LateUpdateSim(Fix SimDeltaTime);

		void OnDestroyUpdatable();

		bool IsEnabled();
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "IUpdateable";

		public const string PLUGIN_NAME = "IUpdateable";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}