Decompiled source of HexNoLavaCraters v1.0.0

Plugins/HexNoLavaCraters.dll

Decompiled a week ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("HexNoLavaCraters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HexNoLavaCraters")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("501c92f8-4a0c-4c44-a5cf-6129a72dbbfa")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HexNoLavaCraters;

[BepInPlugin("com.hex.nolavacraters", "HexNoLavaCraters", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	internal static class PatchZnetSceneAwake
	{
		private static void Postfix(ZNetScene __instance)
		{
			GameObject prefab = __instance.GetPrefab("BlobLava_explosion");
			if ((Object)(object)prefab == (Object)null)
			{
				return;
			}
			Aoe component = prefab.GetComponent<Aoe>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			GameObject spawnOnHitTerrain = component.m_spawnOnHitTerrain;
			if (!((Object)(object)spawnOnHitTerrain == (Object)null))
			{
				TerrainOp component2 = spawnOnHitTerrain.GetComponent<TerrainOp>();
				if (!((Object)(object)component2 == (Object)null))
				{
					component2.m_settings.m_raise = false;
					Log.LogInfo((object)"Disabled lava blob self destruct crater.");
				}
			}
		}
	}

	private const string PluginGuid = "com.hex.nolavacraters";

	private const string PluginName = "HexNoLavaCraters";

	private const string PluginVersion = "1.0.0";

	private Harmony _harmonyInstance;

	internal static ManualLogSource Log;

	internal static Plugin Instance;

	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		_harmonyInstance = new Harmony("com.hex.nolavacraters");
		_harmonyInstance.PatchAll();
		Log.LogInfo((object)"HexNoLavaCraters v1.0.0 loaded.");
	}

	private void OnDestroy()
	{
		Log.LogInfo((object)"HexNoLavaCraters v1.0.0 unloaded.");
		Harmony harmonyInstance = _harmonyInstance;
		if (harmonyInstance != null)
		{
			harmonyInstance.UnpatchSelf();
		}
		_harmonyInstance = null;
		Instance = null;
		Log = null;
	}
}