Decompiled source of MapHazardsMoves v1.0.2

MapHazardsMoves.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
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 HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using MapHazardsMoves.Patches;
using MapHazardsMoves.Scripts;
using MapHazardsMoves.Utils;
using Microsoft.CodeAnalysis;
using StaticNetcodeLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[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 = "")]
[assembly: AssemblyCompany("MapHazardsMoves")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("MapHazardsMoves")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4c9c4e97d1295b3c83314755c794c4afa66cd326")]
[assembly: AssemblyProduct("MapHazardsMoves")]
[assembly: AssemblyTitle("MapHazardsMoves")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 MapHazardsMoves
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("wexop.maphazardsmoves", "MapHazardsMoves", "1.0.2")]
	public class MapHazardsMoves : BaseUnityPlugin
	{
		private const string GUID = "wexop.maphazardsmoves";

		private const string NAME = "MapHazardsMoves";

		private const string VERSION = "1.0.2";

		public static MapHazardsMoves instance;

		public Dictionary<ulong, HazardObject> HazardsObjects = new Dictionary<ulong, HazardObject>();

		public ConfigEntry<float> randomPercentChanceEntry;

		public ConfigEntry<float> minMovementDistanceEntry;

		public ConfigEntry<float> maxMovementDistanceEntry;

		public ConfigEntry<float> minMovementDelayEntry;

		public ConfigEntry<float> maxMovementDelayEntry;

		public ConfigEntry<float> landmineSpeedEntry;

		public ConfigEntry<bool> landmineEnabledEntry;

		public ConfigEntry<float> turretSpeedEntry;

		public ConfigEntry<bool> turretEnabledEntry;

		public ConfigEntry<float> spikeTrapSpeedEntry;

		public ConfigEntry<bool> spikeTrapEnabledEntry;

		public ConfigEntry<bool> enablePlayerDetectionEntry;

		public ConfigEntry<float> playerDetectionSpeedEntry;

		public ConfigEntry<float> playerDetectionDelayEntry;

		public ConfigEntry<float> playerDetectionDistanceEntry;

		public ConfigEntry<bool> enableCoilHeadModeEntry;

		public ConfigEntry<bool> enableDevLogsEntry;

		private void Awake()
		{
			instance = this;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MapHazardsMoves starting....");
			randomPercentChanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ChanceOfMovement", 100f, "The chance for a map hazard to be able to walk. 0% is never, 100% is always. No need to restart the game :)");
			CreateFloatConfig(randomPercentChanceEntry, 0f, 100f);
			minMovementDistanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "minMovementDistance", 5f, "The minimum distance that hazard can walk to. No need to restart the game :)");
			CreateFloatConfig(minMovementDistanceEntry, 0f, 100f);
			maxMovementDistanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "maxMovementDistance", 15f, "The maximum distance that hazard can walk to. No need to restart the game :)");
			CreateFloatConfig(maxMovementDistanceEntry, 0f, 100f);
			minMovementDelayEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "minMovementDelay", 10f, "The minimum delay between each hazard movement. No need to restart the game :)");
			CreateFloatConfig(minMovementDelayEntry, 0f, 100f);
			maxMovementDelayEntry = ((BaseUnityPlugin)this).Config.Bind<float>("General", "maxMovementDelay", 30f, "The maximum delay between each hazard movement. No need to restart the game :)");
			CreateFloatConfig(maxMovementDelayEntry, 1f, 300f);
			landmineEnabledEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("LandMine", "landmineEnabled", true, "Enable landmines to move. No need to restart the game :)");
			CreateBoolConfig(landmineEnabledEntry);
			landmineSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("LandMine", "landmineSpeed", 4f, "Landmines movement speed. No need to restart the game :)");
			CreateFloatConfig(landmineSpeedEntry, 1f, 100f);
			turretEnabledEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Turret", "turretEnabled", true, "Enable turrets to move. No need to restart the game :)");
			CreateBoolConfig(turretEnabledEntry);
			turretSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Turret", "turretSpeed", 4f, "Turrets movement speed . No need to restart the game :)");
			CreateFloatConfig(turretSpeedEntry, 1f, 100f);
			spikeTrapEnabledEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("SpikeTrap", "spikeTrapEnabled", true, "Enable spike traps to move. No need to restart the game :)");
			CreateBoolConfig(spikeTrapEnabledEntry);
			spikeTrapSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("SpikeTrap", "spikeTrapSpeed", 4f, "Spike traps movement speed. No need to restart the game :)");
			CreateFloatConfig(spikeTrapSpeedEntry, 1f, 100f);
			enablePlayerDetectionEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerDetection", "EnablePlayerDetection", false, "Enable hazards to detect a player and run into it. No need to restart the game :)");
			CreateBoolConfig(enablePlayerDetectionEntry);
			playerDetectionSpeedEntry = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerDetection", "playerDetectionSpeed", 8f, "Speed of hazards when they run into a player. No need to restart the game :)");
			CreateFloatConfig(playerDetectionSpeedEntry, 1f, 100f);
			playerDetectionDelayEntry = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerDetection", "playerDetectionDelay", 20f, "Delay before an hazard can detect a player again. No need to restart the game :)");
			CreateFloatConfig(playerDetectionDelayEntry, 1f, 180f);
			playerDetectionDistanceEntry = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerDetection", "playerDetectionDistance", 8f, "Distance of the player detection. No need to restart the game :)");
			CreateFloatConfig(playerDetectionDistanceEntry, 1f, 100f);
			enableCoilHeadModeEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "CoilHeadMode", false, "Hazards stop walking when a player look at it. To have a behavior like coil heads, you can enable playerDetection !  No need to restart the game :)");
			CreateBoolConfig(enableCoilHeadModeEntry);
			enableDevLogsEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "enableLogs", false, "Enable dev logs. No need to restart the game :)");
			CreateBoolConfig(enableDevLogsEntry);
			Harmony.CreateAndPatchAll(typeof(LandminePatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(SpikeRoofTrapPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(TurretPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(RoundManagerPatch), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"MapHazardsMoves is patched!");
		}

		public void RegisterHazardObject(ulong networkId, MapHazardTypes mapHazardType = MapHazardTypes.Other)
		{
			bool flag = false;
			float num = Random.Range(0f, 100f);
			bool canWalk = !(randomPercentChanceEntry.Value < num);
			NetworkHazardsMoves.RegisterObjectClientRpc(networkId, canWalk, mapHazardType);
		}

		public float GetNewTimer()
		{
			return Random.Range(minMovementDelayEntry.Value, maxMovementDelayEntry.Value);
		}

		public Vector3 GetNewPos(Vector3 pos)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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)
			float value = minMovementDistanceEntry.Value;
			float value2 = maxMovementDistanceEntry.Value;
			float num = Random.Range(value, value2);
			float num2 = Random.Range(value, value2);
			if (Random.Range(0, 2) == 1)
			{
				num *= -1f;
			}
			if (Random.Range(0, 2) == 1)
			{
				num2 *= -1f;
			}
			return pos + new Vector3(num, 0f, num2);
		}

		public void OnUpdateHazardObject(ulong networkId, float speed, Vector3 position)
		{
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			if (!instance.HazardsObjects.ContainsKey(networkId))
			{
				if (enableDevLogsEntry.Value)
				{
					Debug.LogError((object)$"No HazardObject found with networkId {networkId}");
				}
				return;
			}
			HazardObject hazardObject = instance.HazardsObjects[networkId];
			if (hazardObject == null)
			{
				if (enableDevLogsEntry.Value)
				{
					Debug.LogError((object)$"HazardObject is null for networkId {networkId}");
				}
			}
			else
			{
				if (!hazardObject.canWalk)
				{
					return;
				}
				bool flag = instance.CheckIfPlayerLook(hazardObject);
				if (hazardObject.isStopped != flag)
				{
					hazardObject.isStopped = flag;
					NetworkHazardsMoves.ChangeHazardMovementStateClientRpc(networkId, flag);
					if (flag)
					{
						hazardObject.detectPlayerTimer = 0.5f;
						hazardObject.moveTimer = 0.5f;
					}
				}
				if (hazardObject.detectPlayerTimer > 0f)
				{
					hazardObject.detectPlayerTimer -= Time.deltaTime;
				}
				if (hazardObject.moveTimer > 0f)
				{
					hazardObject.moveTimer -= Time.deltaTime;
					return;
				}
				bool flag2 = false;
				hazardObject.moveTimer = instance.GetNewTimer();
				Vector3 newPos = instance.GetNewPos(position);
				bool flag3 = false;
				NetworkHazardsMoves.OnUpdateObjectClientRpc(networkId, newPos, speed);
			}
		}

		public bool CheckIfPlayerLook(HazardObject hazardObject)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			bool result = false;
			if (!enableCoilHeadModeEntry.Value || hazardObject == null)
			{
				return false;
			}
			for (int i = 0; i < 4; i++)
			{
				if (StartOfRound.Instance.allPlayerScripts[i].HasLineOfSightToPosition(hazardObject.GetCenterPosition(), 68f, 60, -1f) && Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i].gameplayCamera).transform.position, hazardObject.gameObject.transform.position) > 0.3f)
				{
					hazardObject.navMeshAgent.isStopped = true;
					result = true;
				}
			}
			return result;
		}

		private void CreateFloatConfig(ConfigEntry<float> configEntry, float min = 0f, float max = 30f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = min;
			((BaseRangeOptions<float>)val).Max = max;
			((BaseOptions)val).RequiresRestart = false;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(configEntry, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		private void CreateBoolConfig(ConfigEntry<bool> configEntry)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(configEntry, new BoolCheckBoxOptions
			{
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MapHazardsMoves";

		public const string PLUGIN_NAME = "MapHazardsMoves";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MapHazardsMoves.Utils
{
	public class HazardObject
	{
		public bool canWalk;

		public GameObject gameObject;

		public NavMeshAgent navMeshAgent;

		public DetectPlayer detectPlayer;

		public float moveTimer;

		public float detectPlayerTimer;

		public bool isStopped;

		public Vector3 centerPos = Vector3.up * 1.6f;

		public MapHazardTypes mapHazardType = MapHazardTypes.Other;

		public void Init()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (mapHazardType == MapHazardTypes.SpikeTrap)
			{
				centerPos = new Vector3(0f, 1f, 1f) * 1.6f;
			}
		}

		public Vector3 GetCenterPosition()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return gameObject.transform.position + centerPos;
		}
	}
	public enum MapHazardTypes
	{
		SpikeTrap,
		Turret,
		Landmine,
		Other
	}
	[StaticNetcode]
	public class NetworkHazardsMoves
	{
		[ClientRpc]
		public static void RegisterObjectClientRpc(ulong networkID, bool canWalk, MapHazardTypes mapHazardType = MapHazardTypes.Other)
		{
			List<NetworkObject> list = Object.FindObjectsByType<NetworkObject>((FindObjectsSortMode)0).ToList();
			NetworkObject val = list.Find((NetworkObject e) => e.NetworkObjectId == networkID);
			if ((Object)(object)val == (Object)null)
			{
				if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
				{
					Debug.Log((object)$"OBJECT NOT FOUND {networkID}");
				}
				return;
			}
			NavMeshAgent navMeshAgent = ((Component)val).gameObject.AddComponent<NavMeshAgent>();
			DetectPlayer detectPlayer = ((Component)val).gameObject.AddComponent<DetectPlayer>();
			SphereCollider val2 = ((Component)val).gameObject.AddComponent<SphereCollider>();
			val2.radius = MapHazardsMoves.instance.playerDetectionDistanceEntry.Value;
			((Collider)val2).isTrigger = true;
			HazardObject hazardObject = new HazardObject();
			hazardObject.canWalk = canWalk;
			hazardObject.gameObject = ((Component)val).gameObject;
			hazardObject.moveTimer = 0f;
			hazardObject.detectPlayerTimer = 0f;
			hazardObject.navMeshAgent = navMeshAgent;
			hazardObject.navMeshAgent.height = 3.3f;
			hazardObject.navMeshAgent.radius = 1f;
			hazardObject.detectPlayer = detectPlayer;
			hazardObject.detectPlayer.networkId = networkID;
			hazardObject.mapHazardType = mapHazardType;
			hazardObject.Init();
			MapHazardsMoves.instance.HazardsObjects.Add(networkID, hazardObject);
			if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
			{
				Debug.Log((object)$"OBJECT ADDED {((Object)val).name} WITH ID {networkID} CAN WALK {canWalk}");
			}
		}

		[ClientRpc]
		public static void OnUpdateObjectClientRpc(ulong networkId, Vector3 newPos, float speed)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			if (!MapHazardsMoves.instance.HazardsObjects.ContainsKey(networkId))
			{
				Debug.LogError((object)$"No HazardObject found with networkId {networkId}");
				return;
			}
			HazardObject hazardObject = MapHazardsMoves.instance.HazardsObjects[networkId];
			if (hazardObject != null && hazardObject.canWalk && !((Object)(object)hazardObject.navMeshAgent == (Object)null))
			{
				hazardObject.navMeshAgent.speed = speed;
				hazardObject.navMeshAgent.SetDestination(newPos);
				if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
				{
					Debug.Log((object)("HAZARD MOVED " + ((Object)hazardObject.gameObject).name));
				}
			}
		}

		public static void OnPlayerDetected(ulong networkId, Vector3 newPos)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if (!MapHazardsMoves.instance.enablePlayerDetectionEntry.Value)
			{
				return;
			}
			if (!MapHazardsMoves.instance.HazardsObjects.ContainsKey(networkId))
			{
				Debug.LogError((object)$"No HazardObject found with networkId {networkId}");
				return;
			}
			HazardObject hazardObject = MapHazardsMoves.instance.HazardsObjects[networkId];
			if (hazardObject != null && !(hazardObject.detectPlayerTimer > 0f))
			{
				hazardObject.detectPlayerTimer = MapHazardsMoves.instance.playerDetectionDelayEntry.Value;
				hazardObject.moveTimer = MapHazardsMoves.instance.GetNewTimer();
				OnUpdateObjectClientRpc(networkId, newPos, MapHazardsMoves.instance.playerDetectionSpeedEntry.Value);
				if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
				{
					Debug.Log((object)$"PLAYER DETECTED WITH id {networkId} pos: {newPos} FROM {((Object)hazardObject.gameObject).name}");
				}
			}
		}

		[ClientRpc]
		public static void ChangeHazardMovementStateClientRpc(ulong networkId, bool active)
		{
			if (!MapHazardsMoves.instance.HazardsObjects.ContainsKey(networkId))
			{
				Debug.LogError((object)$"No HazardObject found with networkId {networkId}");
				return;
			}
			HazardObject hazardObject = MapHazardsMoves.instance.HazardsObjects[networkId];
			if (hazardObject != null)
			{
				hazardObject.navMeshAgent.isStopped = active;
				if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
				{
					Debug.Log((object)$"HAZARD MOVEMENT STATE UPDATED TO {active} FOR {((Object)hazardObject.gameObject).name}");
				}
			}
		}
	}
}
namespace MapHazardsMoves.Scripts
{
	public class DetectPlayer : MonoBehaviour
	{
		public ulong? networkId = null;

		private void OnTriggerStay(Collider other)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)other).CompareTag("Player") && networkId.HasValue)
			{
				_ = ((Component)other).gameObject.transform.position;
				if (true && NetworkManager.Singleton.IsServer)
				{
					NetworkHazardsMoves.OnPlayerDetected(networkId.Value, ((Component)other).gameObject.transform.position);
				}
			}
		}
	}
}
namespace MapHazardsMoves.Patches
{
	[HarmonyPatch(typeof(Landmine))]
	public class LandminePatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(Landmine __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer)
			{
				MapHazardsMoves.instance.RegisterHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardTypes.Landmine);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(Landmine __instance)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			_ = ((NetworkBehaviour)__instance).NetworkObjectId;
			if (0 == 0 && ((NetworkBehaviour)__instance).IsServer && MapHazardsMoves.instance.landmineEnabledEntry.Value)
			{
				MapHazardsMoves.instance.OnUpdateHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardsMoves.instance.landmineSpeedEntry.Value, ((Component)__instance).gameObject.transform.position);
			}
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	public class RoundManagerPatch
	{
		[HarmonyPatch("LoadNewLevel")]
		[HarmonyPrefix]
		private static void LoadLevelPatch(RoundManager __instance)
		{
			MapHazardsMoves.instance.HazardsObjects.Clear();
			if (MapHazardsMoves.instance.enableDevLogsEntry.Value)
			{
				Debug.Log((object)"MAP HAZARDS OBJECTS CLEANED");
			}
		}
	}
	[HarmonyPatch(typeof(SpikeRoofTrap))]
	public class SpikeRoofTrapPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(SpikeRoofTrap __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer)
			{
				MapHazardsMoves.instance.RegisterHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardTypes.SpikeTrap);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(SpikeRoofTrap __instance)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			_ = ((NetworkBehaviour)__instance).NetworkObjectId;
			if (0 == 0 && ((NetworkBehaviour)__instance).IsServer && MapHazardsMoves.instance.spikeTrapEnabledEntry.Value)
			{
				MapHazardsMoves.instance.OnUpdateHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardsMoves.instance.spikeTrapSpeedEntry.Value, ((Component)__instance).gameObject.transform.position);
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	public class TurretPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(Turret __instance)
		{
			if (((NetworkBehaviour)__instance).IsServer)
			{
				MapHazardsMoves.instance.RegisterHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardTypes.Turret);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(Turret __instance)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			_ = ((NetworkBehaviour)__instance).NetworkObjectId;
			if (0 == 0 && ((NetworkBehaviour)__instance).IsServer && MapHazardsMoves.instance.turretEnabledEntry.Value)
			{
				MapHazardsMoves.instance.OnUpdateHazardObject(((NetworkBehaviour)__instance).NetworkObjectId, MapHazardsMoves.instance.turretSpeedEntry.Value, ((Component)__instance).gameObject.transform.position);
			}
		}
	}
}