Decompiled source of FlatPlayerPlus v1.0.0

Mods/FlatPlayerPlus.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using FlatPlayer;
using FlatPlayerPlus;
using Il2CppSLZ.Bonelab.SaveData;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Pool;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "FlatPlayerPlus", "1.0.0", "HL2H0", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FlatPlayerPlus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FlatPlayerPlus")]
[assembly: AssemblyTitle("FlatPlayerPlus")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FlatPlayerPlus
{
	public class Mod : MelonMod
	{
		public enum ReloadHand
		{
			Right,
			Left
		}

		private static ReloadHand _reloadHand;

		public static void ReloadGun(ReloadHand reloadHand)
		{
			switch (reloadHand)
			{
			case ReloadHand.Right:
			{
				Gun componentInHand3 = Player.GetComponentInHand<Gun>(Player.RightHand);
				Magazine componentInHand4 = Player.GetComponentInHand<Magazine>(Player.LeftHand);
				if (Object.op_Implicit((Object)(object)componentInHand3) && Object.op_Implicit((Object)(object)componentInHand4) && !componentInHand3.HasMagazine())
				{
					((SpawnEvents)componentInHand4).Despawn();
					componentInHand3.InstantLoadAsync();
					componentInHand3.CompleteSlidePull();
					componentInHand3.CompleteSlideReturn();
				}
				break;
			}
			case ReloadHand.Left:
			{
				Gun componentInHand = Player.GetComponentInHand<Gun>(Player.LeftHand);
				Magazine componentInHand2 = Player.GetComponentInHand<Magazine>(Player.RightHand);
				if ((Object)(object)componentInHand2 != (Object)null && !componentInHand.HasMagazine())
				{
					((SpawnEvents)componentInHand2).Despawn();
					componentInHand.InstantLoadAsync();
					componentInHand.CompleteSlidePull();
					componentInHand.CompleteSlideReturn();
				}
				break;
			}
			}
		}

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("FlatPlayer+ Initialized.");
		}

		public override void OnUpdate()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			((MelonBase)this).OnUpdate();
			_reloadHand = (DataManager.ActiveSave.PlayerSettings.BeltLocationRight ? ReloadHand.Left : ReloadHand.Right);
			if (FlatBooter.IsReady)
			{
				if (Input.GetKeyDown((KeyCode)114) && FlatBooter.IsReady)
				{
					ReloadGun(_reloadHand);
				}
				if (Input.GetKey((KeyCode)119) && Object.op_Implicit((Object)(object)Player.RigManager.activeSeat))
				{
					Player.RightController._thumbstickAxis = new Vector2(0f, 1f);
				}
				if (Input.GetKeyDown((KeyCode)306))
				{
					Player.LeftController._thumbstickDown = true;
				}
			}
		}
	}
}