using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalBugFix.Patches;
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("LethalBugFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalBugFix")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("54fac0fb-af28-42d5-9eb1-cc95391efc35")]
[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 LethalBugFix
{
[BepInPlugin("Murry.LethalBugFix", "Lethal Bug Fix", "1.0.0.0")]
public class ModBase : BaseUnityPlugin
{
private const string modGUID = "Murry.LethalBugFix";
private const string modName = "Lethal Bug Fix";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Murry.LethalBugFix");
private static ModBase instance;
private ManualLogSource logSource;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
logSource = Logger.CreateLogSource("Murry.LethalBugFix");
logSource.LogInfo((object)"Lethal Bug Fix has AWOKEN!");
harmony.PatchAll(typeof(ModBase));
harmony.PatchAll(typeof(LightningPatch));
}
}
}
namespace LethalBugFix.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class LightningPatch
{
[HarmonyPatch("GrabObject")]
[HarmonyPostfix]
private static void deathByObject(ref int ___health, ref PlayerControllerB __instance, ref GrabbableObject ___currentlyGrabbingObject)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
if (___currentlyGrabbingObject.itemProperties.itemName.ToLower().Contains("hive"))
{
ManualLogSource val = Logger.CreateLogSource("arbitrarilylongnamethatwillnotcompetewithanyothernameinthegame");
val.LogInfo((object)"We trying ta kill ya.");
__instance.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0);
}
}
}
}