Decompiled source of ZLinearOomph v1.0.1

Niko666.ZLinearOomph.dll

Decompiled 6 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("Niko666")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Add some more oomph factor to weapons' linear Z-axis when firing, mimicking some FPS games' \\\"Sight hitting your eye\\\" aka \\\"Eyeball Extractor\\\" effect.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("Niko666.ZLinearOomph")]
[assembly: AssemblyTitle("ZLinearOomph")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace Niko666
{
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("Niko666.ZLinearOomph", "ZLinearOomph", "1.0.1")]
	public class ZLinearOomph : BaseUnityPlugin
	{
		private ConfigEntry<float> configOomphAmount;

		private ConfigEntry<float> configForceAddOomphAmount;

		public static float OomphAmount = 3f;

		public static float ForceAddOomphAmount = 0.01f;

		public const string Id = "Niko666.ZLinearOomph";

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "ZLinearOomph";

		public static string Version => "1.0.1";

		private void Awake()
		{
			configOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "OomphAmount", 3f, "The amount of oomphs you want. 1 being H3VR defaults.");
			configForceAddOomphAmount = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ForceAddOomphAmount", 0.01f, "The amount of oomphs which will always get added so single fire will still have some oomphs");
			OomphAmount = configOomphAmount.Value;
			ForceAddOomphAmount = configForceAddOomphAmount.Value;
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(typeof(ZLinearOomphPatch), (string)null);
			Logger.LogMessage((object)("Fuck this world! Sent from Niko666.ZLinearOomph " + Version));
		}
	}
	internal class ZLinearOomphPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(FVRFireArm), "Recoil")]
		[HarmonyPostfix]
		public static void ZLinearOomphing(FVRFireArm __instance, FVRFireArmRecoilProfile overrideprofile = null)
		{
			FVRFireArmRecoilProfile val = ((!((Object)(object)overrideprofile != (Object)null)) ? __instance.GetRecoilProfile() : overrideprofile);
			__instance.m_recoilLinearZ = ZLinearOomph.ForceAddOomphAmount + Mathf.Clamp(Mathf.Abs(__instance.m_recoilLinearZ * ZLinearOomph.OomphAmount), __instance.m_recoilPoseHolderLocalPosStart.z, __instance.m_recoilPoseHolderLocalPosStart.z + val.ZLinearMax * ZLinearOomph.OomphAmount * 0.6f);
		}
	}
}