Decompiled source of Metal Grill Sausage v0.0.4

Metal_Grill_Sausage.dll

Decompiled 7 months ago
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using UnityEngine;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace Packer.Metal_Grill_Sausage
{
	[BepInPlugin("Packer.Metal_Grill_Sausage", "Metal_Grill_Sausage", "0.0.4")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("nrgill28.Atlas", "1.0.1")]
	public class Metal_Grill_SausagePlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Packer.Metal_Grill_Sausage");
			AtlasPlugin.RegisterScene(Path.Combine(BasePath, "mgs"));
		}
	}
}
namespace Packer
{
	public class ElevatorSystem : TriggerSystem
	{
		[Serializable]
		public class Floor
		{
			public Transform level;

			public GameObject Button_On;

			public GameObject Button_Off;
		}

		[SerializeField]
		public Floor[] floors;

		public Rigidbody elevator;

		public float elevatorSpeed = 1.5f;

		public int targetFloor = 0;

		private float timeout = 0f;

		private void Start()
		{
		}

		public void SetFloor(int i)
		{
			if (!(timeout > 0f))
			{
				targetFloor = i;
				SetAllButtonsOff();
				SetFloorButton(i, set: true);
				timeout = 1f;
			}
		}

		private void SetAllButtonsOff()
		{
			for (int i = 0; i < floors.Length; i++)
			{
				SetFloorButton(i, set: false);
			}
		}

		private void SetFloorButton(int i, bool set)
		{
			if (Object.op_Implicit((Object)(object)floors[i].Button_On))
			{
				floors[i].Button_On.SetActive(set);
			}
			if (Object.op_Implicit((Object)(object)floors[i].Button_Off))
			{
				floors[i].Button_Off.SetActive(!set);
			}
		}

		public override void InvokeTrigger(TriggerSystem invoker)
		{
			SetFloor(invoker.index);
		}

		private void Update()
		{
			if (timeout > 0f)
			{
				timeout = Mathf.Clamp(timeout -= Time.deltaTime, 0f, 1f);
			}
		}

		public void FixedUpdate()
		{
			MoveTowardsFloor();
		}

		private void MoveTowardsFloor()
		{
			//IL_000d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			elevator.MovePosition(Vector3.MoveTowards(elevator.position, floors[targetFloor].level.position, elevatorSpeed * Time.deltaTime));
		}
	}
	public class Rotator : MonoBehaviour
	{
		private void Update()
		{
			((Component)this).transform.Rotate(0f, 20f, 0f);
		}
	}
	public class TriggerSystem : MonoBehaviour
	{
		public int index = 0;

		public virtual void InvokeTrigger(TriggerSystem invoker)
		{
		}

		private void Start()
		{
			Debug.Log((object)"Alive");
		}
	}
	public class TriggerZone : TriggerSystem
	{
		public TriggerSystem triggerSystem;

		private void OnTriggerEnter(Collider collider)
		{
			triggerSystem.InvokeTrigger(this);
		}
	}
	[RequireComponent(typeof(BoxCollider))]
	public class PlayerTeleportTrigger : MonoBehaviour
	{
		public Transform teleportLocation;

		private BoxCollider boxBounds;

		private void Start()
		{
			boxBounds = ((Component)this).GetComponent<BoxCollider>();
		}

		private void OnTriggerEnter(Collider collider)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GM.CurrentMovementManager.TeleportToPoint(teleportLocation.position, true, teleportLocation.forward);
		}
	}
}