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 HazardControl v1.0.1
HazardControl.dll
Decompiled 2 years agousing System; using System.Collections; using System.Diagnostics; using System.Linq; 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 GameNetcodeStuff; using HarmonyLib; using HazardControl.Behaviors; using HazardControl.NetcodePatcher; using Microsoft.CodeAnalysis; using Unity.Netcode; 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("HazardControl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Disable mines and turrets for your own safety.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+8bec0ad44cf86643d71ff16693628a2935aa435a")] [assembly: AssemblyProduct("HazardControl")] [assembly: AssemblyTitle("HazardControl")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 HazardControl { [BepInPlugin("HazardControl", "HazardControl", "1.0.1")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private static Harmony _globalHarmony; internal static ManualLogSource Log { get; private set; } internal static PluginConfigStruct GameConfig { get; private set; } private void Awake() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HazardControl is loaded!"); PatchNetwork(); _globalHarmony = new Harmony("HazardControl"); _globalHarmony.PatchAll(); PluginConfigStruct gameConfig = default(PluginConfigStruct); gameConfig.TurretsKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Keys", "TurretsKey", true, "Allows the use of keys to disable turrets."); gameConfig.MinesKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Keys", "MinesKey", true, "Allows the use of keys to disable mines."); gameConfig.KeyUseProbability = ((BaseUnityPlugin)this).Config.Bind<int>("Keys", "KeyUseProbability", 80, "Probability (0-100) to consume a key when used."); gameConfig.TurretsZap = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap", "TurretsZap", true, "Allows the use of ZapGun to temporarily disable turrets."); gameConfig.MinesZap = ((BaseUnityPlugin)this).Config.Bind<bool>("Zap", "MinesZap", true, "Allows the use of ZapGun to trigger mines."); gameConfig.EnemiesTriggerMines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnemiesTriggerMines", true, "Enemies can trigger mines when they walk on it."); GameConfig = gameConfig; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; } private static void PatchNetwork() { try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { Log.LogInfo((object)("Initialize network patch for " + type.FullName)); methodInfo.Invoke(null, null); } } } } catch (Exception) { } } } internal struct PluginConfigStruct { public ConfigEntry<bool> TurretsKey; public ConfigEntry<bool> MinesKey; public ConfigEntry<int> KeyUseProbability; public ConfigEntry<bool> TurretsZap; public ConfigEntry<bool> MinesZap; public ConfigEntry<bool> EnemiesTriggerMines; } public static class PluginInfo { public const string PLUGIN_GUID = "HazardControl"; public const string PLUGIN_NAME = "HazardControl"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace HazardControl.Patches { [HarmonyPatch(typeof(KeyItem))] internal class KeyItemPatch { [HarmonyPatch("ItemActivate")] [HarmonyPostfix] public static void ItemActivate(ref KeyItem __instance, bool used, bool buttonDown = true) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || !((NetworkBehaviour)__instance).IsOwner) { return; } RaycastHit? val = null; RaycastHit[] array = Physics.RaycastAll(new Ray(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward), 3f, 2097152); for (int i = 0; i < array.Length; i++) { RaycastHit value = array[i]; bool flag = ((Component)((RaycastHit)(ref value)).transform).gameObject.layer != 21; if (!flag) { bool flag2; switch (((Object)((RaycastHit)(ref value)).transform).name) { case "Landmine": case "TurretContainer": case "TurretScript": flag2 = true; break; default: flag2 = false; break; } flag = !flag2; } if (!flag) { val = value; break; } } if (!val.HasValue) { Plugin.Log.LogDebug((object)$"[Landmine/Turret] Raycast failed, IsOwner={((NetworkBehaviour)__instance).IsOwner}, IsHeld={(Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null}"); return; } Vector3 position = ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position; RaycastHit value2 = val.Value; float num = Vector3.Distance(position, ((RaycastHit)(ref value2)).transform.position); ManualLogSource log = Plugin.Log; value2 = val.Value; string name = ((Object)((RaycastHit)(ref value2)).transform).name; value2 = val.Value; log.LogDebug((object)$"[Landmine/Turret] GameObject hit {name} in layer {((Component)((RaycastHit)(ref value2)).transform).gameObject.layer} at a distance of {num}"); value2 = val.Value; Landmine obj = ((Component)((RaycastHit)(ref value2)).transform).GetComponentInChildren<Landmine>(); if (obj == null) { value2 = val.Value; obj = ((Component)((RaycastHit)(ref value2)).transform).GetComponent<Landmine>(); } Landmine val2 = obj; if ((Object)(object)val2 != (Object)null && !val2.hasExploded && val2.mineActivated) { val2.ToggleMine(false); ((Behaviour)val2.mineAnimator).enabled = false; if (Random.RandomRangeInt(0, 100) < Plugin.GameConfig.KeyUseProbability.Value) { ((GrabbableObject)__instance).playerHeldBy.DespawnHeldObject(); } return; } value2 = val.Value; Turret obj2 = ((Component)((RaycastHit)(ref value2)).transform).GetComponentInChildren<Turret>(); if (obj2 == null) { value2 = val.Value; obj2 = ((Component)((RaycastHit)(ref value2)).transform).GetComponent<Turret>(); } Turret val3 = obj2; if ((Object)(object)val3 != (Object)null && val3.turretActive) { val3.ToggleTurretEnabled(false); if (Random.RandomRangeInt(0, 100) < Plugin.GameConfig.KeyUseProbability.Value) { ((GrabbableObject)__instance).playerHeldBy.DespawnHeldObject(); } } else { ManualLogSource log2 = Plugin.Log; object arg = val2?.hasExploded; value2 = val.Value; log2.LogDebug((object)$"[Landmine/Turret] Could not find a landmine or a turret component :( HasExploded={arg} GOLayer={((Component)((RaycastHit)(ref value2)).transform).gameObject.layer}"); } } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] private static bool PreOnTriggerEnter(ref Landmine __instance) { return __instance.mineActivated; } [HarmonyPatch("OnTriggerEnter")] [HarmonyPostfix] private static void OnTriggerEnter(ref Landmine __instance, Collider other) { if (!__instance.hasExploded && !((double)__instance.pressMineDebounceTimer > 0.0) && !((Component)other).CompareTag("Player") && !((Component)other).CompareTag("PhysicsProp") && !((Component)other).tag.StartsWith("PlayerRagdoll") && NetworkManager.Singleton.IsServer && Plugin.GameConfig.EnemiesTriggerMines.Value && ((Component)other).gameObject.layer == 19) { __instance.pressMineDebounceTimer = 0.5f; __instance.PressMineServerRpc(); } } [HarmonyPatch("OnTriggerExit")] [HarmonyPostfix] private static void OnTriggerExit(ref Landmine __instance, Collider other) { if (!__instance.hasExploded && __instance.mineActivated && !((Component)other).CompareTag("Player") && !((Component)other).CompareTag("PhysicsProp") && !((Component)other).tag.StartsWith("PlayerRagdoll") && NetworkManager.Singleton.IsServer && Plugin.GameConfig.EnemiesTriggerMines.Value && ((Component)other).gameObject.layer == 19) { __instance.TriggerMineOnLocalClientByExiting(); } } [HarmonyPatch("ToggleMineEnabledLocalClient")] [HarmonyPostfix] private static void ToggleMineEnabledLocalClient(ref Landmine __instance) { if (((Behaviour)__instance.mineAnimator).enabled != __instance.mineActivated) { ((Behaviour)__instance.mineAnimator).enabled = __instance.mineActivated; } } } [HarmonyPatch(typeof(PatcherTool))] internal class PatcherToolPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void Start(ref PatcherTool __instance) { PatcherTool obj = __instance; obj.anomalyMask |= 0x200000; } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { [HarmonyPatch("Awake")] [HarmonyPostfix] private static void Awake() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>().Where(delegate(GameObject o) { switch (((Object)o).name) { case "Landmine": case "TurretScript": case "TurretContainer": return true; default: return false; } }).ToArray(); foreach (GameObject val in array) { switch (((Object)val).name) { case "TurretContainer": if (Plugin.GameConfig.TurretsKey.Value) { GameObject val3 = new GameObject("PickableZone", new Type[3] { typeof(InteractTrigger), typeof(DisarmTurret), typeof(BoxCollider) }) { layer = 9, tag = "InteractTrigger" }; val3.transform.position = val.transform.position; val3.transform.parent = val.transform; BoxCollider component2 = val3.GetComponent<BoxCollider>(); component2.size = new Vector3(0.75f, 2f, 1f); component2.center = new Vector3(0f, 1f, 0f); ((Collider)component2).excludeLayers = LayerMask.op_Implicit(2097152); ((Collider)component2).isTrigger = true; } break; case "TurretScript": if (Plugin.GameConfig.TurretsZap.Value) { val.gameObject.AddComponent<ShockableTurret>(); } break; case "Landmine": if (val.GetComponent<Landmine>() != null && Plugin.GameConfig.MinesZap.Value) { val.gameObject.AddComponent<ShockableMine>(); } if (val.GetComponent<Landmine>() == null && Plugin.GameConfig.MinesKey.Value) { GameObject val2 = new GameObject("PickableZone", new Type[3] { typeof(InteractTrigger), typeof(DisarmMine), typeof(BoxCollider) }) { layer = 9, tag = "InteractTrigger" }; val2.transform.position = val.transform.position; val2.transform.parent = val.transform; BoxCollider component = val2.GetComponent<BoxCollider>(); component.size = Vector3.one; component.center = Vector3.zero; ((Collider)component).excludeLayers = LayerMask.op_Implicit(2097152); ((Collider)component).isTrigger = true; } break; } } ((Component)StartOfRound.Instance).gameObject.AddComponent<HazardControlConfigSync>(); } } } namespace HazardControl.Behaviors { [RequireComponent(typeof(InteractTrigger))] internal class DisarmMine : NetworkBehaviour { private Landmine mine; private InteractTrigger mineTrigger; public void Awake() { mineTrigger = ((Component)this).GetComponent<InteractTrigger>(); ((Behaviour)mineTrigger).enabled = true; mineTrigger.interactable = false; mineTrigger.touchTrigger = false; mineTrigger.disableTriggerMesh = false; mineTrigger.disabledHoverTip = "Armed"; mineTrigger.hoverTip = mineTrigger.disabledHoverTip; } private void Update() { if (mine == null) { Transform parent = ((Component)this).transform.parent; object obj = ((parent != null) ? ((Component)parent).GetComponent<Landmine>() : null); if (obj == null) { Transform parent2 = ((Component)this).transform.parent; obj = ((parent2 != null) ? ((Component)parent2).GetComponentInChildren<Landmine>() : null); } mine = (Landmine)obj; } if (!Object.op_Implicit((Object)(object)mine)) { return; } if (mine.hasExploded) { mineTrigger.disabledHoverTip = ""; } else if (mine.mineActivated) { if (GameNetworkManager.Instance == null || GameNetworkManager.Instance.localPlayerController == null) { return; } mineTrigger.disabledHoverTip = ((GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer == null || GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemId != 14) ? "Armed" : ((!StartOfRound.Instance.localPlayerUsingController) ? "Disarm: [ LMB ]" : "Disarm: [R-trigger]")); } else { mineTrigger.disabledHoverTip = "Disarmed"; } mineTrigger.hoverTip = mineTrigger.disabledHoverTip; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "DisarmMine"; } } [RequireComponent(typeof(InteractTrigger))] internal class DisarmTurret : NetworkBehaviour { private Turret turret; private InteractTrigger turretTrigger; public void Awake() { turretTrigger = ((Component)this).GetComponent<InteractTrigger>(); ((Behaviour)turretTrigger).enabled = true; turretTrigger.interactable = false; turretTrigger.touchTrigger = false; turretTrigger.disableTriggerMesh = false; turretTrigger.disabledHoverTip = ""; turretTrigger.hoverTip = turretTrigger.disabledHoverTip; } private void Update() { if (turret == null) { Transform parent = ((Component)this).transform.parent; object obj = ((parent != null) ? ((Component)parent).GetComponent<Turret>() : null); if (obj == null) { Transform parent2 = ((Component)this).transform.parent; obj = ((parent2 != null) ? ((Component)parent2).GetComponentInChildren<Turret>() : null); } turret = (Turret)obj; } if (!Object.op_Implicit((Object)(object)turret)) { return; } if (turret.turretActive) { if (GameNetworkManager.Instance == null || GameNetworkManager.Instance.localPlayerController == null) { return; } turretTrigger.disabledHoverTip = ((GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer == null || GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemId != 14) ? "" : ((!StartOfRound.Instance.localPlayerUsingController) ? "Deactivate: [ LMB ]" : "Deactivate: [R-trigger]")); } else { turretTrigger.disabledHoverTip = "Deactivated"; } turretTrigger.hoverTip = turretTrigger.disabledHoverTip; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "DisarmTurret"; } } public class HazardControlConfigSync : NetworkBehaviour { private bool configReceived; public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); if (!((NetworkBehaviour)this).IsServer) { Plugin.Log.LogDebug((object)"Asking server for updated configuration..."); RequestConfigSyncServerRpc(); } } [ServerRpc(RequireOwnership = false)] public void RequestConfigSyncServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2562435258u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2562435258u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HazardControlConfig hazardControlConfig = default(HazardControlConfig); hazardControlConfig.TurretsKey = Plugin.GameConfig.TurretsKey.Value; hazardControlConfig.MinesKey = Plugin.GameConfig.MinesKey.Value; hazardControlConfig.KeyUseProbability = Plugin.GameConfig.KeyUseProbability.Value; hazardControlConfig.MinesZap = Plugin.GameConfig.MinesZap.Value; hazardControlConfig.TurretsZap = Plugin.GameConfig.TurretsZap.Value; hazardControlConfig.EnemiesTriggerMines = Plugin.GameConfig.EnemiesTriggerMines.Value; HazardControlConfig config = hazardControlConfig; Plugin.Log.LogDebug((object)"[Sync] A client requested a config update."); ConfigSyncClientRpc(config); } } } [ClientRpc] public void ConfigSyncClientRpc(HazardControlConfig config) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2808763528u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<HazardControlConfig>(ref config, default(ForStructs)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2808763528u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer && !configReceived) { Plugin.GameConfig.TurretsKey.Value = config.TurretsKey; Plugin.GameConfig.MinesKey.Value = config.MinesKey; Plugin.GameConfig.KeyUseProbability.Value = config.KeyUseProbability; Plugin.GameConfig.MinesZap.Value = config.MinesZap; Plugin.GameConfig.TurretsZap.Value = config.TurretsZap; Plugin.GameConfig.EnemiesTriggerMines.Value = config.EnemiesTriggerMines; Plugin.Log.LogDebug((object)"Configuration synchronized!"); configReceived = true; } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HazardControlConfigSync() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2562435258u, new RpcReceiveHandler(__rpc_handler_2562435258)); NetworkManager.__rpc_func_table.Add(2808763528u, new RpcReceiveHandler(__rpc_handler_2808763528)); } private static void __rpc_handler_2562435258(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HazardControlConfigSync)(object)target).RequestConfigSyncServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2808763528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { HazardControlConfig config = default(HazardControlConfig); ((FastBufferReader)(ref reader)).ReadValueSafe<HazardControlConfig>(ref config, default(ForStructs)); target.__rpc_exec_stage = (__RpcExecStage)2; ((HazardControlConfigSync)(object)target).ConfigSyncClientRpc(config); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HazardControlConfigSync"; } } public struct HazardControlConfig : INetworkSerializeByMemcpy { public bool TurretsKey; public bool MinesKey; public int KeyUseProbability; public bool TurretsZap; public bool MinesZap; public bool EnemiesTriggerMines; } internal class ShockableMine : NetworkBehaviour, IShockableWithGun { private bool mineShocked; private GrabbableObject shockedBy; public bool CanBeShocked() { Landmine component = ((Component)this).GetComponent<Landmine>(); if (component.mineActivated) { return !component.hasExploded; } return false; } public float GetDifficultyMultiplier() { return 0.25f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position; } public Transform GetShockableTransform() { return ((Component)this).gameObject.transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { mineShocked = true; RoundManager.Instance.FlickerLights(false, false); if (((NetworkBehaviour)shockedByPlayer).IsOwner) { shockedBy = shockedByPlayer.currentlyHeldObjectServer; ((MonoBehaviour)this).StartCoroutine(AutoStopShocking()); } } public void StopShockingWithGun() { if (mineShocked) { mineShocked = false; RoundManager.Instance.FlickerLights(false, false); } } private IEnumerator AutoStopShocking() { yield return (object)new WaitForSeconds(0.5f); RoundManager.Instance.FlickerLights(true, false); ((Component)this).GetComponent<Landmine>().TriggerMineOnLocalClientByExiting(); PatcherTool val = (PatcherTool)shockedBy; if ((int)val != 0) { val.StopShockingAnomalyOnClient(false); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "ShockableMine"; } } internal class ShockableTurret : NetworkBehaviour, IShockableWithGun { private DateTime? startedAt; private Coroutine disabledTurret; public bool CanBeShocked() { return true; } public float GetDifficultyMultiplier() { return 0.25f; } public NetworkObject GetNetworkObject() { return ((NetworkBehaviour)this).NetworkObject; } public Vector3 GetShockablePosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).gameObject.transform.position; } public Transform GetShockableTransform() { return ((Component)this).gameObject.transform; } public void ShockWithGun(PlayerControllerB shockedByPlayer) { RoundManager.Instance.FlickerLights(true, false); if (((Component)this).GetComponent<Turret>().turretActive && ((NetworkBehaviour)shockedByPlayer).IsOwner) { startedAt = DateTime.Now; ((Component)this).GetComponent<Turret>().ToggleTurretEnabled(false); } } public void StopShockingWithGun() { if (startedAt.HasValue) { TimeSpan timeSpan = DateTime.Now - startedAt.Value; if (disabledTurret != null) { ((MonoBehaviour)this).StopCoroutine(disabledTurret); } disabledTurret = ((MonoBehaviour)this).StartCoroutine(ReenableIn((int)(timeSpan.TotalSeconds * 10.0))); startedAt = null; } } private IEnumerator ReenableIn(int waitFor) { yield return (object)new WaitForSeconds((float)waitFor); RoundManager.Instance.FlickerLights(true, false); ((Component)this).GetComponent<Turret>().ToggleTurretEnabled(true); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected internal override string __getTypeName() { return "ShockableTurret"; } } } namespace HazardControl.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }