Decompiled source of Teleport Platforms v1.0.1

Teleport_Thingy.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BoplFixedMath;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Teleport_Thingy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Teleport_Thingy")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0460d0a2-fff8-4a5b-ac4a-29c7832e1a7a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Teleport_Thingy;

[BepInPlugin("com.000diggity000.teleport_platforms", "Teleport Platforms", "1.0.0")]
public class Main : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.000diggity000.teleport_platforms");
		val.PatchAll(typeof(Patches));
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Teleport Platforms Loaded");
	}
}
public class Patches
{
	[HarmonyPatch(typeof(TeleportIndicator), "teleportObject")]
	[HarmonyPrefix]
	public static bool Patch(TeleportIndicator __instance, ref FixTransform teleportedObj, ref Vec2 diff, ref int ___abilityLayer, ref int ___playerLayer, ref int ___groundLayer, ref TeleportedObjectEffect ___teleportingSpriteEffectPrefab)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: 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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: 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)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		Fix rotation = teleportedObj.rotation;
		if (((Component)teleportedObj).gameObject.layer == ___playerLayer || ((Component)teleportedObj).gameObject.layer == ___abilityLayer)
		{
			PlayerPhysics component = ((Component)teleportedObj).GetComponent<PlayerPhysics>();
			PlayerBody val = (((Object)(object)component != (Object)null) ? component.GetPlayerBody() : null);
			if ((Object)(object)val != (Object)null && !((MonoUpdatable)val).IsDestroyed)
			{
				val.AttachRope((RopeBody)null, val.topAttachment);
				component.GetPlayerBody().selfImposedVelocity = Vec2.zero;
			}
			if ((Object)(object)component != (Object)null && !((MonoUpdatable)component).IsDestroyed)
			{
				component.UnGround(true, false);
			}
		}
		SpriteRenderer val2 = ((Component)teleportedObj).GetComponent<SpriteRenderer>();
		if ((Object)(object)val2 == (Object)null)
		{
			SlimeController component2 = ((Component)teleportedObj).GetComponent<SlimeController>();
			val2 = (((Object)(object)component2 != (Object)null) ? component2.GetPlayerSprite() : null);
		}
		if ((Object)(object)val2 != (Object)null)
		{
			TeleportedObjectEffect val3 = FixTransform.InstantiateFixed<TeleportedObjectEffect>(___teleportingSpriteEffectPrefab, teleportedObj.position, rotation);
			val3.Initialize(teleportedObj, val2);
			SpriteRenderer component3 = ((Component)val3).GetComponent<SpriteRenderer>();
			component3.sprite = val2.sprite;
			if (((Component)val2).gameObject.layer == LayerMask.NameToLayer("RigidBodyAffector"))
			{
				component3.sprite = null;
				SpriteRenderer component4 = ((Component)((Component)component3).transform.GetChild(0)).GetComponent<SpriteRenderer>();
				if ((Object)(object)component4 != (Object)null)
				{
					component4.sprite = null;
				}
			}
			FixTransform obj = teleportedObj;
			obj.position += diff;
			((Component)teleportedObj).gameObject.SetActive(false);
		}
		return false;
	}
}