Decompiled source of TheLibraryElectric v2.2.0

Mods/TheLibraryElectric.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
using BoneLib;
using BoneLib.Nullables;
using FieldInjector;
using HarmonyLib;
using Il2CppSystem;
using Jevil;
using Jevil.ModStats;
using LabFusion.SDK.Points;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ;
using SLZ.Marrow.Data;
using SLZ.Marrow.Pool;
using SLZ.Marrow.Warehouse;
using SLZ.Rig;
using SLZ.SFX;
using SLZ.VFX;
using SLZ.Vehicle;
using TMPro;
using TheLibraryElectric;
using TheLibraryElectric.Environment;
using TheLibraryElectric.Groups;
using TheLibraryElectric.InternalHelpers;
using TheLibraryElectric.LabFusion;
using TheLibraryElectric.Markers;
using TheLibraryElectric.Marrow;
using TheLibraryElectric.Misc;
using TheLibraryElectric.PlayerUtil;
using TheLibraryElectric.Rigidbodies;
using TheLibraryElectric.Signals;
using TheLibraryElectric.Vehicles;
using TheLibraryElectric.Water;
using UltEvents;
using UnhollowerBaseLib;
using UnhollowerBaseLib.Attributes;
using UnhollowerRuntimeLib;
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("See how IL2CPP breaks the mod.")]
[assembly: AssemblyDescription("See how IL2CPP breaks the mod.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("The Library Electric")]
[assembly: AssemblyCopyright("Developed by CarrionAndOn + BugoBug")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: MelonInfo(typeof(Main), "The Library Electric", "2.2.0", "CarrionAndOn + BugoBug", "https://bonelab.thunderstore.io/package/CarrionAndOn/TheLibraryElectric/")]
[assembly: MelonColor(ConsoleColor.Cyan)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.2.0.0")]
internal enum LoggingMode
{
	NORMAL,
	DEBUG
}
namespace TheLibraryElectric
{
	internal static class FieldInjection
	{
		public static void Inject()
		{
			ModConsole.Msg("Injecting the fields with the fieldinjector which injects fields, crazy isnt it", LoggingMode.DEBUG);
			SerialisationHandler.Inject<DoNotFreeze>(0);
			ModConsole.Msg("Hopefully injected DoNotFreeze", LoggingMode.DEBUG);
			SerialisationHandler.Inject<DoNotDestroy>(0);
			ModConsole.Msg("Hopefully injected DoNotDestroy", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RecieveSignal>(0);
			ModConsole.Msg("Hopefully injected RecieveSignal", LoggingMode.DEBUG);
			SerialisationHandler.Inject<SendSignal>(0);
			ModConsole.Msg("Hopefully injected SendSignal", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RigManagerControl>(0);
			ModConsole.Msg("Hopefully injected RigManagerControl", LoggingMode.DEBUG);
			SerialisationHandler.Inject<FreezeRigidbodies>(0);
			ModConsole.Msg("Hopefully injected FreezeRigidbodies", LoggingMode.DEBUG);
			SerialisationHandler.Inject<DestroyOnCollision>(0);
			ModConsole.Msg("Hopefully injected DestroyOnCollision", LoggingMode.DEBUG);
			SerialisationHandler.Inject<TimescaleController>(0);
			ModConsole.Msg("Hopefully injected TimescaleController", LoggingMode.DEBUG);
			SerialisationHandler.Inject<UpdateTMP>(0);
			ModConsole.Msg("Hopefully injected UpdateTMP", LoggingMode.DEBUG);
			SerialisationHandler.Inject<VoidCounterObject>(0);
			ModConsole.Msg("Hopefully injected VoidCounterObject", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RBGravityManager>(0);
			ModConsole.Msg("Hopefully injected RBGravityManager", LoggingMode.DEBUG);
			SerialisationHandler.Inject<GravityChamber>(0);
			ModConsole.Msg("Hopefully injected GravityChamber", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RagdollZone>(0);
			ModConsole.Msg("Hopefully injected RagdollZone", LoggingMode.DEBUG);
			SerialisationHandler.Inject<ForceZone>(0);
			ModConsole.Msg("Hopefully injected ForceZone", LoggingMode.DEBUG);
			SerialisationHandler.Inject<SpawnOnTriggerEnter>(0);
			ModConsole.Msg("Hopefully injected SpawnOnTriggerEnter", LoggingMode.DEBUG);
			SerialisationHandler.Inject<DespawnPooledObject>(0);
			ModConsole.Msg("Hopefully injected DespawnPooledObject", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RandomAudioPlayer>(0);
			ModConsole.Msg("Hopefully injected RandomAudioPlayer", LoggingMode.DEBUG);
			SerialisationHandler.Inject<IgnoreRigidbody>(0);
			ModConsole.Msg("Hopefully injected IgnoreRigidbody", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RbBuoyancyManager>(0);
			ModConsole.Msg("Hopefully injected RbBuoyancyManager", LoggingMode.DEBUG);
			SerialisationHandler.Inject<WaterZone>(0);
			ModConsole.Msg("Hopefully injected WaterZone", LoggingMode.DEBUG);
			SerialisationHandler.Inject<SignalTrigger>(0);
			ModConsole.Msg("Hopefully injected SignalTrigger", LoggingMode.DEBUG);
			SerialisationHandler.Inject<SignalTriggerer>(0);
			ModConsole.Msg("Hopefully injected SignalTriggerer", LoggingMode.DEBUG);
			SerialisationHandler.Inject<HandMonitor>(0);
			ModConsole.Msg("Hopefully injected HandMonitor", LoggingMode.DEBUG);
			SerialisationHandler.Inject<SwimmingController>(0);
			ModConsole.Msg("Hopefully injected SwimmingController", LoggingMode.DEBUG);
			SerialisationHandler.Inject<InvokeIfLibInstalled>(0);
			ModConsole.Msg("Hopefully injected InvokeIfLibInstalled", LoggingMode.DEBUG);
			SerialisationHandler.Inject<DrowningManager>(0);
			ModConsole.Msg("Hopefully injected DrowningManager", LoggingMode.DEBUG);
			SerialisationHandler.Inject<BitShop>(0);
			ModConsole.Msg("Hopefully injected BitShop", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RagdollOnCollide>(0);
			ModConsole.Msg("Hopefully injected RagdollOnCollide", LoggingMode.DEBUG);
			SerialisationHandler.Inject<InvokeWhenCounter>(0);
			ModConsole.Msg("Hopefully injected InvokeWhenCounter", LoggingMode.DEBUG);
			SerialisationHandler.Inject<PhotonThruster>(0);
			ModConsole.Msg("Hopefully injected PhotonThruster", LoggingMode.DEBUG);
			SerialisationHandler.Inject<GroupProxy>(0);
			ModConsole.Msg("Hopefully injected GroupProxy", LoggingMode.DEBUG);
			SerialisationHandler.Inject<GroupIdentifier>(0);
			ModConsole.Msg("Hopefully injected GroupIdenifier", LoggingMode.DEBUG);
			SerialisationHandler.Inject<TLE_SimpleRaycast>(0);
			ModConsole.Msg("Hopefully injected TLE_SimpleRaycast", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RbSpeedMeter>(0);
			ModConsole.Msg("Hopefully injected RbSpeedMeter", LoggingMode.DEBUG);
			SerialisationHandler.Inject<ScoreKeeper>(0);
			ModConsole.Msg("Hopefully injected ScoreKeeper", LoggingMode.DEBUG);
			SerialisationHandler.Inject<RealtimeAnalogClock>(0);
			ModConsole.Msg("Hopefully injected RealtimeAnalogClock", LoggingMode.DEBUG);
			SerialisationHandler.Inject<CoolerSpawnablePlacer>(0);
			ModConsole.Msg("Hopefully injected CoolerSpawnablePlacer", LoggingMode.DEBUG);
			SerialisationHandler.Inject<Boat>(0);
			ModConsole.Msg("Hopefully injected Boat", LoggingMode.DEBUG);
			SerialisationHandler.Inject<TimeCycleHandler>(0);
			ModConsole.Msg("Hopefully injected TimeCycleHandler", LoggingMode.DEBUG);
			ModConsole.Msg("All fields are probably injected. I can't tell since this isn't async so I can't slap a bool on it.", LoggingMode.DEBUG);
		}
	}
	internal static class ModConsole
	{
		private static Instance logger;

		public static void Setup(Instance logger)
		{
			ModConsole.logger = logger;
		}

		public static void Msg(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == LoggingMode.DEBUG) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(consoleColor, text, args);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Msg(txtcolor, text, args);
			}
		}

		public static void Error(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text);
			}
		}

		public static void Error(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text);
			}
		}

		public static void Error(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Error(text, args);
			}
		}

		public static void Warning(object obj, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? $"[DEBUG] {obj}" : obj.ToString());
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text);
			}
		}

		public static void Warning(string txt, LoggingMode loggingMode = LoggingMode.NORMAL)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text);
			}
		}

		public static void Warning(string txt, LoggingMode loggingMode = LoggingMode.NORMAL, params object[] args)
		{
			string text = ((loggingMode == LoggingMode.DEBUG) ? ("[DEBUG] " + txt) : txt);
			if ((LoggingMode)Preferences.loggingMode >= loggingMode)
			{
				logger.Warning(text, args);
			}
		}
	}
	public class ModPref<T>
	{
		public MelonPreferences_Entry<T> entry { get; }

		public ModPref(MelonPreferences_Category category, string identifier, T default_value, string display_name = null, string description = null, bool is_hidden = false, bool dont_save_default = false, ValueValidator validator = null)
		{
			entry = category.CreateEntry<T>(identifier, default_value, display_name, description, is_hidden, dont_save_default, validator);
		}

		public static implicit operator T(ModPref<T> m)
		{
			return m.entry.Value;
		}
	}
	internal static class Preferences
	{
		private static MelonPreferences_Category category = MelonPreferences.CreateCategory("The Library Electric");

		public static ModPref<LoggingMode> loggingMode;

		public static void Setup()
		{
			loggingMode = new ModPref<LoggingMode>(category, "LoggingMode", LoggingMode.NORMAL);
			category.SaveToFile(false);
			ModConsole.Msg("Finished preferences setup", LoggingMode.DEBUG);
		}
	}
	internal class ModStats
	{
		public static async Task IncrementLaunch()
		{
			string prefix = (Utilities.IsPlatformQuest() ? "Quest" : "PCVR");
			ModConsole.Msg("Sending stats request for " + prefix + " platform launch!");
			ModConsole.Msg("Sending stats request for " + prefix + " platform launch " + ((await StatsEntry.IncrementValueAsync("TheLibraryElectric", prefix + "Launches")) ? "succeeded" : "failed"));
		}

		public static async Task IncrementUser()
		{
			string prefix = (Utilities.IsPlatformQuest() ? "Quest" : "PCVR");
			ModConsole.Msg("Sending stats request for " + prefix + " platform user!");
			ModConsole.Msg("Sending stats request for " + prefix + " platform user " + ((await StatsEntry.IncrementValueAsync("TheLibraryElectric", prefix + "Users")) ? "succeeded" : "failed"));
		}
	}
	public class ElectricBehaviour : MonoBehaviour
	{
		private Transform _transform;

		private bool _hasTransform = false;

		public Transform Transform
		{
			get
			{
				if (!_hasTransform)
				{
					_transform = ((Component)this).transform;
					_hasTransform = true;
				}
				return _transform;
			}
		}

		public ElectricBehaviour(IntPtr intPtr)
			: base(intPtr)
		{
		}
	}
	public class Main : MelonMod
	{
		internal const string Name = "The Library Electric";

		internal const string Description = "See how IL2CPP breaks the mod.";

		internal const string Author = "CarrionAndOn + BugoBug";

		internal const string Company = "Weather Electric";

		internal const string Version = "2.2.0";

		internal const string DownloadLink = "https://bonelab.thunderstore.io/package/CarrionAndOn/TheLibraryElectric/";

		public override void OnInitializeMelon()
		{
			ModConsole.Setup(((MelonBase)this).LoggerInstance);
			Preferences.Setup();
			FieldInjection.Inject();
			ModConsole.Msg("Doing Jevillib stuff", LoggingMode.DEBUG);
		}

		public override void OnLateInitializeMelon()
		{
			Thread thread = new Thread((ThreadStart)async delegate
			{
				await ModStats.IncrementLaunch();
				if (!PlayerPrefs.HasKey("TheLibraryElectricLaunch"))
				{
					await ModStats.IncrementUser();
				}
				PlayerPrefs.TrySetInt("TheLibraryElectricLaunch", 1);
			});
			thread.Start();
		}
	}
}
namespace TheLibraryElectric.Patching
{
	public static class VoidCounterPatch
	{
		[HarmonyPatch(typeof(RigidbodyProjectile), "OnCollisionEnter")]
		public class VoidCounterPatch_Patch
		{
			[HarmonyPrefix]
			public static bool Prefix(AssetPoolee __instance, Collision c)
			{
				//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_002b: 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_0044: Expected O, but got Unknown
				if ((Object)(object)c.gameObject.GetComponentInParent<VoidCounterObject>() != (Object)null)
				{
					PhysicMaterial material = new PhysicMaterial
					{
						bounciness = 1f,
						dynamicFriction = 0.2f,
						staticFriction = 0.5f
					};
					Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(((Component)__instance).GetComponentsInChildren<Collider>());
					Collider[] array2 = array;
					foreach (Collider val in array2)
					{
						val.material = material;
					}
					if ((Object)(object)((Component)__instance).gameObject.GetComponent<Rigidbody>() != (Object)null)
					{
						((Component)__instance).gameObject.GetComponent<Rigidbody>().mass = 0.1f;
					}
					if (c.gameObject.GetComponentInParent<VoidCounterObject>().disableDespsawnDelay && (Object)(object)((Component)__instance).gameObject.GetComponent<DisableDelay>() != (Object)null)
					{
						DisableDelay[] array3 = Il2CppArrayBase<DisableDelay>.op_Implicit(((Component)__instance).gameObject.GetComponentsInChildren<DisableDelay>());
						DisableDelay[] array4 = array3;
						foreach (DisableDelay val2 in array4)
						{
							Object.Destroy((Object)(object)val2);
						}
					}
					return false;
				}
				return true;
			}
		}
	}
}
namespace TheLibraryElectric.Water
{
	public class DrowningManager : MonoBehaviour
	{
		public float timeUntilDrowning = 20f;

		public float damageInterval = 1f;

		public float damagePercentage = 0.1f;

		private RigManager _rigManager;

		private bool _isDrowning = false;

		private float _timeInsideWater = 0f;

		private float _methodCallTimer = 0f;

		private void OnTriggerEnter(Collider other)
		{
			_rigManager = ((Component)other).GetComponentInParent<RigManager>();
			if ((Object)(object)_rigManager != (Object)null)
			{
				_isDrowning = true;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			_isDrowning = false;
			_timeInsideWater = 0f;
		}

		private void FixedUpdate()
		{
			if (_isDrowning)
			{
				CheckTimeInWater();
			}
		}

		private void CheckTimeInWater()
		{
			_timeInsideWater += Time.deltaTime;
			if (_timeInsideWater >= timeUntilDrowning)
			{
				RepeatDrownMethod();
			}
		}

		private void RepeatDrownMethod()
		{
			_methodCallTimer += Time.deltaTime;
			if (_methodCallTimer >= damageInterval)
			{
				Drown();
				_methodCallTimer = 0f;
			}
		}

		private void Drown()
		{
			float num = _rigManager.health.max_Health * damagePercentage;
			_rigManager.health.TAKEDAMAGE(num);
		}

		public DrowningManager(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class HandMonitor : MonoBehaviour
	{
		public Vector3 handVelocity;

		public RigManager rigManager;

		public float minimumVelocity;

		public float velocityMultiplier;

		private Rigidbody handRb;

		private void Start()
		{
			handRb = ((Component)this).GetComponent<Rigidbody>();
		}

		private void FixedUpdate()
		{
			//IL_0008: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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)
			handVelocity = handRb.velocity - ((Component)((Rig)rigManager.physicsRig).m_chest).GetComponent<Rigidbody>().velocity;
			if (((Vector3)(ref handVelocity)).sqrMagnitude > minimumVelocity)
			{
				((Component)((Rig)rigManager.physicsRig).m_head).GetComponent<Rigidbody>().AddRelativeForce(new Vector3(0f, 0f, ((Vector3)(ref handVelocity)).sqrMagnitude * velocityMultiplier));
				Vector3 velocity = ((Component)((Rig)rigManager.physicsRig).m_chest).GetComponent<Rigidbody>().velocity;
				ModConsole.Msg("Chest velocity: " + ((object)(Vector3)(ref velocity)).ToString() + "e: " + ((Vector3)(ref handVelocity)).sqrMagnitude * 1000f, LoggingMode.DEBUG);
			}
		}

		public HandMonitor(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class IgnoreRigidbody : MonoBehaviour
	{
		public IgnoreRigidbody(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RbBuoyancyManager : MonoBehaviour
	{
		public Rigidbody thisRb;

		public float buoyancyMultiplier;

		public float midpoint;

		public bool midpointSink;

		public bool dampening;

		public float dampeningAmount;

		[NonSerialized]
		internal Action<RbBuoyancyManager> onDestroyed = null;

		private void Start()
		{
			thisRb = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)thisRb != (Object)null)
			{
				thisRb.useGravity = false;
			}
		}

		private void OnDisable()
		{
			if ((Object)(object)thisRb != (Object)null)
			{
				thisRb.useGravity = true;
			}
			Object.Destroy((Object)(object)this);
		}

		private void OnDestroy()
		{
			onDestroyed?.Invoke(this);
		}

		private void FixedUpdate()
		{
			//IL_0064: 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_0080: 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_00a5: 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)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: 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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)thisRb != (Object)null && thisRb.useGravity)
			{
				thisRb.useGravity = false;
			}
			Vector3 gravity;
			if ((Object)(object)thisRb != (Object)null && thisRb.mass < midpoint)
			{
				float mass = thisRb.mass;
				gravity = Physics.gravity;
				float num = mass + ((Vector3)(ref gravity)).magnitude * buoyancyMultiplier;
				thisRb.AddForce(Vector3.up * num);
				if (dampening)
				{
					Rigidbody obj = thisRb;
					obj.velocity *= dampeningAmount;
				}
			}
			if ((Object)(object)thisRb != (Object)null && thisRb.mass > midpoint)
			{
				float mass2 = thisRb.mass;
				gravity = Physics.gravity;
				float num2 = mass2 + ((Vector3)(ref gravity)).magnitude * buoyancyMultiplier;
				thisRb.AddForce(Vector3.down * num2);
				if (dampening)
				{
					Rigidbody obj2 = thisRb;
					obj2.velocity *= dampeningAmount;
				}
			}
			if (!((Object)(object)thisRb != (Object)null) || thisRb.mass != midpoint)
			{
				return;
			}
			if (midpointSink)
			{
				float mass3 = thisRb.mass;
				gravity = Physics.gravity;
				float num3 = mass3 + ((Vector3)(ref gravity)).magnitude * buoyancyMultiplier;
				thisRb.AddForce(Vector3.down * num3);
				if (dampening)
				{
					Rigidbody obj3 = thisRb;
					obj3.velocity *= dampeningAmount;
				}
			}
			if (!midpointSink)
			{
				float mass4 = thisRb.mass;
				gravity = Physics.gravity;
				float num4 = mass4 + ((Vector3)(ref gravity)).magnitude * buoyancyMultiplier;
				thisRb.AddForce(Vector3.up * num4);
				if (dampening)
				{
					Rigidbody obj4 = thisRb;
					obj4.velocity *= dampeningAmount;
				}
			}
		}

		public RbBuoyancyManager(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SwimmingController : MonoBehaviour
	{
		public RigManager rigManager;

		public float minimumVelocity = 10f;

		public float velocityMultiplier = 100f;

		private void OnTriggerEnter(Collider other)
		{
			rigManager = ((Component)other).GetComponentInParent<RigManager>();
			if ((Object)(object)rigManager != (Object)null)
			{
				ModConsole.Msg("SwimmingController: RigManager found!", LoggingMode.DEBUG);
				if ((Object)(object)((Component)rigManager.physicsRig.leftHand).GetComponent<HandMonitor>() == (Object)null)
				{
					HandMonitor handMonitor = ((Component)rigManager.physicsRig.leftHand).gameObject.AddComponent<HandMonitor>();
					handMonitor.rigManager = rigManager;
					handMonitor.minimumVelocity = minimumVelocity;
				}
				if ((Object)(object)((Component)rigManager.physicsRig.rightHand).GetComponent<HandMonitor>() == (Object)null)
				{
					HandMonitor handMonitor2 = ((Component)rigManager.physicsRig.rightHand).gameObject.AddComponent<HandMonitor>();
					handMonitor2.rigManager = rigManager;
					handMonitor2.minimumVelocity = minimumVelocity;
					handMonitor2.velocityMultiplier = velocityMultiplier;
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			rigManager = ((Component)other).GetComponentInParent<RigManager>();
			if ((Object)(object)rigManager != (Object)null && (Object)(object)((Component)rigManager.physicsRig.leftHand).GetComponent<HandMonitor>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)rigManager.physicsRig.leftHand).GetComponent<HandMonitor>());
			}
			if ((Object)(object)rigManager != (Object)null && (Object)(object)((Component)rigManager.physicsRig.rightHand).GetComponent<HandMonitor>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)rigManager.physicsRig.rightHand).GetComponent<HandMonitor>());
			}
		}

		public SwimmingController(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class WaterZone : MonoBehaviour
	{
		public List<RbBuoyancyManager> inTriggerCol = new List<RbBuoyancyManager>();

		public float buoyancyMultiplier = 1f;

		public float midpoint = 50f;

		public bool midpointSink = true;

		public bool dampening = true;

		public float dampeningAmount = 0.98f;

		public bool ignoreRigManager;

		private void OnTriggerEnter(Collider other)
		{
			Rigidbody attachedRigidbody = other.attachedRigidbody;
			if (!((Object)(object)attachedRigidbody != (Object)null) || !((Object)(object)((Component)attachedRigidbody).GetComponent<RbBuoyancyManager>() == (Object)null) || ((Object)(object)((Component)other).GetComponentInParent<RigManager>() != (Object)null && ignoreRigManager))
			{
				return;
			}
			RbBuoyancyManager rbBuoyancyManager = ((Component)attachedRigidbody).gameObject.AddComponent<RbBuoyancyManager>();
			if ((Object)(object)((Component)other).GetComponentInParent<IgnoreRigidbody>() != (Object)null)
			{
				return;
			}
			rbBuoyancyManager.dampening = dampening;
			rbBuoyancyManager.buoyancyMultiplier = buoyancyMultiplier;
			rbBuoyancyManager.midpoint = midpoint;
			rbBuoyancyManager.dampeningAmount = dampeningAmount;
			rbBuoyancyManager.midpointSink = midpointSink;
			rbBuoyancyManager.onDestroyed = OnBuoyancyManagerDestroyed;
			Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)attachedRigidbody).GetComponentsInChildren<Rigidbody>(true));
			Rigidbody[] array2 = array;
			foreach (Rigidbody val in array2)
			{
				if (val.isKinematic && (Object)(object)((Component)val).GetComponent<RbBuoyancyManager>() == (Object)null)
				{
					RbBuoyancyManager rbBuoyancyManager2 = ((Component)val).gameObject.AddComponent<RbBuoyancyManager>();
					rbBuoyancyManager2.buoyancyMultiplier = buoyancyMultiplier;
					rbBuoyancyManager2.dampening = dampening;
					rbBuoyancyManager2.midpoint = midpoint;
					rbBuoyancyManager2.dampeningAmount = dampeningAmount;
					rbBuoyancyManager2.midpointSink = midpointSink;
				}
			}
			inTriggerCol.Add(rbBuoyancyManager);
		}

		private void OnTriggerExit(Collider other)
		{
			Rigidbody attachedRigidbody = other.attachedRigidbody;
			RbBuoyancyManager rbBuoyancyManager = null;
			if ((Object)(object)attachedRigidbody != (Object)null)
			{
				rbBuoyancyManager = ((Component)attachedRigidbody).GetComponent<RbBuoyancyManager>();
			}
			if (!inTriggerCol.Contains(rbBuoyancyManager))
			{
				return;
			}
			attachedRigidbody.useGravity = true;
			Object.Destroy((Object)(object)rbBuoyancyManager);
			Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)attachedRigidbody).GetComponentsInChildren<Rigidbody>(true));
			Rigidbody[] array2 = array;
			foreach (Rigidbody val in array2)
			{
				if (val.isKinematic && (Object)(object)((Component)val).GetComponent<RbBuoyancyManager>() != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)val).GetComponent<RbBuoyancyManager>());
				}
			}
		}

		[HideFromIl2Cpp]
		private void OnBuoyancyManagerDestroyed(RbBuoyancyManager manager)
		{
			inTriggerCol.Remove(manager);
		}

		private void Update()
		{
			foreach (RbBuoyancyManager item in inTriggerCol)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.buoyancyMultiplier = buoyancyMultiplier;
					item.dampening = dampening;
					item.midpoint = midpoint;
					item.dampeningAmount = dampeningAmount;
					item.midpointSink = midpointSink;
				}
			}
		}

		public WaterZone(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Vehicles
{
	public class Boat : MonoBehaviour
	{
		public MotorSFX motorSFX;

		public ParticleSystem[] Particles;

		public int ParticleCount = 5;

		public float DelayBetweenParticles = 0.1f;

		public float RandomVariance = 0.05f;

		public float WaterCheckDelay = 1f;

		public Rigidbody[] Bodiestocheck;

		public Seat DriverSeat;

		public Transform SteeringWheel;

		public Vector2 WheelMinMaxAngle;

		public bool CanReverse;

		public Transform[] Rudders;

		public Vector2 RudderMinMaxAngle;

		public Rigidbody BodyToAccelerate;

		public Rigidbody[] Propellers;

		public float PropellerForce;

		public Transform Speedometer;

		public float MaxSpeedometerRotation;

		public float Speed = 100f;

		public float MaxSpeed = 15f;

		public float MaxTurn = 100f;

		public float MotorAccel = 15f;

		public float DecelMultiplier = 2f;

		public float ReverseMultiplier = 0.5f;

		private BaseController _Controller;

		private bool _IsPlayerIn = false;

		private float _JoystickY;

		private float _SteeringY;

		private float _SteeringRudderRatio = 1f;

		private float _MotorStrength;

		private float _TimeCounter;

		private bool _IsInWater;

		private float _TimerChecks;

		private float _CurrentDelay = 0f;

		private float _LastSpeed;

		private void Start()
		{
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			Seat driverSeat = DriverSeat;
			driverSeat.RegisteredEvent += DelegateSupport.ConvertDelegate<Action>((Delegate)new Action(SeatEnter));
			Seat driverSeat2 = DriverSeat;
			driverSeat2.DeRegisteredEvent += DelegateSupport.ConvertDelegate<Action>((Delegate)new Action(SeatExit));
			_CurrentDelay = DelayBetweenParticles + Random.Range(0f - RandomVariance, RandomVariance);
			ModConsole.Msg("Getting absolute of should-be-positive-values", LoggingMode.DEBUG);
			ReverseMultiplier = Math.Abs(ReverseMultiplier);
			DecelMultiplier = Math.Abs(DecelMultiplier);
			MotorAccel = Math.Abs(MotorAccel);
			MaxSpeed = Math.Abs(MaxSpeed);
			WaterCheckDelay = Math.Abs(WaterCheckDelay);
			ParticleCount = Math.Abs(ParticleCount);
			if ((Object)(object)DriverSeat == (Object)null)
			{
				ModConsole.Error("Driver seat is null. Can't fix!");
			}
			if ((Object)(object)motorSFX == (Object)null)
			{
				ModConsole.Error("Motor SFX is null! Fixing...", LoggingMode.DEBUG);
				motorSFX = ((Component)this).gameObject.AddComponent<MotorSFX>();
			}
			if ((Object)(object)Speedometer == (Object)null)
			{
				ModConsole.Error("Speedometer is null! Disabling...", LoggingMode.DEBUG);
				MaxSpeedometerRotation = 0f;
			}
			if ((Object)(object)SteeringWheel == (Object)null)
			{
				ModConsole.Error("Steering wheel is null! Expect errors, fixing anyway...");
				SteeringWheel = new GameObject().transform;
				SteeringWheel.parent = ((Component)this).transform;
			}
			if ((Object)(object)BodyToAccelerate == (Object)null)
			{
				ModConsole.Msg("Body to accelerate is null! Trying to grab from this object...");
				Rigidbody component = ((Component)this).gameObject.GetComponent<Rigidbody>();
				if ((Object)(object)component == (Object)null)
				{
					ModConsole.Msg("Couldn't find Rigidbody, adding one with some basic values...");
					BodyToAccelerate = ((Component)this).gameObject.AddComponent<Rigidbody>();
					BodyToAccelerate.mass = Speed;
				}
				else
				{
					ModConsole.Msg("Found a Rigidbody", LoggingMode.DEBUG);
					BodyToAccelerate = component;
				}
			}
		}

		private void Update()
		{
			//IL_0013: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			if (_IsPlayerIn)
			{
				_JoystickY = _Controller.GetThumbStickAxis().y;
			}
			else
			{
				_JoystickY = 0f;
			}
			if (_JoystickY * 100f < _MotorStrength)
			{
				_MotorStrength -= MotorAccel * DecelMultiplier * Time.deltaTime;
			}
			if (_JoystickY * 100f > _MotorStrength)
			{
				_MotorStrength += MotorAccel * Time.deltaTime;
			}
			if (CanReverse)
			{
				Mathf.Clamp(_MotorStrength, -100f, 100f);
			}
			Mathf.Clamp(_MotorStrength, 0f, 100f);
			_SteeringY = SteeringWheel.rotation.y;
			_SteeringRudderRatio = (RudderMinMaxAngle.y - RudderMinMaxAngle.x) / (WheelMinMaxAngle.y - WheelMinMaxAngle.x);
			Quaternion rotation;
			if (Rudders.Length != 0)
			{
				Transform[] rudders = Rudders;
				foreach (Transform val in rudders)
				{
					rotation = val.rotation;
					val.Rotate(0f, 0f - ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
					val.Rotate(0f, _SteeringY * _SteeringRudderRatio, 0f);
				}
			}
			if (MaxSpeedometerRotation != 0f)
			{
				Transform speedometer = Speedometer;
				rotation = Speedometer.rotation;
				speedometer.Rotate(0f, 0f - ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
				Speedometer.Rotate(0f, MaxSpeedometerRotation / 100f * (MaxSpeed / Vector3.Dot(((Component)BodyToAccelerate).transform.forward, BodyToAccelerate.velocity) * 100f), 0f);
			}
			if (_TimeCounter > _CurrentDelay)
			{
				_TimeCounter = 0f;
				_CurrentDelay = DelayBetweenParticles + Random.Range(0f - RandomVariance, RandomVariance);
				if (_IsInWater && Particles.Length != 0)
				{
					ParticleSystem[] particles = Particles;
					foreach (ParticleSystem val2 in particles)
					{
						val2.Emit(ParticleCount);
					}
				}
			}
			else
			{
				_TimeCounter += Time.deltaTime;
			}
		}

		private void FixedUpdate()
		{
			//IL_0061: 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_0098: 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)
			//IL_00c2: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			if (Math.Sign(_MotorStrength) == -1)
			{
				BodyToAccelerate.AddRelativeForce(new Vector3(0f, 0f, _MotorStrength * Speed * DecelMultiplier));
			}
			BodyToAccelerate.AddRelativeForce(new Vector3(0f, 0f, _MotorStrength * Speed));
			BodyToAccelerate.velocity = new Vector3(Mathf.Clamp(BodyToAccelerate.velocity.x, float.MinValue, MaxSpeed), BodyToAccelerate.velocity.y, Mathf.Clamp(BodyToAccelerate.velocity.z, float.MinValue, MaxSpeed));
			if (!(-10f < _SteeringY) || !(_SteeringY < 10f))
			{
				BodyToAccelerate.AddRelativeTorque(new Vector3(0f, MaxTurn / 100f * _SteeringY / (WheelMinMaxAngle.y - WheelMinMaxAngle.x) / 100f, 0f));
			}
			if (Propellers.Length != 0)
			{
				Rigidbody[] propellers = Propellers;
				foreach (Rigidbody val in propellers)
				{
					val.AddRelativeForce(new Vector3(0f, PropellerForce * _MotorStrength, 0f));
				}
			}
			if (_TimerChecks > WaterCheckDelay)
			{
				_TimerChecks = 0f;
				if (Bodiestocheck.Length != 0)
				{
					int num = 0;
					Rigidbody[] bodiestocheck = Bodiestocheck;
					foreach (Rigidbody val2 in bodiestocheck)
					{
						RbBuoyancyManager component = ((Component)val2).gameObject.GetComponent<RbBuoyancyManager>();
						if (Object.op_Implicit((Object)(object)component))
						{
							num++;
						}
					}
					if (num > 0)
					{
						_IsInWater = true;
					}
					else
					{
						_IsInWater = false;
					}
				}
				else if ((Object)(object)((Component)BodyToAccelerate).gameObject.GetComponent<RbBuoyancyManager>() != (Object)null)
				{
					_IsInWater = true;
				}
				else
				{
					_IsInWater = false;
				}
			}
			else
			{
				_TimerChecks += Time.fixedDeltaTime;
			}
			float num2 = Vector3.Dot(((Component)BodyToAccelerate).transform.forward, BodyToAccelerate.velocity);
			motorSFX.UpdateMotor(num2, (num2 - _LastSpeed) / Time.fixedDeltaTime, Math.Abs(_MotorStrength));
			_LastSpeed = num2;
		}

		private void OnDisable()
		{
			_IsPlayerIn = false;
		}

		private void SeatEnter()
		{
			motorSFX.StartMotor();
			_IsPlayerIn = true;
			if (DriverSeat.rigManager.ControllerRig.isRightHanded)
			{
				_Controller = DriverSeat.rigManager.ControllerRig.rightController;
			}
			else
			{
				_Controller = DriverSeat.rigManager.ControllerRig.leftController;
			}
		}

		private void SeatExit()
		{
			motorSFX.StopMotor();
			_Controller = null;
			_IsPlayerIn = false;
			_JoystickY = 0f;
		}

		public Boat(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RbSpeedMeter : MonoBehaviour
	{
		public Rigidbody targetRigidbody;

		public TextMeshPro speedText;

		public string speedFormat = "Speed: {0:0.00} m/s";

		private void FixedUpdate()
		{
			//IL_0018: 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)
			if ((Object)(object)targetRigidbody != (Object)null)
			{
				Vector3 velocity = targetRigidbody.velocity;
				float magnitude = ((Vector3)(ref velocity)).magnitude;
				((TMP_Text)speedText).text = string.Format(speedFormat, magnitude);
			}
		}

		public RbSpeedMeter(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Signals
{
	public class RecieveSignal : MonoBehaviour
	{
		public string activationKey;

		private void Start()
		{
			ModConsole.Msg("Reciever spawned, key is " + activationKey, LoggingMode.DEBUG);
		}

		public void InvokeEvent()
		{
			UltEventHolder component = ((Component)this).GetComponent<UltEventHolder>();
			component.Invoke();
		}

		public RecieveSignal(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SendSignal : MonoBehaviour
	{
		public string activationKey;

		public void Broadcast()
		{
			ModConsole.Msg("Fun fact! Reciever is spelled wrong in every log bit, and in the component. I'm not fixing it.", LoggingMode.DEBUG);
			ModConsole.Msg("Broadcasting", LoggingMode.DEBUG);
			ModConsole.Msg("Finding recievers", LoggingMode.DEBUG);
			RecieveSignal[] array = Il2CppArrayBase<RecieveSignal>.op_Implicit(Object.FindObjectsOfType<RecieveSignal>());
			ModConsole.Msg("Got recievers", LoggingMode.DEBUG);
			RecieveSignal[] array2 = array;
			foreach (RecieveSignal recieveSignal in array2)
			{
				ModConsole.Msg("Finding recievers again", LoggingMode.DEBUG);
				RecieveSignal component = ((Component)recieveSignal).gameObject.GetComponent<RecieveSignal>();
				ModConsole.Msg("Reciever gameobject is " + ((Object)((Component)component).gameObject).name, LoggingMode.DEBUG);
				ModConsole.Msg("Sender key is " + activationKey + ", reciever key is " + component.activationKey, LoggingMode.DEBUG);
				if (activationKey == component.activationKey)
				{
					ModConsole.Msg("Calling reciever's invoke method", LoggingMode.DEBUG);
					recieveSignal.InvokeEvent();
				}
				else
				{
					ModConsole.Msg("Could not find reciever's key, or key was not the same as sender's", LoggingMode.DEBUG);
				}
			}
		}

		public SendSignal(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SignalTrigger : MonoBehaviour
	{
		public UltEvent triggerEnterEvent;

		public UltEvent triggerExitEvent;

		public string activationKey;

		private void Start()
		{
			ModConsole.Msg("SignalTrigger spawned, key is " + activationKey, LoggingMode.DEBUG);
		}

		private void OnTriggerEnter(Collider other)
		{
			SignalTriggerer component = ((Component)other).GetComponent<SignalTriggerer>();
			if ((Object)(object)component != (Object)null)
			{
				if (component.activationKey == activationKey)
				{
					ModConsole.Msg("Trigger's key is " + activationKey + ", triggerer's key is " + component.activationKey, LoggingMode.DEBUG);
					triggerEnterEvent.Invoke();
					ModConsole.Msg("Invoked event", LoggingMode.DEBUG);
				}
				else
				{
					ModConsole.Msg("Object is not a triggerer, or is not the right key.", LoggingMode.DEBUG);
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			SignalTriggerer component = ((Component)other).GetComponent<SignalTriggerer>();
			if ((Object)(object)component != (Object)null)
			{
				if (component.activationKey == activationKey)
				{
					ModConsole.Msg("Trigger's key is " + activationKey + ", triggerer's key is " + component.activationKey, LoggingMode.DEBUG);
					triggerExitEvent.Invoke();
					ModConsole.Msg("Invoked event", LoggingMode.DEBUG);
				}
				else
				{
					ModConsole.Msg("Object is not a triggerer, or is not the right key.", LoggingMode.DEBUG);
				}
			}
		}

		public SignalTrigger(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SignalTriggerer : MonoBehaviour
	{
		public string activationKey;

		public void Start()
		{
			ModConsole.Msg("SignalTriggerer spawned, key is " + activationKey, LoggingMode.DEBUG);
		}

		public SignalTriggerer(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Rigidbodies
{
	public class ForceZone : MonoBehaviour
	{
		public List<Rigidbody> inTriggerRbs = new List<Rigidbody>();

		public Vector3 forceAmount;

		public Vector3 ForceAmount
		{
			get
			{
				//IL_0002: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				return forceAmount;
			}
			set
			{
				//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)
				forceAmount = value;
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null)
			{
				inTriggerRbs.Add(other.attachedRigidbody);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if ((Object)(object)other.attachedRigidbody != (Object)null && inTriggerRbs.Contains(other.attachedRigidbody))
			{
				inTriggerRbs.Remove(other.attachedRigidbody);
			}
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			foreach (Rigidbody inTriggerRb in inTriggerRbs)
			{
				inTriggerRb.AddForce(forceAmount, (ForceMode)0);
			}
		}

		public ForceZone(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class FreezeRigidbodies : MonoBehaviour
	{
		private GameObject rigManager;

		private void Start()
		{
			GameObject val = GameObject.Find("[RigManager (Blank)]");
			ModConsole.Msg("Got rigmanager", LoggingMode.DEBUG);
			rigManager = val;
			Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>());
			ModConsole.Msg("Got rigidbodies", LoggingMode.DEBUG);
			Rigidbody[] array2 = array;
			foreach (Rigidbody val2 in array2)
			{
				ModConsole.Msg("Giving existing kinematic RBs DoNotFreeze", LoggingMode.DEBUG);
				if (!((Object)(object)((Component)val2).gameObject.GetComponent<DoNotFreeze>() != (Object)null) && !((Component)val2).transform.IsChildOf(rigManager.transform) && val2.isKinematic)
				{
					((Component)val2).gameObject.AddComponent<DoNotFreeze>();
				}
			}
		}

		public void Freeze()
		{
			if ((Object)(object)rigManager != (Object)null)
			{
				ModConsole.Msg("Getting rigidbodies", LoggingMode.DEBUG);
				Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>());
				Rigidbody[] array2 = array;
				foreach (Rigidbody val in array2)
				{
					if ((Object)(object)((Component)val).gameObject.GetComponent<DoNotFreeze>() != (Object)null)
					{
						ModConsole.Msg(((Object)((Component)val).gameObject).name + " has DoNotFreeze, skipping", LoggingMode.DEBUG);
					}
					else if (!((Component)val).transform.IsChildOf(rigManager.transform))
					{
						ModConsole.Msg("Froze all RBs", LoggingMode.DEBUG);
						val.isKinematic = true;
					}
				}
			}
			else
			{
				ModConsole.Msg("Somehow, the rigmanager is null!");
			}
		}

		public void Unfreeze()
		{
			if ((Object)(object)rigManager != (Object)null)
			{
				ModConsole.Msg("Getting all RBs", LoggingMode.DEBUG);
				Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>());
				Rigidbody[] array2 = array;
				foreach (Rigidbody val in array2)
				{
					if (!((Object)(object)((Component)val).gameObject.GetComponent<DoNotFreeze>() != (Object)null) && !((Component)val).transform.IsChildOf(rigManager.transform))
					{
						val.isKinematic = false;
					}
				}
			}
			else
			{
				ModConsole.Msg("Somehow, the rigmanager is null!", LoggingMode.DEBUG);
			}
		}

		private void OnDestroy()
		{
			Unfreeze();
		}

		public FreezeRigidbodies(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class GravityChamber : MonoBehaviour
	{
		public List<RBGravityManager> inTriggerCol = new List<RBGravityManager>();

		public Vector3 gravityAmount;

		public bool ignoreRigManager;

		public Vector3 GravityAmount
		{
			get
			{
				//IL_0002: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				return gravityAmount;
			}
			set
			{
				//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)
				gravityAmount = value;
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			//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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)((Component)other).GetComponentInParent<Rigidbody>() != (Object)null) || !((Object)(object)((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponent<RBGravityManager>() == (Object)null) || ((Object)(object)((Component)other).GetComponentInParent<RigManager>() != (Object)null && ignoreRigManager))
			{
				return;
			}
			((Component)((Component)other).GetComponentInParent<Rigidbody>()).gameObject.AddComponent<RBGravityManager>().gravityAmount = gravityAmount;
			Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponentsInChildren<Rigidbody>());
			Rigidbody[] array2 = array;
			foreach (Rigidbody val in array2)
			{
				if (val.isKinematic && (Object)(object)((Component)val).GetComponent<RBGravityManager>() == (Object)null)
				{
					((Component)val).gameObject.AddComponent<RBGravityManager>().gravityAmount = gravityAmount;
				}
			}
			inTriggerCol.Add(((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponent<RBGravityManager>());
		}

		private void OnTriggerExit(Collider other)
		{
			if (!inTriggerCol.Contains(((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponent<RBGravityManager>()))
			{
				return;
			}
			((Component)other).GetComponentInParent<Rigidbody>().useGravity = true;
			Object.Destroy((Object)(object)((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponent<RBGravityManager>());
			Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponentsInChildren<Rigidbody>());
			Rigidbody[] array2 = array;
			foreach (Rigidbody val in array2)
			{
				if (val.isKinematic && (Object)(object)((Component)val).GetComponent<RBGravityManager>() != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)val).GetComponent<RBGravityManager>());
				}
			}
			inTriggerCol.Remove(((Component)((Component)other).GetComponentInParent<Rigidbody>()).GetComponent<RBGravityManager>());
		}

		[HideFromIl2Cpp]
		private void OnGravityManagerDestroyed(RBGravityManager manager)
		{
			inTriggerCol.Remove(manager);
		}

		private void Update()
		{
			//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)
			foreach (RBGravityManager item in inTriggerCol)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.gravityAmount = gravityAmount;
				}
			}
		}

		public GravityChamber(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RBGravityManager : MonoBehaviour
	{
		public Rigidbody thisRb;

		public Vector3 gravityAmount;

		[NonSerialized]
		private Action<RBGravityManager> onDestroyed = null;

		public Vector3 GravityAmount
		{
			get
			{
				//IL_0002: 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_000a: Unknown result type (might be due to invalid IL or missing references)
				return gravityAmount;
			}
			set
			{
				//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)
				gravityAmount = value;
			}
		}

		private void Start()
		{
			thisRb = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)thisRb != (Object)null)
			{
				thisRb.useGravity = false;
			}
		}

		private void FixedUpdate()
		{
			//IL_0019: 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)
			if ((Object)(object)thisRb != (Object)null)
			{
				thisRb.AddForce(gravityAmount * thisRb.mass, (ForceMode)0);
			}
		}

		private void OnDestroy()
		{
			onDestroyed?.Invoke(this);
		}

		public RBGravityManager(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.PlayerUtil
{
	public class RagdollOnCollide : MonoBehaviour
	{
		public float delayBeforeUnragdoll = 2f;

		private RigManager _rigManager;

		private void OnCollisionEnter()
		{
			Collider component = ((Component)this).GetComponent<Collider>();
			_rigManager = ((Component)component).GetComponentInParent<RigManager>();
			if ((Object)(object)_rigManager != (Object)null)
			{
				_rigManager.physicsRig.RagdollRig();
				((MonoBehaviour)this).Invoke("Unragdoll", delayBeforeUnragdoll);
			}
		}

		private void Unragdoll()
		{
			_rigManager.physicsRig.UnRagdollRig();
		}

		public RagdollOnCollide(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RagdollZone : MonoBehaviour
	{
		public float delayBeforeUnragdoll = 2f;

		private RigManager _rigManager;

		private void OnTriggerEnter(Collider other)
		{
			_rigManager = ((Component)other).GetComponentInParent<RigManager>();
			if ((Object)(object)_rigManager != (Object)null)
			{
				_rigManager.physicsRig.RagdollRig();
				((MonoBehaviour)this).Invoke("Unragdoll", delayBeforeUnragdoll);
			}
		}

		private void Unragdoll()
		{
			_rigManager.physicsRig.UnRagdollRig();
		}

		public RagdollZone(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RigManagerControl : MonoBehaviour
	{
		public void RagDoll()
		{
			Player.physicsRig.RagdollRig();
		}

		public void UnRagDoll()
		{
			Player.physicsRig.UnRagdollRig();
		}

		public void Teleport(Vector3 feetPos)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Player.rigManager.Teleport(feetPos, true);
		}

		public void Teleport(Vector3 feetPos, bool zerovelocity)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Player.rigManager.Teleport(feetPos, zerovelocity);
		}

		public void Invincible()
		{
			Player.rigManager.health.healthMode = (HealthMode)0;
		}

		public void Mortal()
		{
			Player.rigManager.health.healthMode = (HealthMode)1;
		}

		public void InstantDeath()
		{
			Player.rigManager.health.healthMode = (HealthMode)2;
		}

		public void EnableDoubleJump()
		{
			Player.remapRig.doubleJump = true;
		}

		public void DisableDoubleJump()
		{
			Player.remapRig.doubleJump = false;
		}

		public RigManagerControl(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Markers
{
	public class DoNotDestroy : MonoBehaviour
	{
		public DoNotDestroy(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class DoNotFreeze : MonoBehaviour
	{
		public DoNotFreeze(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class VoidCounterObject : MonoBehaviour
	{
		public bool disableDespsawnDelay;

		public VoidCounterObject(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.LabFusion
{
	public class BitShop : MonoBehaviour
	{
		public int bitsRequired;

		public UltEvent purchaseEvent;

		public UltEvent noBitsEvent;

		public void Purchase()
		{
			int bitCount = PointItemManager.GetBitCount();
			if (bitCount >= bitsRequired)
			{
				purchaseEvent.Invoke();
				PointItemManager.DecrementBits(bitsRequired, true);
			}
			else
			{
				noBitsEvent.Invoke();
			}
		}

		public BitShop(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Groups
{
	public class GroupIdentifier : MonoBehaviour
	{
		public UltEvent onGroupJoin;

		public UltEvent onGroupTrigger;

		public string currectGroupID { get; set; }

		private void Update()
		{
			if (currectGroupID == "null")
			{
				currectGroupID = null;
			}
		}

		public GroupIdentifier(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class GroupProxy : MonoBehaviour
	{
		public void TriggerGroupByID(string id)
		{
			if (id == "null")
			{
				return;
			}
			foreach (GroupIdentifier item in Object.FindObjectsOfType<GroupIdentifier>())
			{
				if (item.currectGroupID == id)
				{
					item.onGroupTrigger.Invoke();
				}
			}
		}

		public void AddObjectToGroup(GameObject obj, string id)
		{
			if (!(id == "null"))
			{
				GroupIdentifier component = obj.GetComponent<GroupIdentifier>();
				if ((Object)(object)component != (Object)null)
				{
					component.currectGroupID = id;
					component.onGroupJoin.Invoke();
				}
			}
		}

		public string GetGroupFromObject(GameObject obj)
		{
			GroupIdentifier component = obj.GetComponent<GroupIdentifier>();
			if ((Object)(object)component != (Object)null)
			{
				return component.currectGroupID;
			}
			return "null";
		}

		public bool DoesGroupExist(string id)
		{
			foreach (GroupIdentifier item in Object.FindObjectsOfType<GroupIdentifier>())
			{
				if (item.currectGroupID == id)
				{
					return true;
				}
			}
			return false;
		}

		public GroupProxy(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Misc
{
	public class RealtimeAnalogClock : MonoBehaviour
	{
		public enum RotationEnum
		{
			XAxis,
			YAxis,
			ZAxis
		}

		public bool flip;

		public RotationEnum rotationAxis;

		public Transform hoursHand;

		public Transform minutesHand;

		public Transform secondsHand;

		private const float HoursToDegrees = 30f;

		private const float MinutesToDegrees = 6f;

		private const float SecondsToDegrees = 6f;

		private int _hours;

		private int _minutes;

		private int _seconds;

		private void Update()
		{
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: 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_00b0: 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_0105: 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)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			_hours = DateTime.Now.Hour;
			_minutes = DateTime.Now.Minute;
			_seconds = DateTime.Now.Second;
			if (!flip)
			{
				switch (rotationAxis)
				{
				case RotationEnum.XAxis:
					hoursHand.localRotation = Quaternion.Euler(-30f * (float)_hours, 0f, 0f);
					minutesHand.localRotation = Quaternion.Euler(-6f * (float)_minutes, 0f, 0f);
					secondsHand.localRotation = Quaternion.Euler(-6f * (float)_seconds, 0f, 0f);
					break;
				case RotationEnum.YAxis:
					hoursHand.localRotation = Quaternion.Euler(0f, -30f * (float)_hours, 0f);
					minutesHand.localRotation = Quaternion.Euler(0f, -6f * (float)_minutes, 0f);
					secondsHand.localRotation = Quaternion.Euler(0f, -6f * (float)_seconds, 0f);
					break;
				case RotationEnum.ZAxis:
					hoursHand.localRotation = Quaternion.Euler(0f, 0f, -30f * (float)_hours);
					minutesHand.localRotation = Quaternion.Euler(0f, 0f, -6f * (float)_minutes);
					secondsHand.localRotation = Quaternion.Euler(0f, 0f, -6f * (float)_seconds);
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
			}
			else
			{
				switch (rotationAxis)
				{
				case RotationEnum.XAxis:
					hoursHand.localRotation = Quaternion.Euler(30f * (float)_hours, 0f, 0f);
					minutesHand.localRotation = Quaternion.Euler(6f * (float)_minutes, 0f, 0f);
					secondsHand.localRotation = Quaternion.Euler(6f * (float)_seconds, 0f, 0f);
					break;
				case RotationEnum.YAxis:
					hoursHand.localRotation = Quaternion.Euler(0f, 30f * (float)_hours, 0f);
					minutesHand.localRotation = Quaternion.Euler(0f, 6f * (float)_minutes, 0f);
					secondsHand.localRotation = Quaternion.Euler(0f, 6f * (float)_seconds, 0f);
					break;
				case RotationEnum.ZAxis:
					hoursHand.localRotation = Quaternion.Euler(0f, 0f, 30f * (float)_hours);
					minutesHand.localRotation = Quaternion.Euler(0f, 0f, 6f * (float)_minutes);
					secondsHand.localRotation = Quaternion.Euler(0f, 0f, 6f * (float)_seconds);
					break;
				default:
					throw new ArgumentOutOfRangeException();
				}
			}
		}

		public RealtimeAnalogClock(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class ScoreKeeper : MonoBehaviour
	{
		public TextMeshPro player1Score;

		public TextMeshPro player2Score;

		public bool scoreLimit;

		public int scoreLimitValue = 5;

		private int player1ScoreValue;

		private int player2ScoreValue;

		public UltEvent onPlayer1Score;

		public UltEvent onPlayer2Score;

		public UltEvent onScoreLimitReached;

		public UltEvent onPlayer1Win;

		public UltEvent onPlayer2Win;

		public void Player1Scored()
		{
			player1ScoreValue++;
			((TMP_Text)player1Score).text = player1ScoreValue.ToString();
			onPlayer1Score.Invoke();
			if (scoreLimit && player1ScoreValue == scoreLimitValue)
			{
				onScoreLimitReached.Invoke();
				onPlayer1Win.Invoke();
				Reset();
			}
		}

		public void Player2Scored()
		{
			player2ScoreValue++;
			((TMP_Text)player2Score).text = player2ScoreValue.ToString();
			onPlayer2Score.Invoke();
			if (scoreLimit && player2ScoreValue == scoreLimitValue)
			{
				onScoreLimitReached.Invoke();
				onPlayer2Win.Invoke();
				Reset();
			}
		}

		public void Reset()
		{
			player1ScoreValue = 0;
			player2ScoreValue = 0;
			((TMP_Text)player1Score).text = player1ScoreValue.ToString();
			((TMP_Text)player2Score).text = player2ScoreValue.ToString();
		}

		public ScoreKeeper(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class DestroyOnCollision : MonoBehaviour
	{
		private bool activeState;

		public AudioSource audioSource;

		public GameObject[] excludedObjects;

		private Transform rigManager;

		private Blip blip;

		public void Disable()
		{
			activeState = false;
		}

		public void Enable()
		{
			activeState = true;
		}

		private void Start()
		{
			GameObject obj = GameObject.Find("[RigManager (Blank)]");
			rigManager = ((obj != null) ? obj.transform : null);
			ModConsole.Msg("Rigmanager is " + ((Object)((Component)rigManager).gameObject).name, LoggingMode.DEBUG);
		}

		private void OnCollisionEnter(Collision collision)
		{
			if (activeState && !collision.transform.IsChildOf(rigManager) && collision.gameObject.layer != 13 && !IsObjectExcluded(collision.gameObject) && !Object.op_Implicit((Object)(object)collision.gameObject.GetComponent<DoNotDestroy>()))
			{
				Rigidbody componentInParent = ((Component)collision.transform).GetComponentInParent<Rigidbody>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					blip = ((Component)((Component)componentInParent).transform).GetComponent<Blip>();
				}
				if ((Object)(object)blip != (Object)null)
				{
					blip.CallSpawnEffect();
				}
				audioSource.Play();
				ModConsole.Msg("Destroying " + ((Object)collision.gameObject).name, LoggingMode.DEBUG);
				Object.Destroy((Object)(object)collision.gameObject);
			}
		}

		public DestroyOnCollision(IntPtr ptr)
			: base(ptr)
		{
		}

		private bool IsObjectExcluded(GameObject obj)
		{
			GameObject[] array = excludedObjects;
			foreach (GameObject val in array)
			{
				if ((Object)(object)obj == (Object)(object)val)
				{
					ModConsole.Msg($"Ignoring {val}", LoggingMode.DEBUG);
					return true;
				}
			}
			return false;
		}
	}
	public class InvokeIfLibInstalled : MonoBehaviour
	{
		public UltEvent ifInstalled;

		public void Awake()
		{
			ifInstalled.Invoke();
		}

		public InvokeIfLibInstalled(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class InvokeWhenCounter : MonoBehaviour
	{
		public float counter;

		public float countersNeeded = 5f;

		public UltEvent onCounterHit;

		public void Add(float value)
		{
			counter += value;
			if (counter == countersNeeded)
			{
				onCounterHit.Invoke();
				counter = 0f;
			}
		}

		public void Subtract(float value)
		{
			counter -= value;
		}

		public float GetCounter()
		{
			return counter;
		}

		public InvokeWhenCounter(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class PhotonThruster : MonoBehaviour
	{
		public float thrustForce = 100f;

		public GameObject particles;

		public bool useText;

		public TextMeshPro textMeshPro;

		public float incrementAmount = 50f;

		public float decrementAmount = 50f;

		public float maximumForce = 500f;

		public float minimumForce = 50f;

		private bool _thrustEnabled;

		private Rigidbody _thisrb;

		private Vector3 _vectorizedForce;

		public float ThrustForce
		{
			get
			{
				return thrustForce;
			}
			set
			{
				thrustForce = value;
			}
		}

		private void Awake()
		{
			//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)
			_thisrb = ((Component)this).GetComponent<Rigidbody>();
			((TMP_Text)textMeshPro).text = thrustForce.ToString("F1");
			_vectorizedForce = new Vector3(0f, 0f, thrustForce);
		}

		public void Toggle()
		{
			if (_thrustEnabled)
			{
				_thrustEnabled = false;
				particles.SetActive(false);
			}
			else
			{
				_thrustEnabled = true;
				particles.SetActive(true);
			}
		}

		public void IncreaseForce()
		{
			//IL_0063: 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_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)
			if (thrustForce > maximumForce)
			{
				thrustForce += incrementAmount;
				_vectorizedForce = new Vector3(0f, 0f, thrustForce);
			}
			else
			{
				thrustForce = maximumForce;
				_vectorizedForce = new Vector3(0f, 0f, thrustForce);
			}
			if (useText)
			{
				UpdateTextValue(incrementAmount, subtract: false);
			}
		}

		public void DecreaseForce()
		{
			//IL_0063: 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_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)
			if (thrustForce < minimumForce)
			{
				thrustForce -= decrementAmount;
				_vectorizedForce = new Vector3(0f, 0f, thrustForce);
			}
			else
			{
				thrustForce = minimumForce;
				_vectorizedForce = new Vector3(0f, 0f, thrustForce);
			}
			if (useText)
			{
				UpdateTextValue(decrementAmount, subtract: true);
			}
		}

		public void UpdateTextValue(float value, bool subtract)
		{
			if (subtract)
			{
				float num = float.Parse(((TMP_Text)textMeshPro).text);
				num -= value;
				if (num < minimumForce)
				{
					num = minimumForce;
				}
				((TMP_Text)textMeshPro).text = num.ToString("F1");
			}
			else
			{
				float num2 = float.Parse(((TMP_Text)textMeshPro).text);
				num2 += value;
				if (num2 > maximumForce)
				{
					num2 = maximumForce;
				}
				((TMP_Text)textMeshPro).text = num2.ToString("F1");
			}
		}

		private void FixedUpdate()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			if (_thrustEnabled)
			{
				_thisrb.AddRelativeForce(_vectorizedForce);
			}
		}

		public PhotonThruster(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class RandomAudioPlayer : MonoBehaviour
	{
		public AudioSource[] audioSources;

		private void Start()
		{
			if (audioSources.Length == 0)
			{
				ModConsole.Msg("No audiosources assigned!", LoggingMode.DEBUG);
			}
		}

		public void PlayRandomSound()
		{
			if (audioSources.Length != 0)
			{
				int num = Random.Range(0, audioSources.Length);
				audioSources[num].Play();
			}
			else
			{
				ModConsole.Msg("No audiosources assigned!", LoggingMode.DEBUG);
			}
		}

		public RandomAudioPlayer(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SimpleCounter : MonoBehaviour
	{
		public UltEvent onCounterHit;

		public float counter { get; set; }

		public void Add(float value)
		{
			counter += value;
		}

		public void Subtract(float value)
		{
			counter -= value;
		}

		public float GetCounter()
		{
			return counter;
		}

		public SimpleCounter(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class SpawnOnTriggerEnter : MonoBehaviour
	{
		public GameObject objectToSpawn;

		public bool divideVelocity;

		public float divideByX = 10f;

		public float divideByY = 10f;

		public float divideByZ = 10f;

		public Vector3 minimumScale = new Vector3(1f, 1f, 1f);

		public Vector3 maximumScale = new Vector3(200f, 200f, 200f);

		public bool uniformScale = true;

		public float uniformScaleMinimum = 1f;

		public float uniformScaleMaximum = 200f;

		public float uniformScaleDivision = 10f;

		public bool ignoreSpawnedObjects = false;

		public bool fixedRotation = true;

		public Quaternion rotation = new Quaternion(0f, 0f, 1f, 0f);

		public float minimumVelocity = 0.5f;

		public bool fixedY = true;

		public float YValue = 0f;

		private Vector3 rbVelocity;

		private List<GameObject> spawnedObjects = new List<GameObject>();

		private GameObject spawnedObject;

		private void OnTriggerEnter(Collider other)
		{
			//IL_004d: 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_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)objectToSpawn == (Object)null || (spawnedObjects.Contains(((Component)((Component)other).transform.root).gameObject) && ignoreSpawnedObjects))
			{
				return;
			}
			Vector3 velocity = other.attachedRigidbody.velocity;
			if (((Vector3)(ref velocity)).sqrMagnitude < minimumVelocity)
			{
				return;
			}
			if (fixedRotation)
			{
				if (fixedY)
				{
					Vector3 val = default(Vector3);
					((Vector3)(ref val))..ctor(((Component)other).transform.position.x, YValue, ((Component)other).transform.position.z);
					spawnedObject = Object.Instantiate<GameObject>(objectToSpawn, val, rotation);
				}
				else
				{
					spawnedObject = Object.Instantiate<GameObject>(objectToSpawn, ((Component)other).transform.position, rotation);
				}
			}
			else if (fixedY)
			{
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(((Component)other).transform.position.x, YValue, ((Component)other).transform.position.z);
				spawnedObject = Object.Instantiate<GameObject>(objectToSpawn, val2, ((Component)other).transform.rotation);
			}
			else
			{
				spawnedObject = Object.Instantiate<GameObject>(objectToSpawn, ((Component)other).transform.position, ((Component)other).transform.rotation);
			}
			if (!uniformScale)
			{
				float num = Mathf.Clamp(Mathf.Abs(other.attachedRigidbody.velocity.x) / divideByX, minimumScale.x, maximumScale.x);
				float num2 = Mathf.Clamp(Mathf.Abs(other.attachedRigidbody.velocity.y) / divideByY, minimumScale.y, maximumScale.y);
				float num3 = Mathf.Clamp(Mathf.Abs(other.attachedRigidbody.velocity.z) / divideByZ, minimumScale.z, maximumScale.z);
				rbVelocity = new Vector3(num, num2, num3);
				spawnedObject.transform.localScale = Vector3.Scale(rbVelocity, spawnedObject.transform.lossyScale);
			}
			else
			{
				rbVelocity = new Vector3(Mathf.Abs(other.attachedRigidbody.velocity.x), Mathf.Abs(other.attachedRigidbody.velocity.y), Mathf.Abs(other.attachedRigidbody.velocity.z));
				float num4 = Mathf.Clamp(((Vector3)(ref rbVelocity)).sqrMagnitude / uniformScaleDivision, uniformScaleMinimum, uniformScaleMaximum);
				Vector3 localScale = default(Vector3);
				((Vector3)(ref localScale))..ctor(num4, num4, num4);
				spawnedObject.transform.localScale = localScale;
			}
		}

		public SpawnOnTriggerEnter(IntPtr ptr)
			: base(ptr)
		{
		}//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_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_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)

	}
	public class TimescaleController : MonoBehaviour
	{
		public float incrementValue = 0.5f;

		private float timeScale = 1f;

		public void ScaleTime()
		{
			if (timeScale >= 0.1f)
			{
				Time.timeScale = timeScale;
			}
			else
			{
				ModConsole.Msg("Scale cannot be negative!", LoggingMode.DEBUG);
			}
		}

		private void FixedUpdate()
		{
			ScaleTime();
		}

		public void IncreaseTimeScale()
		{
			float num = timeScale;
			timeScale = num + incrementValue;
			ModConsole.Msg($"Increasing timeScale by {incrementValue}, now {timeScale}", LoggingMode.DEBUG);
		}

		public void DecreaseTimeScale()
		{
			float num = timeScale;
			float num2 = num - incrementValue;
			if (num >= 0.1f)
			{
				timeScale = num2;
				ModConsole.Msg($"Decreasing timeScale by {incrementValue}, now {num2}", LoggingMode.DEBUG);
			}
			else
			{
				ModConsole.Msg("Scale cannot be negative!", LoggingMode.DEBUG);
			}
		}

		private void OnDestroy()
		{
			Time.timeScale = 1f;
		}

		public TimescaleController(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class TLE_SimpleRaycast : MonoBehaviour
	{
		public Vector3 SimpleSendRay(float maxDistance, Transform firePoint)
		{
			//IL_0002: 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_002a: 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)
			//IL_0036: 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_0040: 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)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(firePoint.position, firePoint.forward, ref val, maxDistance))
			{
				return ((RaycastHit)(ref val)).transform.position;
			}
			return firePoint.position + firePoint.forward * maxDistance;
		}

		public GameObject SendRay(float maxDistance, Transform firePoint)
		{
			//IL_0002: 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)
			RaycastHit val = default(RaycastHit);
			Physics.Raycast(firePoint.position, firePoint.forward, ref val, maxDistance);
			return ((Component)((RaycastHit)(ref val)).collider).gameObject;
		}

		public TLE_SimpleRaycast(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class UpdateTMP : MonoBehaviour
	{
		public TextMeshPro textMeshPro;

		public float startingValue = 1f;

		public float incrementAmount = 0.5f;

		public float minValue = 0.1f;

		private float currentValue;

		private void Start()
		{
			ModConsole.Msg($"Starting value is {startingValue}", LoggingMode.DEBUG);
			currentValue = startingValue;
			UpdateTextValue();
		}

		private void UpdateTextValue()
		{
			((TMP_Text)textMeshPro).text = currentValue.ToString("F1");
		}

		public void IncreaseValue()
		{
			currentValue += incrementAmount;
			ModConsole.Msg($"Increasing value by {incrementAmount}, now {currentValue}", LoggingMode.DEBUG);
			UpdateTextValue();
		}

		public void DecreaseValue()
		{
			currentValue -= incrementAmount;
			ModConsole.Msg($"Decreasing value by {incrementAmount}, now {currentValue}", LoggingMode.DEBUG);
			if (currentValue < 0.1f)
			{
				ModConsole.Msg("Value should not be lower than 0.1!", LoggingMode.DEBUG);
				currentValue = minValue;
			}
			UpdateTextValue();
		}

		public UpdateTMP(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Marrow
{
	public class CoolerSpawnablePlacer : MonoBehaviour
	{
		public SpawnableCrateReference spawnableCrateReference;

		public SpawnPolicyData spawnPolicy;

		public bool manualMode;

		public bool ignorePolicy;

		public UltEvent onPlaceEvent;

		public bool IgnorePolicy
		{
			get
			{
				return ignorePolicy;
			}
			set
			{
				ignorePolicy = value;
			}
		}

		private void Start()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0096: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_0036: Expected O, but got Unknown
			//IL_003d: 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)
			if (!manualMode)
			{
				if ((Object)(object)spawnPolicy == (Object)null)
				{
					Spawnable spawnable = new Spawnable
					{
						crateRef = spawnableCrateReference
					};
					SpawnCrate.Spawn(spawnable, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate
					{
					});
				}
				else
				{
					Spawnable spawnable2 = new Spawnable
					{
						crateRef = spawnableCrateReference,
						policyData = spawnPolicy
					};
					SpawnCrate.Spawn(spawnable2, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate
					{
					});
				}
				onPlaceEvent.Invoke();
			}
		}

		public void Spawn()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0085: Expected O, but got Unknown
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			//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)
			if ((Object)(object)spawnPolicy == (Object)null)
			{
				Spawnable spawnable = new Spawnable
				{
					crateRef = spawnableCrateReference
				};
				SpawnCrate.Spawn(spawnable, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate
				{
				});
			}
			else
			{
				Spawnable spawnable2 = new Spawnable
				{
					crateRef = spawnableCrateReference,
					policyData = spawnPolicy
				};
				SpawnCrate.Spawn(spawnable2, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate
				{
				});
			}
			onPlaceEvent.Invoke();
		}

		public void SpawnWithForce(Vector3 force)
		{
			//IL_0007: 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_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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0086: 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_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_0032: Expected O, but got Unknown
			//IL_0039: 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)
			if ((Object)(object)spawnPolicy == (Object)null)
			{
				Spawnable spawnable = new Spawnable
				{
					crateRef = spawnableCrateReference
				};
				SpawnCrate.Spawn(spawnable, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate(GameObject go)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					go.GetComponent<Rigidbody>().AddRelativeForce(force);
				});
			}
			else
			{
				Spawnable spawnable2 = new Spawnable
				{
					crateRef = spawnableCrateReference,
					policyData = spawnPolicy
				};
				SpawnCrate.Spawn(spawnable2, ((Component)this).transform.position, Quaternion.identity, ignorePolicy, delegate(GameObject go)
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					go.GetComponent<Rigidbody>().AddRelativeForce(force);
				});
			}
			onPlaceEvent.Invoke();
		}

		public CoolerSpawnablePlacer(IntPtr ptr)
			: base(ptr)
		{
		}
	}
	public class DespawnPooledObject : MonoBehaviour
	{
		private GameObject _self;

		private AssetPoolee _assetPoolee;

		private void Start()
		{
			_self = ((Component)this).gameObject;
			_assetPoolee = ((Component)this).gameObject.GetComponent<AssetPoolee>();
		}

		public void Despawn()
		{
			if ((Object)(object)_assetPoolee != (Object)null)
			{
				_self.SetActive(false);
				_assetPoolee.Despawn();
			}
		}

		public DespawnPooledObject(IntPtr ptr)
			: base(ptr)
		{
		}
	}
}
namespace TheLibraryElectric.Environment
{
	public class TimeCycleHandler : MonoBehaviour
	{
		public Light sun;

		public float yAxis;

		public float zAxis;

		public float nightLightIntensity = 0.001f;

		public float dayLightIntensity = 1f;

		public Color dayColor = Color.white;

		public Color nightColor = Color.black;

		public ReflectionProbe[] reflectionProbes;

		public float nightIntensity = 0.4f;

		public float dayIntensity = 1f;

		public float nightStartHour = 19f;

		public float nightEndHour = 6f;

		private void Update()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			DateTime now = DateTime.Now;
			float num = now.Hour;
			float num2 = now.Minute;
			float num3 = now.Second;
			float num4 = num * 3600f + num2 * 60f + num3;
			float num5 = 90f - num4 / 86400f * 360f;
			((Component)sun).transform.rotation = Quaternion.Euler(0f - num5, yAxis, zAxis);
			ReflectionProbe[] array = reflectionProbes;
			foreach (ReflectionProbe val in array)
			{
				val.intensity = CalculateIntensity(num, light: false);
			}
			sun.intensity = CalculateIntensity(num, light: true);
			sun.color = CalculateColor(num);
		}

		private float CalculateIntensity(float hours, bool light)
		{
			if (light)
			{
				if (hours >= nightStartHour || hours < nightEndHour)
				{
					return nightLightIntensity;
				}
				return dayLightIntensity;
			}
			if (hours >= nightStartHour || hours < nightEndHour)
			{
				return nightIntensity;
			}
			return dayIntensity;
		}

		private Color CalculateColor(float hours)
		{
			//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_001c: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			if (hours >= nightStartHour || hours < nightEndHour)
			{
				return nightColor;
			}
			return dayColor;
		}

		public TimeCycleHandler(IntPtr ptr)
			: base(ptr)
		{
		}//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//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)

	}
}
namespace TheLibraryElectric.InternalHelpers
{
	public static class SpawnCrate
	{
		public static void Spawn(Spawnable spawnable, Vector3 position, Quaternion rotation, bool ignorePolicy, Action<GameObject> callback)
		{
			//IL_0024: 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)
			AssetSpawner.Register(spawnable);
			Action<GameObject> action = delegate(GameObject go)
			{
				callback(go);
			};
			AssetSpawner.Spawn(spawnable, position, rotation, BoxedNullable<Vector3>.op_Implicit(new BoxedNullable<Vector3>((Vector3?)null)), ignorePolicy, BoxedNullable<int>.op_Implicit(new BoxedNullable<int>((int?)null)), Action<GameObject>.op_Implicit(action), (Action<GameObject>)null);
		}
	}
}
namespace TheLibraryElectric.Helpers
{
	public static class ColliderHelper
	{
		public static void SetTrigger(Collider collider, bool b)
		{
			collider.isTrigger = b;
		}

		public static bool GetTrigger(Collider collider)
		{
			return collider.isTrigger;
		}

		public static Rigidbody GetRigidbody(Collider collider)
		{
			return collider.attachedRigidbody;
		}

		public static GameObject GetGameObject(Collider collider)
		{
			return ((Component)collider).gameObject;
		}
	}
	public static class RigidBodyHelper
	{
		public static void SetKinematic(Rigidbody body, bool b)
		{
			body.isKinematic = b;
		}

		public static bool GetKinematic(Rigidbody body)
		{
			return body.isKinematic;
		}

		public static void SetUseGravity(Rigidbody body, bool b)
		{
			body.useGravity = b;
		}

		public static bool GetUseGravity(Rigidbody body)
		{
			return body.useGravity;
		}

		public static void SetMass(Rigidbody body, float mass)
		{
			body.mass = mass;
		}

		public static float GetMass(Rigidbody body)
		{
			return body.mass;
		}

		public static void AddForce(Rigidbody body, Vector3 force)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			body.AddForce(force);
		}

		public static void AddTorque(Rigidbody body, Vector3 torque)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			body.AddTorque(torque);
		}

		public static void SetFreezeRotation(Rigidbody body, bool freezeRotation)
		{
			body.freezeRotation = freezeRotation;
		}

		public static bool GetFreezeRotation(Rigidbody body)
		{
			return body.freezeRotation;
		}
	}
	public static class RigManagerHelper
	{
		public static RigManager GetFromCollider(Collider collider)
		{
			return ((Component)collider).GetComponentInParent<RigManager>();
		}

		public static void RagDoll(RigManager rig)
		{
			rig.physicsRig.RagdollRig();
		}

		public static void UnRagDoll(RigManager rig)
		{
			rig.physicsRig.UnRagdollRig();
		}

		public static void Teleport(RigManager rig, Vector3 feetPos)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			rig.Teleport(feetPos, true);
		}

		public static void Teleport(RigManager rig, Vector3 feetPos, bool zerovelocity)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			rig.Teleport(feetPos, zerovelocity);
		}

		public static void SetDoubleJump(RigManager rig, bool canDoubleJump)
		{
			rig.remapHeptaRig.doubleJump = canDoubleJump;
		}

		public static RigManager GetFromBonelib()
		{
			return Player.rigManager;
		}
	}
	public static class TimeProxy
	{
		public static int GetMinute()
		{
			return DateTime.Now.Minute;
		}

		public static int GetHour()
		{
			return DateTime.Now.Hour;
		}

		public static bool IfAfterOrNow(float hour, float minute)
		{
			if (hour * 60f + minute <= (float)(GetHour() * 60 + GetMinute()))
			{
				return true;
			}
			return false;
		}

		public static bool IfBeforeOrNow(float hour, float minute)
		{
			if (hour * 60f + minute >= (float)(GetHour() * 60 + GetMinute()))
			{
				return true;
			}
			return false;
		}
	}
}

Plugins/TheLibraryElectricUpdater.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using MelonLoader.Preferences;
using TheLibraryElectricUpdater;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TheLibraryElectricUpdater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("TheLibraryElectricUpdater")]
[assembly: AssemblyCopyright("Created by CarrionAndOn")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("2.2.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(Main), "TheLibraryElectricUpdater", "2.2.0", "CarrionAndOn", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.2.0.0")]
namespace TheLibraryElectricUpdater;

public static class BuildInfo
{
	public const string Name = "TheLibraryElectricUpdater";

	public const string Author = "CarrionAndOn";

	public const string Company = "Weather Electric";

	public const string Version = "2.2.0";

	public const string DownloadLink = null;
}
public class Main : MelonPlugin
{
	private MelonPreferences_Category prefsCategory = MelonPreferences.CreateCategory("TheLibraryElectricUpdater");

	private MelonPreferences_Entry<bool> offlineModePref;

	public static readonly string libraryElectricAssemblyPath = Path.Combine(MelonHandler.ModsDirectory, "TheLibraryElectric.dll");

	public static readonly string libraryElectricUpdaterAssemblyPath = Path.Combine(MelonHandler.PluginsDirectory, "TheLibraryElectricUpdater.dll");

	private bool isOffline => offlineModePref.Value;

	public static Instance Logger { get; private set; }

	public override void OnPreInitialization()
	{
		Logger = ((MelonBase)this).LoggerInstance;
		offlineModePref = prefsCategory.CreateEntry<bool>("OfflineMode", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		prefsCategory.SaveToFile(false);
		((MelonBase)this).LoggerInstance.Msg(isOffline ? ConsoleColor.Yellow : ConsoleColor.Green, isOffline ? "TheLibraryElectric is in OFFLINE mode" : "TheLibraryElectric is in ONLINE mode");
		if (isOffline)
		{
			if (!File.Exists(libraryElectricAssemblyPath))
			{
				((MelonBase)this).LoggerInstance.Warning("TheLibraryElectric.dll was not found in the Mods folder");
				((MelonBase)this).LoggerInstance.Warning("Download it from github or switch to ONLINE mode");
				((MelonBase)this).LoggerInstance.Warning("https://github.com/CarrionAndOn/TheLibraryElectric/releases");
			}
		}
		else
		{
			Updater.UpdateMod();
		}
	}

	public override void OnApplicationQuit()
	{
		Updater.UpdatePlugin();
	}
}
internal static class Updater
{
	private static readonly string dataDir = Path.Combine(MelonUtils.UserDataDirectory, "TheLibraryElectricUpdater");

	private static readonly string updaterAppName = "updater.exe";

	private static bool pluginNeedsUpdating = false;

	public static void UpdateMod()
	{
		Version arg = new Version(0, 0, 0);
		if (File.Exists(Main.libraryElectricAssemblyPath))
		{
			AssemblyName assemblyName = AssemblyName.GetAssemblyName(Main.libraryElectricAssemblyPath);
			arg = new Version(assemblyName.Version.Major, assemblyName.Version.Minor, assemblyName.Version.Build);
			Main.Logger.Msg($"TheLibraryElectric.dll found in Mods folder. Version: {arg}");
		}
		try
		{
			Directory.CreateDirectory(dataDir);
			string text = Path.Combine(dataDir, updaterAppName);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().First((string x) => x.Contains(updaterAppName));
			using (Stream stream = executingAssembly.GetManifestResourceStream(name))
			{
				using FileStream destination = File.Create(text);
				stream.CopyTo(destination);
			}
			Process process = new Process();
			process.StartInfo.FileName = text;
			process.StartInfo.Arguments = $"{arg} \"{Main.libraryElectricAssemblyPath}\" \"{Main.libraryElectricUpdaterAssemblyPath}\" \"false\"";
			process.Start();
			process.WaitForExit();
			switch ((ExitCode)process.ExitCode)
			{
			case ExitCode.Success:
				Main.Logger.Msg("TheLibraryElectric.dll updated successfully!");
				pluginNeedsUpdating = true;
				break;
			case ExitCode.UpToDate:
				Main.Logger.Msg("TheLibraryElectric.dll is already up to date");
				break;
			case ExitCode.Error:
				Main.Logger.Error("TheLibraryElectric.dll failed to update");
				break;
			}
		}
		catch (Exception ex)
		{
			Main.Logger.Error("Error while running TheLibraryElectric updater");
			Main.Logger.Error(ex.ToString());
		}
	}

	public static void UpdatePlugin()
	{
		if (!pluginNeedsUpdating)
		{
			return;
		}
		Directory.CreateDirectory(dataDir);
		string text = Path.Combine(dataDir, updaterAppName);
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		string name = executingAssembly.GetManifestResourceNames().First((string x) => x.Contains(updaterAppName));
		using (Stream stream = executingAssembly.GetManifestResourceStream(name))
		{
			using FileStream destination = File.Create(text);
			stream.CopyTo(destination);
		}
		Process process = new Process();
		process.StartInfo.FileName = text;
		process.StartInfo.Arguments = $"{new Version(0, 0, 0)} \"{Main.libraryElectricAssemblyPath}\" \"{Main.libraryElectricUpdaterAssemblyPath}\" true";
		process.Start();
	}
}
internal enum ExitCode
{
	Success,
	UpToDate,
	Error
}