Decompiled source of Bodycam v1.0.0

Bodycam.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Bodycam;
using HBMF.GameResources;
using HBMF.ModMenu;
using Il2Cpp;
using MelonLoader;
using MelonLoader.Preferences;
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), "Bodycam", "1.0.0", "korbykob", null)]
[assembly: MelonGame("GexagonVR", "Hard Bullet")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Bodycam")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Bodycam")]
[assembly: AssemblyTitle("Bodycam")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Bodycam;

public class Mod : MelonMod
{
	private Transform currentCamera;

	private Transform chest;

	private MelonPreferences_Entry<bool> enabled;

	public override void OnInitializeMelon()
	{
		enabled = MelonPreferences.CreateCategory("Bodycam").CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		Menu.CreateCategory("BODYCAM").CreateBool("ENABLE", enabled.Value, (Action<bool>)delegate(bool value)
		{
			enabled.Value = value;
			Transform obj = currentCamera;
			if (obj != null)
			{
				((Component)obj).gameObject.SetActive(value);
			}
		});
		GameResources.ResourcesReady = (Action)Delegate.Combine(GameResources.ResourcesReady, (Action)delegate
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			currentCamera = Object.Instantiate<GameObject>(((Component)GameResources.Camera.Find("RecordingCamera")).gameObject, GameResources.HexaBody.Find("Pelvis")).transform;
			((Component)currentCamera).gameObject.SetActive(enabled.Value);
			((Component)currentCamera).GetComponent<Camera>().fieldOfView = 100f;
			Object.Destroy((Object)(object)((Component)currentCamera).GetComponent<IPDOffset>());
			chest = new GameObject().transform;
			chest.parent = GameResources.HexaBody.Find("PlayerModel/PlayerModel/root/pelvis/spine_01/spine_02/spine_03");
			chest.localRotation = Quaternion.Euler(-90f, 0f, 90f);
		});
	}

	public override void OnFixedUpdate()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)chest != (Object)null)
		{
			currentCamera.rotation = Quaternion.Lerp(currentCamera.rotation, chest.rotation, 0.1f);
			currentCamera.position = currentCamera.parent.position + currentCamera.up * 0.3f + currentCamera.forward * 0.15f;
		}
	}
}