Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FuseExtractionReporter v1.1.4
BepInEx\plugins\FuseExtractionReporter\FuseExtractionReporter.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FuseExtractionReporter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FuseExtractionReporter")] [assembly: AssemblyTitle("FuseExtractionReporter")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FuseExtractionReporter { [BepInPlugin("musek.fuseextractionreporter", "Fuse Extraction Reporter", "1.1.4")] public sealed class Plugin : BaseUnityPlugin { internal const string PluginGuid = "musek.fuseextractionreporter"; internal const string PluginName = "Fuse Extraction Reporter"; internal const string PluginVersion = "1.1.4"; private static bool inputPollingStarted; private static bool f5Held; private static bool f6Held; private static readonly MethodInfo DisplayGlobalNotificationMethod = AccessTools.Method(typeof(HUDManager), "DisplayGlobalNotification", (Type[])null, (Type[])null); internal static ManualLogSource Log { get; private set; } = null; internal static string PullerName { get; set; } = "None"; internal static ConfigEntry<bool> EnableDebugHotkeys { get; private set; } = null; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; EnableDebugHotkeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebugHotkeys", false, "Enable F5 notification preview and F6 teleport-to-fuse testing shortcuts."); Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, "musek.fuseextractionreporter"); Log.LogInfo((object)string.Format("{0} {1} loaded. Debug hotkeys enabled: {2}", "Fuse Extraction Reporter", "1.1.4", EnableDebugHotkeys.Value)); } internal static void PollDebugKeys() { if (!EnableDebugHotkeys.Value) { return; } Keyboard current = Keyboard.current; if (current != null) { if (!inputPollingStarted) { inputPollingStarted = true; Log.LogInfo((object)"Debug key polling active. Press F5 for notification or F6 for fuse teleport."); } bool isPressed = ((ButtonControl)current.f5Key).isPressed; bool isPressed2 = ((ButtonControl)current.f6Key).isPressed; if (isPressed && !f5Held) { Log.LogInfo((object)"F5 debug key pressed."); ShowFuseNotification(); } if (isPressed2 && !f6Held) { Log.LogInfo((object)"F6 debug key pressed."); TeleportToFuseRoom(); } f5Held = isPressed; f6Held = isPressed2; } } internal static void ShowFuseNotification() { if ((Object)(object)HUDManager.Instance == (Object)null) { Log.LogWarning((object)"Could not display notification because HUDManager is not ready."); return; } if (DisplayGlobalNotificationMethod == null) { Log.LogError((object)"Could not find HUDManager.DisplayGlobalNotification."); return; } string text = "Player who pulled the fuse: " + PullerName; Log.LogInfo((object)("Displaying notification: " + text)); DisplayGlobalNotificationMethod.Invoke(HUDManager.Instance, new object[1] { text }); } private static void TeleportToFuseRoom() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)val == (Object)null) { Log.LogWarning((object)"Could not teleport because the local player is not ready."); return; } LungProp val2 = null; LungProp[] array = Object.FindObjectsByType<LungProp>((FindObjectsSortMode)0); foreach (LungProp val3 in array) { if (val3.isLungDocked) { val2 = val3; break; } } if ((Object)(object)val2 == (Object)null) { Log.LogWarning((object)"F6 teleport failed: no docked apparatus was found."); DisplayDebugNotification("No docked fuse found on this map."); return; } Vector3 position = ((Component)val2).transform.position; NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val4, 6f, -1)) { position = ((NavMeshHit)(ref val4)).position; } else { position += Vector3.up; Log.LogWarning((object)"No nearby NavMesh point found for the apparatus; using its position."); } val.TeleportPlayer(position, false, 0f, false, true); val.isInsideFactory = true; val.isInElevator = false; val.isInHangarShipRoom = false; Log.LogInfo((object)$"Teleported local player to docked apparatus at {position}."); DisplayDebugNotification("Teleported to the fuse room."); } private static void DisplayDebugNotification(string message) { if ((Object)(object)HUDManager.Instance != (Object)null && DisplayGlobalNotificationMethod != null) { DisplayGlobalNotificationMethod.Invoke(HUDManager.Instance, new object[1] { message }); } } } [HarmonyPatch(typeof(HUDManager), "Update")] internal static class HudManagerUpdatePatch { private static void Postfix() { Plugin.PollDebugKeys(); } } [HarmonyPatch(typeof(LungProp), "EquipItem")] internal static class LungPropEquipItemPatch { private static void Prefix(LungProp __instance) { if (__instance.isLungDocked) { PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; Plugin.PullerName = (((Object)(object)playerHeldBy != (Object)null && !string.IsNullOrWhiteSpace(playerHeldBy.playerUsername)) ? playerHeldBy.playerUsername : "None"); Plugin.Log.LogInfo((object)("Apparatus removed by: " + Plugin.PullerName)); Plugin.ShowFuseNotification(); } } } }