Decompiled source of SlideScaleEX v2.0.1

SlideScaleEX.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
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 Il2CppInterop.Runtime.Injection;
using Il2CppSLZ.Marrow;
using Il2CppTMPro;
using Jevil;
using Jevil.Prefs;
using MelonLoader;
using Microsoft.CodeAnalysis;
using SlideScale;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Scale), "SlideScaleEX", "1.2", "Camobiwon, extraes", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("SlideScale")]
[assembly: AssemblyDescription("Scale items by moving your hands")]
[assembly: AssemblyCopyright("Camobiwon")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyProduct("SlideScale")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 SlideScale
{
	public class ConstForce : MonoBehaviour
	{
		private Rigidbody rb;

		private Vector3 _relativeTorque;

		private Vector3 _relativeForce;

		private bool doTorque;

		private bool doForce;

		public Vector3 relativeTorque
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _relativeTorque;
			}
			set
			{
				//IL_0009: 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)
				doTorque = true;
				_relativeTorque = value;
			}
		}

		public Vector3 relativeForce
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return _relativeForce;
			}
			set
			{
				//IL_0009: 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)
				doForce = true;
				_relativeForce = value;
			}
		}

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

		private void Awake()
		{
			rb = ((Component)this).GetComponent<Rigidbody>();
		}

		private void FixedUpdate()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if (doForce)
			{
				rb.AddRelativeForce(_relativeForce, (ForceMode)1);
			}
			if (doTorque)
			{
				rb.AddRelativeTorque(_relativeTorque, (ForceMode)1);
			}
		}
	}
	[Preferences("SlideScale", false)]
	[PreferencesColor(/*Could not decode attribute arguments.*/)]
	internal static class Prefs
	{
		[RangePref(0f, 0.125f, 0.0125f)]
		internal static float scaleMult = 0.025f;

		[RangePref(0f, 0.5f, 0.025f)]
		internal static float deadzone = 0.1f;

		[RangePref(0f, 10f, 0.25f)]
		internal static float ghostSizeMult = 1f;

		[Pref("Show 'ghosts' of your controllers, showing their real positions instead of where your ingame hands are")]
		internal static bool showGhosts = true;

		[Pref("Increases object mass as you scale up an object and decreases it as you scale it down")]
		internal static bool scaleMass = true;

		[Pref("Toggles the mod on or off without requiring a complete uninstall")]
		internal static bool globalToggle = true;

		[Pref("Shows how big an object is when compared to its original size")]
		internal static bool showSizeText = true;

		[Pref("Does haptic rumble according to how big an object gets")]
		internal static bool useHaptics = true;

		[Pref("", 8f, 1f, 1f)]
		internal static bool minnesota = false;

		public static void Init()
		{
			Preferences.Register(typeof(Prefs), (string)null);
		}
	}
	public class Scale : MelonMod
	{
		internal static Scale instance;

		private GameObject cubeBase;

		private Rigidbody lHandRB;

		private Rigidbody rHandRB;

		private BaseController lController;

		private Transform lControllerT;

		private BaseController rController;

		private Transform rControllerT;

		private GameObject lGhost;

		private GameObject rGhost;

		private GameObject sizeText;

		private RectTransform sizeTextT;

		private TMP_FontAsset sizeTextFont;

		private TextMeshPro sizeTextMesh;

		private float sizeTextTargetAlpha;

		private const string SIZE_TEXT_TEMPLATE = "<line-height=75%><b>{0}x</b>\r\n<line-height=40%><sup><i>{1}m</i></sup>\r\n<sup><i>{2}kg</i></sup>";

		private Rigidbody itemRB;

		private Transform itemT;

		private float distanceCache;

		public Dictionary<Rigidbody, float> originalSizes = new Dictionary<Rigidbody, float>();

		public Dictionary<Rigidbody, Renderer> bodyRenderers = new Dictionary<Rigidbody, Renderer>();

		private static readonly (float min, float max) minnesotaScale = (min: 0.1f, max: 10f);

		private static readonly (float min, float max) minnesotaForce = (min: 50f, max: 150f);

		private static readonly (float min, float max) minnesotaTorque = (min: 50f, max: 150f);

		private static readonly Vector3 minnesotaForceMin = Vector3.one * minnesotaForce.min;

		private static readonly Vector3 minnesotaTorqueMin = Vector3.one * minnesotaTorque.min;

		private bool HandsReadyToScale => Player.RightHand.HasAttachedObject() && Player.LeftHand.HasAttachedObject() && (Object)(object)lHandRB == (Object)(object)rHandRB;

		public Scale()
		{
			instance = this;
		}

		public override void OnInitializeMelon()
		{
			Prefs.Init();
			ClassInjector.RegisterTypeInIl2Cpp<ConstForce>();
			Hooking.OnGrabObject += Grab;
			Hooking.OnReleaseObject += Ungrab;
			Hooking.OnLevelLoaded += delegate
			{
				SetupReferences();
			};
			cubeBase = GameObject.CreatePrimitive((PrimitiveType)3);
			((Collider)cubeBase.GetComponent<BoxCollider>()).enabled = false;
			((Renderer)cubeBase.GetComponent<MeshRenderer>()).material.shader = Shader.Find("Universal Render Pipeline/Lit (PBR Workflow)");
			((Object)cubeBase).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)cubeBase);
			cubeBase.SetActive(false);
			sizeTextFont = TMP_Settings.defaultFontAsset;
		}

		private void SetupReferences()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_013b: 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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Expected O, but got Unknown
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			originalSizes.Clear();
			lController = Player.LeftController;
			lControllerT = ((Component)lController).transform;
			rController = Player.RightController;
			rControllerT = ((Component)rController).transform;
			if ((Object)(object)lGhost != (Object)null)
			{
				Object.Destroy((Object)(object)lGhost);
			}
			lGhost = new GameObject("SlideScale Left Hand Ghost");
			lGhost.transform.parent = lControllerT;
			lGhost.transform.localPosition = Vector3.zero;
			lGhost.transform.rotation = lControllerT.rotation * Quaternion.Euler(90f, 0f, 0f);
			((Object)lGhost).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)lGhost);
			if ((Object)(object)rGhost != (Object)null)
			{
				Object.Destroy((Object)(object)rGhost);
			}
			rGhost = new GameObject("SlideScale Right Hand Ghost");
			rGhost.transform.parent = rControllerT;
			rGhost.transform.localPosition = Vector3.zero;
			rGhost.transform.rotation = rControllerT.rotation * Quaternion.Euler(90f, 0f, 0f);
			((Object)rGhost).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)rGhost);
			if ((Object)(object)sizeText != (Object)null || (Object)(object)sizeTextMesh != (Object)null || (Object)(object)sizeTextT != (Object)null)
			{
				Object.Destroy((Object)(object)sizeText);
			}
			sizeText = new GameObject("SlideScale Size Text");
			sizeTextMesh = sizeText.AddComponent<TextMeshPro>();
			((TMP_Text)sizeTextMesh).horizontalAlignment = (HorizontalAlignmentOptions)2;
			((TMP_Text)sizeTextMesh).verticalAlignment = (VerticalAlignmentOptions)256;
			((TMP_Text)sizeTextMesh).font = sizeTextFont;
			if (!Utilities.IsPlatformQuest())
			{
				((TMP_Text)sizeTextMesh).alpha = 0f;
			}
			sizeTextT = sizeText.GetComponent<RectTransform>();
			Vector3 localScale = Vector3.one * 0.05f;
			localScale.x *= -1f;
			((Transform)sizeTextT).localScale = localScale;
			((Object)sizeText).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)sizeText);
			((Object)sizeTextMesh).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)sizeTextMesh);
			((Object)sizeTextT).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)sizeTextT);
			CreateGhosts();
			lGhost.SetActive(false);
			rGhost.SetActive(false);
			if (Utilities.IsPlatformQuest())
			{
				sizeText.SetActive(false);
			}
		}

		public override void OnUpdate()
		{
			//IL_0007: 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_0021: 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_0030: 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)
			//IL_0036: 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)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = (lControllerT.position + rControllerT.position) / 2f + Player.Head.forward;
			float num = Vector3.Distance(val, ((Transform)sizeTextT).position);
			((Transform)sizeTextT).position = Vector3.Lerp(((Transform)sizeTextT).position, val, num / 2f);
			((Transform)sizeTextT).LookAt(Player.Head.position, Vector3.up);
			if (!Utilities.IsPlatformQuest())
			{
				float num2 = sizeTextTargetAlpha - ((TMP_Text)sizeTextMesh).alpha;
				num2 = ((num2 > 0f) ? (num2 * num2) : (Mathf.Abs(num) / 2f));
				((TMP_Text)sizeTextMesh).alpha = Mathf.Lerp(((TMP_Text)sizeTextMesh).alpha, sizeTextTargetAlpha, num2);
			}
		}

		public override void OnFixedUpdate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			if (!Prefs.globalToggle || Prefs.minnesota || !HandsReadyToScale)
			{
				return;
			}
			float num = Vector3.Distance(lControllerT.position, rControllerT.position);
			Vector3 localScale;
			if (GetBothTriggersHeld() && GetAnyTriggersDown())
			{
				distanceCache = num;
				if (Prefs.showGhosts)
				{
					lGhost.SetActive(true);
					rGhost.SetActive(true);
				}
				if (Prefs.showSizeText)
				{
					ShowSizeText();
					localScale = itemT.localScale;
					float magnitude = ((Vector3)(ref localScale)).magnitude;
					UpdateSizeText(magnitude, magnitude);
				}
			}
			else if (GetAnyTriggersUp())
			{
				lGhost.SetActive(false);
				rGhost.SetActive(false);
				HideSizeText();
			}
			if (!ExceedsDeadzone(num) || !GetBothTriggersHeld())
			{
				return;
			}
			float num2 = 1f + (num - distanceCache) * Prefs.scaleMult;
			localScale = itemT.localScale;
			float magnitude2 = ((Vector3)(ref localScale)).magnitude;
			Transform obj = itemT;
			obj.localScale *= num2;
			localScale = itemT.localScale;
			float magnitude3 = ((Vector3)(ref localScale)).magnitude;
			int num3 = HapticLevel(magnitude2);
			int num4 = HapticLevel(magnitude3);
			if (Prefs.scaleMass)
			{
				Rigidbody obj2 = itemRB;
				obj2.mass *= num2 * num2 * num2;
			}
			if (Prefs.showSizeText)
			{
				UpdateSizeText(magnitude2, magnitude3);
			}
			if (Prefs.useHaptics && num3 != num4)
			{
				if (num4 % 5 == 0)
				{
					rController.haptor.Haptic_Click(true);
					lController.haptor.Haptic_Click(true);
				}
				else
				{
					rController.haptor.Haptic_Subtle();
					lController.haptor.Haptic_Subtle();
				}
			}
		}

		private void UpdateSizeText(float scalePre, float scalePost)
		{
			float num = 1f;
			if (originalSizes.TryGetValue(itemRB, out var value))
			{
				num = scalePost / value;
			}
			else
			{
				originalSizes[itemRB] = scalePre;
			}
			((TMP_Text)sizeTextMesh).text = string.Format("<line-height=75%><b>{0}x</b>\r\n<line-height=40%><sup><i>{1}m</i></sup>\r\n<sup><i>{2}kg</i></sup>", num.ToString("0.00"), CalcItemDiagonalLength().ToString("0.00"), itemRB.mass.ToString("0.00"));
		}

		private float CalcItemDiagonalLength()
		{
			//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_001a: 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)
			Bounds bounds = bodyRenderers[itemRB].bounds;
			return Vector3.Distance(((Bounds)(ref bounds)).min, ((Bounds)(ref bounds)).max);
		}

		private void Grab(GameObject go, Hand hand)
		{
			//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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			Transform transform = go.transform;
			itemRB = ((Component)transform).GetComponentInParent<Rigidbody>();
			if ((Object)(object)itemRB == (Object)null)
			{
				Warn("Unable to find Rigidbody component in grabbed object " + Extensions.GetFullPath(transform));
				itemT = null;
				return;
			}
			itemT = ((Component)itemRB).transform;
			if (!originalSizes.ContainsKey(itemRB))
			{
				Dictionary<Rigidbody, float> dictionary = originalSizes;
				Rigidbody key = itemRB;
				Vector3 localScale = itemT.localScale;
				dictionary[key] = ((Vector3)(ref localScale)).magnitude;
			}
			if (!bodyRenderers.ContainsKey(itemRB))
			{
				bodyRenderers[itemRB] = ((Component)itemRB).GetComponentInChildren<Renderer>();
			}
			if ((int)hand.handedness == 1)
			{
				lHandRB = itemRB;
			}
			else
			{
				rHandRB = itemRB;
			}
			distanceCache = Vector3.Distance(lControllerT.position, rControllerT.position);
			if (Prefs.minnesota)
			{
				Transform obj = itemT;
				obj.localScale *= Random.Range(minnesotaScale.min, minnesotaScale.max);
				ConstForce constForce = ((Component)itemT).gameObject.GetComponent<ConstForce>() ?? ((Component)itemT).gameObject.AddComponent<ConstForce>();
				(Vector3 force, Vector3 torque) minnesotaVectors = GetMinnesotaVectors();
				Vector3 item = minnesotaVectors.force;
				Vector3 item2 = minnesotaVectors.torque;
				constForce.relativeForce = item * itemRB.mass;
				constForce.relativeTorque = item2 * itemRB.mass;
			}
		}

		private (Vector3 force, Vector3 torque) GetMinnesotaVectors()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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)
			//IL_002a: 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_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)
			//IL_0036: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Random.insideUnitSphere * minnesotaForce.max;
			Vector3 val2 = Random.insideUnitSphere * minnesotaTorque.max;
			return (force: Vector3.Max(val, minnesotaForceMin), torque: Vector3.Max(val2, minnesotaTorqueMin));
		}

		private void Ungrab(Hand hand)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)hand.handedness == 1)
			{
				lHandRB = null;
			}
			else
			{
				rHandRB = null;
			}
			lGhost.SetActive(false);
			rGhost.SetActive(false);
			HideSizeText();
		}

		private void CreateGhosts()
		{
			//IL_0011: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0092: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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)
			CreateGhostCube(new Vector3(0.04f, 0.005f, 0.005f), lGhost.transform, Color.red);
			CreateGhostCube(new Vector3(0.005f, 0.04f, 0.005f), lGhost.transform, Color.green);
			CreateGhostCube(new Vector3(0.005f, 0.005f, -0.04f), lGhost.transform, Color.blue);
			CreateGhostCube(new Vector3(-0.04f, 0.005f, 0.005f), rGhost.transform, Color.red);
			CreateGhostCube(new Vector3(0.005f, 0.04f, 0.005f), rGhost.transform, Color.green);
			CreateGhostCube(new Vector3(0.005f, 0.005f, -0.04f), rGhost.transform, Color.blue);
		}

		private void CreateGhostCube(Vector3 scale, Transform parent, Color color)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(cubeBase);
			val.transform.SetParent(parent, false);
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = scale * Prefs.ghostSizeMult;
			val.transform.localPosition = new Vector3(scale.x / 2f, scale.y / 2f, scale.z / 2f);
			Renderer component = val.GetComponent<Renderer>();
			component.material.color = color;
			component.shadowCastingMode = (ShadowCastingMode)0;
			val.SetActive(true);
		}

		private int HapticLevel(float magnitude)
		{
			return Mathf.CeilToInt(10f * Mathf.Log10(2f * magnitude));
		}

		private void ShowSizeText()
		{
			if (!Utilities.IsPlatformQuest())
			{
				sizeTextTargetAlpha = 1f;
			}
			else
			{
				sizeText.SetActive(true);
			}
		}

		private void HideSizeText()
		{
			if (!Utilities.IsPlatformQuest())
			{
				sizeTextTargetAlpha = 0f;
			}
			else
			{
				sizeText.SetActive(false);
			}
		}

		private bool GetAnyTriggersDown()
		{
			return lController.GetPrimaryInteractionButtonDown() || rController.GetPrimaryInteractionButtonDown();
		}

		private bool GetAnyTriggersUp()
		{
			return lController.GetPrimaryInteractionButtonUp() || rController.GetPrimaryInteractionButtonUp();
		}

		private bool GetBothTriggersHeld()
		{
			return lController.GetPrimaryInteractionButton() && rController.GetPrimaryInteractionButton();
		}

		private bool ExceedsDeadzone(float distance)
		{
			return distance > distanceCache + Prefs.deadzone || distance < distanceCache - Prefs.deadzone;
		}

		internal static void Log(string msg)
		{
			((MelonBase)instance).LoggerInstance.Msg(msg);
		}

		internal static void Warn(string msg)
		{
			((MelonBase)instance).LoggerInstance.Warning(msg);
		}
	}
}