Decompiled source of ZortPlayableAgain v1.0.0

BepInEx/plugins/KRW's Playable Zort Again.dll

Decompiled 4 days ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KRW's Playable Zort Again")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KRW's Playable Zort Again")]
[assembly: AssemblyTitle("KRW's Playable Zort Again")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace KRWPlayableZortAgain;

[BepInPlugin("mods.krwclassic.zortplayableagain", "KRW's Playable Zort Again", "1.0.0")]
public class Class1 : 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("mods.krwclassic.zortplayableagain");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"KRW's Playable Zort Again loaded!");
	}

	private void OnEnable()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	private void OnDisable()
	{
		SceneManager.sceneLoaded -= OnSceneLoaded;
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		if (((Scene)(ref scene)).name == "ZortaganeMapOlan")
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ZortaganeMapOlan scene loaded. Attempting to reposition object.");
			((MonoBehaviour)this).StartCoroutine(RepositionObjectWithRetry("Factory/FactoryFull/Z_Corridor_VentLine_Twin (17)", new Vector3(7.3569f, 4.4719f, 311.4657f)));
		}
	}

	private IEnumerator RepositionObjectWithRetry(string objectPath, Vector3 targetPosition)
	{
		//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)
		GameObject targetObject = null;
		while ((Object)(object)targetObject == (Object)null)
		{
			targetObject = GameObject.Find(objectPath);
			if ((Object)(object)targetObject == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Object '" + objectPath + "' not found. Retrying in 1 second..."));
				yield return (object)new WaitForSeconds(1f);
			}
		}
		targetObject.transform.position = targetPosition;
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"Object '{objectPath}' repositioned to {targetPosition}.");
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "mods.krwclassic.zortplayableagain";

	public const string PLUGIN_NAME = "KRW's Playable Zort Again";

	public const string PLUGIN_VERSION = "1.0.0";
}