using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [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("UnbreakableSurfaces")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UnbreakableSurfaces")] [assembly: AssemblyTitle("UnbreakableSurfaces")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 UnbreakableSurfaces { [HarmonyPatch(typeof(BridgeTrigger))] internal static class BridgePatches { [HarmonyPatch("BridgeFallServerRpc")] [HarmonyPrefix] private static bool BlockFallServer() { if (Plugin.Enabled.Value) { return !Plugin.Bridges.Value; } return true; } [HarmonyPatch("BridgeFallClientRpc")] [HarmonyPrefix] private static bool BlockFallClient() { if (Plugin.Enabled.Value) { return !Plugin.Bridges.Value; } return true; } [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void KeepStanding(BridgeTrigger __instance) { if (Plugin.Enabled.Value && Plugin.Bridges.Value && !((Object)(object)__instance == (Object)null)) { if (__instance.bridgeDurability < 1f) { __instance.bridgeDurability = 1f; } __instance.hasBridgeFallen = false; } } } [HarmonyPatch(typeof(BridgeTriggerType2))] internal static class SurfacePatches { [HarmonyPatch("AddToBridgeInstabilityServerRpc")] [HarmonyPrefix] private static bool BlockInstability() { if (Plugin.Enabled.Value) { return !Plugin.BreakableSurfaces.Value; } return true; } [HarmonyPatch("OnTriggerEnter")] [HarmonyPostfix] private static void ResetInstability(BridgeTriggerType2 __instance) { if (Plugin.Enabled.Value && Plugin.BreakableSurfaces.Value && !((Object)(object)__instance == (Object)null)) { __instance.timesTriggered = 0; __instance.bridgeFell = false; } } } [BepInPlugin("com.benhough.lethal.UnbreakableSurfaces", "UnbreakableSurfaces", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string ModGuid = "com.benhough.lethal.UnbreakableSurfaces"; public const string ModName = "UnbreakableSurfaces"; public const string ModVersion = "1.0.0"; internal static ManualLogSource Log { get; private set; } internal static ConfigEntry Enabled { get; private set; } internal static ConfigEntry Bridges { get; private set; } internal static ConfigEntry BreakableSurfaces { get; private set; } private void Awake() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Master toggle."); Bridges = ((BaseUnityPlugin)this).Config.Bind("General", "Bridges", true, "Vow-style bridges never collapse."); BreakableSurfaces = ((BaseUnityPlugin)this).Config.Bind("General", "BreakableSurfaces", true, "Unstable platforms / type-2 bridges never fall."); new Harmony("com.benhough.lethal.UnbreakableSurfaces").PatchAll(typeof(Plugin).Assembly); Log.LogInfo((object)"UnbreakableSurfaces v1.0.0 loaded."); } } internal static class PluginInfo { public const string PLUGIN_GUID = "com.benhough.lethal.UnbreakableSurfaces"; public const string PLUGIN_NAME = "UnbreakableSurfaces"; public const string PLUGIN_VERSION = "1.0.0"; } }