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 Debugify v0.2.0
Debugify.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Debugify.Core; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("Debugify")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Corrects a number of shortcomings and bugs in the game. With configuration")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0+8c88b56e805b83788e4aaa058f577ba51542f1de")] [assembly: AssemblyProduct("Debugify")] [assembly: AssemblyTitle("Debugify")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.0.0")] [module: UnverifiableCode] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Debugify { [BepInPlugin("Hypick.Debugify", "Debugify", "0.2.0")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("Hypick.Debugify"); internal static Plugin Instance { get; private set; } public static PluginConfig Config { get; internal set; } internal static ManualLogSource Logger { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; Config = new PluginConfig(((BaseUnityPlugin)this).Config); harmony.PatchAll(); Logger.LogInfo((object)"Plugin Hypick.Debugify is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Debugify"; public const string PLUGIN_NAME = "Debugify"; public const string PLUGIN_VERSION = "0.2.0"; } } namespace Debugify.Patch { [HarmonyPatch(typeof(BlobAI))] internal class BlobAIPatch { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static bool OnCollideWithPlayer(BlobAI __instance) { if (Plugin.Config.SlimeBoomboxFix) { float value = Traverse.Create((object)__instance).Field("tamedTimer").GetValue<float>(); float value2 = Traverse.Create((object)__instance).Field("angeredTimer").GetValue<float>(); return !(value > 0f) || !(value2 <= 0f); } return true; } } [HarmonyPatch(typeof(BoomboxItem))] internal class BoomboxItemPatch { [HarmonyPatch("PocketItem")] [HarmonyPrefix] private static bool PocketItem(BoomboxItem __instance) { if (Plugin.Config.BoomboxPocketFix) { GrabbableObject component = ((Component)__instance).GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { component.EnableItemMeshes(false); } } return false; } } [HarmonyPatch(typeof(FlashlightItem))] internal class FlashlightItemPatch { [HarmonyPatch("DiscardItem")] [HarmonyPostfix] private static void DiscardItem(FlashlightItem __instance) { if (Plugin.Config.FlashlightDiscardFix && ((GrabbableObject)__instance).isBeingUsed) { ((GrabbableObject)__instance).isBeingUsed = false; ((Behaviour)__instance.flashlightBulb).enabled = ((GrabbableObject)__instance).isBeingUsed; ((Behaviour)__instance.flashlightBulbGlow).enabled = ((GrabbableObject)__instance).isBeingUsed; if ((Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null) { ((Behaviour)((GrabbableObject)__instance).playerHeldBy.helmetLight).enabled = ((GrabbableObject)__instance).isBeingUsed; } __instance.flashlightAudio.PlayOneShot(__instance.flashlightClips[Random.Range(0, __instance.flashlightClips.Length)]); if (Plugin.Config.DEBUGMODE) { Plugin.Logger.LogInfo((object)"Flashlight disabled"); } } } [HarmonyPatch("SwitchFlashlight")] [HarmonyPostfix] private static void SwitchFlashlight(FlashlightItem __instance, bool on) { if (!(Plugin.Config.SwitchFlashlightFix && on)) { return; } for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { GrabbableObject obj = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i]; FlashlightItem val = (FlashlightItem)(object)((obj is FlashlightItem) ? obj : null); if (val != null && !((Object)(object)val == (Object)(object)__instance) && ((GrabbableObject)val).isBeingUsed) { ((GrabbableObject)val).isBeingUsed = false; ((GrabbableObject)val).PocketItem(); if (Plugin.Config.DEBUGMODE) { Plugin.Logger.LogInfo((object)$"The flashlight is disabled in slot {i} goes out after turning on the flashlight in another slot"); } } } } } [HarmonyPatch(typeof(MaskedPlayerEnemy))] internal class MaskedPlayerEnemyPatch { [HarmonyPatch("CancelSpecialAnimationWithPlayer")] [HarmonyPrefix] private static void CancelSpecialAnimationWithPlayer(MaskedPlayerEnemy __instance) { __instance.FinishKillAnimation(false); if (Plugin.Config.MaskedAnimationFix && (Object)(object)((EnemyAI)__instance).inSpecialAnimationWithPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.HUDAnimator.SetBool("biohazardDamage", false); HUDManager.Instance.HideHUD(true); HUDManager.Instance.HideHUD(false); if (Plugin.Config.DEBUGMODE) { Plugin.Logger.LogInfo((object)"biohazardDamage animation disabled"); } } } } internal class PlayerControllerBPatch { private static void SwitchToItemSlot(PlayerControllerB __instance) { } } internal class ShipTeleporterPatch { } [HarmonyPatch(typeof(WalkieTalkie))] internal class WalkieTalkiePatch { [HarmonyPatch("DiscardItem")] [HarmonyPostfix] private static void DiscardItem(WalkieTalkie __instance) { if (Plugin.Config.WalkieTalkieDiscardFix && ((GrabbableObject)__instance).isBeingUsed) { DisableWalkieTalkie(__instance); if (Plugin.Config.DEBUGMODE) { Plugin.Logger.LogInfo((object)"Walkie talkie disabled"); } } } [HarmonyPatch("SwitchWalkieTalkieOn")] [HarmonyPostfix] private static void SwitchWalkieTalkieOn(WalkieTalkie __instance, bool on) { if (!(Plugin.Config.SwitchWalkieTalkieFix && on)) { return; } for (int i = 0; i < ((GrabbableObject)__instance).playerHeldBy.ItemSlots.Length; i++) { GrabbableObject obj = ((GrabbableObject)__instance).playerHeldBy.ItemSlots[i]; WalkieTalkie val = (WalkieTalkie)(object)((obj is WalkieTalkie) ? obj : null); if (val != null && !((Object)(object)val != (Object)(object)__instance) && !((GrabbableObject)val).isBeingUsed) { DisableWalkieTalkie(val); if (Plugin.Config.DEBUGMODE) { Plugin.Logger.LogInfo((object)$"The walkie talkie is disabled in slot {i} goes out after turning on the walkie talkie in another slot"); } } } } private static void DisableWalkieTalkie(WalkieTalkie __instance) { ((GrabbableObject)__instance).isBeingUsed = false; ((Renderer)((GrabbableObject)__instance).mainObjectRenderer).sharedMaterial = __instance.offMaterial; ((Behaviour)__instance.walkieTalkieLight).enabled = ((GrabbableObject)__instance).isBeingUsed; __instance.EnableWalkieTalkieListening(false); __instance.thisAudio.PlayOneShot(__instance.switchWalkieTalkiePowerOff); } } } namespace Debugify.Core { public class PluginConfig { private static string GENERAL = "GENERAL"; private static string FIXES = "FIXES"; public bool DEBUGMODE { get; private set; } public bool FlashlightDiscardFix { get; private set; } public bool SwitchFlashlightFix { get; private set; } public bool WalkieTalkieDiscardFix { get; private set; } public bool SwitchWalkieTalkieFix { get; private set; } public bool MaskedAnimationFix { get; private set; } public bool SlimeBoomboxFix { get; private set; } public bool BoomboxPocketFix { get; private set; } public PluginConfig(ConfigFile cfg) { DEBUGMODE = cfg.Bind<bool>(GENERAL, "DEBUG", true, "Enabling this option will allow you to display debugging information in the console.").Value; FlashlightDiscardFix = cfg.Bind<bool>(FIXES, "FlashlightDiscardFix", true, "Enabling this option will turn off any flashlights you throw away.").Value; SwitchFlashlightFix = cfg.Bind<bool>(FIXES, "SwitchFlashlightFix", true, "When you turn on a flashlight, it turns off all other flashlights in your inventory.").Value; WalkieTalkieDiscardFix = cfg.Bind<bool>(FIXES, "WalkieTalkieDiscardFix", false, "Enabling this option will turn off any walkie talkie you throw away.").Value; SwitchWalkieTalkieFix = cfg.Bind<bool>(FIXES, "SwitchWalkieTalkieFix", true, "When you turn on a walkie talkie, it turns off all other walkie talkie in your inventory.").Value; MaskedAnimationFix = cfg.Bind<bool>(FIXES, "MaskedAnimationFix", true, "Fixes a bug where the vomiting animation would not disappear until you died.").Value; SlimeBoomboxFix = cfg.Bind<bool>(FIXES, "SlimeBoomboxFix", true, "Fixes a bug where the slime would cause damage while the boombox was playing").Value; BoomboxPocketFix = cfg.Bind<bool>(FIXES, "BoomboxPocketFix", true, "Fixes a bug where the boombox would stop playing if switched in the inventory").Value; } } public static class Metadata { public const string PLUGIN_GUID = "Hypick.Debugify"; public const string PLUGIN_NAME = "Debugify"; public const string PLUGIN_VERSION = "0.2.0"; } }