Decompiled source of RailgunnerBackpackRemover v0.1.0

plugins/Railgunner Backpack Remover/BackpackRemover.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using On.RoR2;
using R2API.Utils;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BackpackRemover;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.AntlerShed.BackpackRemover", "Railgunner Backpack Remover", "0.1.0")]
[R2APISubmoduleDependency(new string[] { "LoadoutAPI" })]
public class BackpackRemoverMain : BaseUnityPlugin
{
	public const string GUID = "com.AntlerShed.BackpackRemover";

	public const string MODNAME = "Railgunner Backpack Remover";

	public const string VERSION = "0.1.0";

	public static BackpackRemoverMain Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
	}

	private void OnEnable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		SkinDef.Apply += new hook_Apply(OnApplySkin);
	}

	private void OnDisable()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		SkinDef.Apply -= new hook_Apply(OnApplySkin);
	}

	private void OnApplySkin(orig_Apply orig, SkinDef self, GameObject modelObject)
	{
		if (((Object)modelObject).name.ToLower().Contains("mdlrailgunner"))
		{
			Transform obj = modelObject.transform.Find("mdlRailgunBackpackMesh");
			if (obj != null)
			{
				GameObject gameObject = ((Component)obj).gameObject;
				if (gameObject != null)
				{
					gameObject.SetActive(false);
				}
			}
			Transform obj2 = modelObject.transform.Find("mdlRailGunBackpackScreen");
			if (obj2 != null)
			{
				GameObject gameObject2 = ((Component)obj2).gameObject;
				if (gameObject2 != null)
				{
					gameObject2.SetActive(false);
				}
			}
			Transform obj3 = modelObject.transform.Find("RailGunnerArmature/ROOT/base/stomach/backpack/StatusLED, Backpack");
			if (obj3 != null)
			{
				GameObject gameObject3 = ((Component)obj3).gameObject;
				if (gameObject3 != null)
				{
					gameObject3.SetActive(false);
				}
			}
			Transform obj4 = modelObject.transform.Find("RailGunnerArmature/ROOT/base/stomach/backpack/PowerLED, Barrel");
			if (obj4 != null)
			{
				GameObject gameObject4 = ((Component)obj4).gameObject;
				if (gameObject4 != null)
				{
					gameObject4.SetActive(false);
				}
			}
			Transform obj5 = modelObject.transform.Find("RailGunnerArmature/ROOT/base/stomach/backpack/AllBackpackVFX Root");
			if (obj5 != null)
			{
				GameObject gameObject5 = ((Component)obj5).gameObject;
				if (gameObject5 != null)
				{
					gameObject5.SetActive(false);
				}
			}
		}
		orig.Invoke(self, modelObject);
	}
}