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 EyelessDogHidingAndShipFixes v1.0.2
BepInEx\plugins\EyelessDogHidingAndShipFixes\EyelessDogHidingAndShipFixes.dll
Decompiled 41 minutes agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace SmartEyelessDogs; [BepInPlugin("com.eyelessdoghidingandshipfixes.lethalcompany", "EyelessDogHidingAndShipFixes", "1.0.2")] public class SmartEyelessDogsPlugin : BaseUnityPlugin { public const string PluginGUID = "com.eyelessdoghidingandshipfixes.lethalcompany"; public const string PluginName = "EyelessDogHidingAndShipFixes"; public const string PluginVersion = "1.0.2"; internal static ManualLogSource Log; public static ConfigEntry<bool> RequireLineOfSightToBite; public static ConfigEntry<bool> EnableTightSpaceProtection; public static ConfigEntry<float> MinDogClearanceRadius; public static ConfigEntry<float> MaxReachableNavMeshDistance; public static ConfigEntry<int> MaxDogsInsideShip; public static ConfigEntry<bool> MuffleShipInteriorNoises; public static ConfigEntry<float> ShipWallMuffleMultiplier; public static ConfigEntry<float> ShipDoorHearingConeAngle; public static ConfigEntry<bool> DebugLogging; private readonly Harmony _harmony = new Harmony("com.eyelessdoghidingandshipfixes.lethalcompany"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; RequireLineOfSightToBite = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Bite & Hiding Protection", "RequireLineOfSightToBite", true, "If true, Eyeless Dogs cannot bite/eat you through solid walls, closed doors, furniture, or props when line-of-sight is blocked."); EnableTightSpaceProtection = ((BaseUnityPlugin)this).Config.Bind<bool>("1. Bite & Hiding Protection", "EnableTightSpaceProtection", true, "If true, Eyeless Dogs cannot eat a player who is wedged into a tight gap or elevated/cramped spot where the dog's body or NavMesh cannot fit."); MinDogClearanceRadius = ((BaseUnityPlugin)this).Config.Bind<float>("1. Bite & Hiding Protection", "MinDogClearanceRadius", 0.75f, "Minimum horizontal clearance radius (in meters) required around the player for an Eyeless Dog's head/body to fit and bite them. If opposing walls/obstacles squeeze a gap narrower than 2x this radius, the player is protected."); MaxReachableNavMeshDistance = ((BaseUnityPlugin)this).Config.Bind<float>("1. Bite & Hiding Protection", "MaxReachableNavMeshDistance", 1.65f, "Maximum horizontal distance (in meters) between a player and the nearest walkable dog NavMesh point. If a player is wedged deeper off the dog's walkable NavMesh than this distance, the dog cannot reach in to eat them."); MaxDogsInsideShip = ((BaseUnityPlugin)this).Config.Bind<int>("2. Ship Entrance Cap", "MaxDogsInsideShip", 1, "Maximum number of Eyeless Dogs allowed inside the ship cabin at the same time. Additional dogs will crowd outside the ship entrance instead of entering."); MuffleShipInteriorNoises = ((BaseUnityPlugin)this).Config.Bind<bool>("3. Ship Soundproofing", "MuffleShipInteriorNoises", true, "If true, noises made inside the ship are blocked or muffled by the ship hull so dogs outside the ship walls don't constantly hear you through the metal walls."); ShipWallMuffleMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("3. Ship Soundproofing", "ShipWallMuffleMultiplier", 0f, "Loudness multiplier for noises made inside the ship when a dog is outside the ship hull walls (or when the ship door is closed). Set to 0.0 to completely block hearing through solid ship walls, or e.g. 0.25 for heavy muffling."); ShipDoorHearingConeAngle = ((BaseUnityPlugin)this).Config.Bind<float>("3. Ship Soundproofing", "ShipDoorHearingConeAngle", 65f, "Half-angle (in degrees) out from the open ship doorway within which a dog standing near the entrance has a direct acoustic path into the cabin."); DebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("4. Debug", "DebugLogging", false, "Enable verbose debug logs in the BepInEx console when a bite is blocked, a noise is muffled, or a dog is held at the ship door."); _harmony.PatchAll(typeof(MouthDogPatches)); Log.LogInfo((object)"EyelessDogHidingAndShipFixes v1.0.2 loaded successfully!"); } } [HarmonyPatch(typeof(MouthDogAI))] public static class MouthDogPatches { private static readonly HashSet<int> DogsInsideShipIds = new HashSet<int>(); private static float _lastShipCountUpdateTime; private static readonly FieldInfo InLungeField = AccessTools.Field(typeof(MouthDogAI), "inLunge"); private static readonly FieldInfo EndingLungeField = AccessTools.Field(typeof(MouthDogAI), "endingLunge"); private static readonly FieldInfo LungeCooldownField = AccessTools.Field(typeof(MouthDogAI), "lungeCooldown"); [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] public static bool OnCollideWithPlayer_Prefix(MouthDogAI __instance, Collider other) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || (Object)(object)other == (Object)null || ((EnemyAI)__instance).isEnemyDead) { return true; } PlayerControllerB componentInParent = ((Component)other).gameObject.GetComponentInParent<PlayerControllerB>(); if ((Object)(object)componentInParent == (Object)null || componentInParent.isPlayerDead || !componentInParent.isPlayerControlled) { return true; } if (IsPositionInsideShip(((Component)componentInParent).transform.position) && !IsDogAllowedInsideShip(__instance)) { if (SmartEyelessDogsPlugin.DebugLogging.Value) { SmartEyelessDogsPlugin.Log.LogInfo((object)$"[SmartEyelessDogs] Blocked Dog #{((Object)__instance).GetInstanceID()} from biting {componentInParent.playerUsername} inside ship (ship dog limit reached)."); } return false; } if (SmartEyelessDogsPlugin.RequireLineOfSightToBite.Value && IsBiteBlockedByObstacle(__instance, componentInParent)) { if (SmartEyelessDogsPlugin.DebugLogging.Value) { SmartEyelessDogsPlugin.Log.LogInfo((object)$"[SmartEyelessDogs] Blocked Dog #{((Object)__instance).GetInstanceID()} bite on {componentInParent.playerUsername}: obstacle blocking line-of-sight."); } return false; } if (SmartEyelessDogsPlugin.EnableTightSpaceProtection.Value && IsPlayerInTooTightSpotForDog(__instance, componentInParent)) { if (SmartEyelessDogsPlugin.DebugLogging.Value) { SmartEyelessDogsPlugin.Log.LogInfo((object)$"[SmartEyelessDogs] Blocked Dog #{((Object)__instance).GetInstanceID()} bite on {componentInParent.playerUsername}: player is wedged in a tight spot where the dog cannot fit."); } return false; } return true; } [HarmonyPrefix] [HarmonyPatch("DetectNoise")] public static bool DetectNoise_Prefix(MouthDogAI __instance, Vector3 noisePosition, ref float noiseLoudness, int timesNoisePlayedInOneSpot, int noiseID) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || ((EnemyAI)__instance).isEnemyDead || !SmartEyelessDogsPlugin.MuffleShipInteriorNoises.Value) { return true; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return true; } if (!IsPositionInsideShip(noisePosition)) { return true; } if (IsPositionInsideShip(((Component)__instance).transform.position)) { return true; } if (instance.hangarDoorsClosed || !HasOpenDoorwayAcousticPath(((Component)__instance).transform.position, noisePosition)) { float num = Mathf.Clamp01(SmartEyelessDogsPlugin.ShipWallMuffleMultiplier.Value); if (num <= 0.001f) { if (SmartEyelessDogsPlugin.DebugLogging.Value) { SmartEyelessDogsPlugin.Log.LogInfo((object)$"[SmartEyelessDogs] Blocked ship interior noise from reaching Dog #{((Object)__instance).GetInstanceID()} outside ship hull."); } return false; } noiseLoudness *= num; if (noiseLoudness < 0.1f) { return false; } } return true; } [HarmonyPatch("DoAIInterval")] [HarmonyPostfix] public static void DoAIInterval_Postfix(MouthDogAI __instance) { if (!((Object)(object)__instance == (Object)null) && !((EnemyAI)__instance).isEnemyDead) { RefreshDogsInsideShipRoster(); EnforceShipEntryCap(__instance); } } [HarmonyPostfix] [HarmonyPatch("Update")] public static void Update_Postfix(MouthDogAI __instance) { if (!((Object)(object)__instance == (Object)null) && !((EnemyAI)__instance).isEnemyDead) { if (Time.time - _lastShipCountUpdateTime > 0.1f) { RefreshDogsInsideShipRoster(); } EnforceShipEntryCap(__instance); } } private static bool IsBiteBlockedByObstacle(MouthDogAI dog, PlayerControllerB player) { //IL_006d: 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) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; int layerMask = (((Object)(object)instance != (Object)null) ? instance.collidersAndRoomMaskAndDefault : 257); Vector3 val = (((Object)(object)dog.mouthGrip != (Object)null) ? dog.mouthGrip.position : (((Object)(object)((EnemyAI)dog).eye != (Object)null) ? ((EnemyAI)dog).eye.position : (((Component)dog).transform.position + Vector3.up * 1.1f))); Vector3 to = ((Component)player).transform.position + Vector3.up * 0.85f; Vector3 to2 = (((Object)(object)player.playerEye != (Object)null) ? player.playerEye.position : (((Component)player).transform.position + Vector3.up * 1.45f)); bool flag = IsSegmentBlockedBySolidGeometry(val, to, layerMask, dog, player); bool result = IsSegmentBlockedBySolidGeometry(val, to2, layerMask, dog, player); if (flag) { return result; } return false; } private static bool IsSegmentBlockedBySolidGeometry(Vector3 from, Vector3 to, int layerMask, MouthDogAI dog, PlayerControllerB player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.05f) { return false; } RaycastHit[] array = Physics.RaycastAll(from, val / magnitude, magnitude, layerMask, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return false; } for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && !((Component)collider).transform.IsChildOf(((Component)dog).transform) && !((Component)collider).transform.IsChildOf(((Component)player).transform) && !((Object)(object)((Component)collider).GetComponentInParent<EnemyAI>() != (Object)null) && !((Object)(object)((Component)collider).GetComponentInParent<PlayerControllerB>() != (Object)null)) { return true; } } return false; } private static bool IsPlayerInTooTightSpotForDog(MouthDogAI dog, PlayerControllerB player) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_01f9: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; int layerMask = (((Object)(object)instance != (Object)null) ? instance.collidersAndRoomMaskAndDefault : 257); Vector3 position = ((Component)player).transform.position; Vector3 val = position + Vector3.up * 0.8f; float num = Mathf.Max(0.5f, SmartEyelessDogsPlugin.MaxReachableNavMeshDistance.Value); int num2 = (((Object)(object)((EnemyAI)dog).agent != (Object)null) ? ((EnemyAI)dog).agent.areaMask : (-1)); NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val2, num * 2f, num2)) { float num3 = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(((NavMeshHit)(ref val2)).position.x, ((NavMeshHit)(ref val2)).position.z)); float num4 = Mathf.Abs(position.y - ((NavMeshHit)(ref val2)).position.y); if (num3 > num || num4 > 1.75f) { return true; } float num5 = Mathf.Max(0.25f, SmartEyelessDogsPlugin.MinDogClearanceRadius.Value); float num6 = num5 * 2f; Vector3 val3 = ((Component)dog).transform.position + Vector3.up * 0.8f; Vector3 val4 = val - val3; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude > 0.01f) { Vector3 normalized = ((Vector3)(ref val4)).normalized; Vector3 axis = default(Vector3); ((Vector3)(ref axis))..ctor(normalized.z, 0f, 0f - normalized.x); float num7 = MeasureClearGapWidth(val, axis, num6, layerMask, dog, player); Vector3 origin = Vector3.Lerp(val3, val, 0.7f); float num8 = MeasureClearGapWidth(origin, axis, num6, layerMask, dog, player); if (num7 < num6 || num8 < num6) { return true; } } Vector3[] array = (Vector3[])(object)new Vector3[4] { Vector3.forward, Vector3.right, new Vector3(0.7071f, 0f, 0.7071f), new Vector3(0.7071f, 0f, -0.7071f) }; int num9 = 0; for (int i = 0; i < array.Length; i++) { float num10 = MeasureClearGapWidth(val, array[i], num6, layerMask, dog, player); if (num10 < num6 * 0.75f) { num9++; } } if (num9 >= 1) { float num11 = Vector2.Distance(new Vector2(((Component)dog).transform.position.x, ((Component)dog).transform.position.z), new Vector2(position.x, position.z)); if (num11 > num5 * 1.4f) { return true; } } return false; } return true; } private static float MeasureClearGapWidth(Vector3 origin, Vector3 axis, float maxCheckDistance, int layerMask, MouthDogAI dog, PlayerControllerB player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) float num = CastNearestSolidDistance(origin, axis, maxCheckDistance, layerMask, dog, player); float num2 = CastNearestSolidDistance(origin, -axis, maxCheckDistance, layerMask, dog, player); return num + num2; } private static float CastNearestSolidDistance(Vector3 origin, Vector3 dir, float maxDist, int layerMask, MouthDogAI dog, PlayerControllerB player) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.RaycastAll(origin, dir, maxDist, layerMask, (QueryTriggerInteraction)1); float num = maxDist; if (array == null) { return num; } for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if (!((Object)(object)collider == (Object)null) && !collider.isTrigger && !((Component)collider).transform.IsChildOf(((Component)dog).transform) && !((Component)collider).transform.IsChildOf(((Component)player).transform) && !((Object)(object)((Component)collider).GetComponentInParent<EnemyAI>() != (Object)null) && !((Object)(object)((Component)collider).GetComponentInParent<PlayerControllerB>() != (Object)null) && ((RaycastHit)(ref array[i])).distance < num) { num = ((RaycastHit)(ref array[i])).distance; } } return num; } private static bool IsPositionInsideShip(Vector3 position) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return false; } if ((Object)(object)instance.shipInnerRoomBounds != (Object)null) { Bounds bounds = instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(position)) { return true; } } if ((Object)(object)instance.shipStrictInnerRoomBounds != (Object)null) { Bounds bounds2 = instance.shipStrictInnerRoomBounds.bounds; if (((Bounds)(ref bounds2)).Contains(position)) { return true; } } return false; } private static void RefreshDogsInsideShipRoster() { //IL_007d: 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) _lastShipCountUpdateTime = Time.time; int num = Mathf.Max(0, SmartEyelessDogsPlugin.MaxDogsInsideShip.Value); MouthDogAI[] array = Object.FindObjectsOfType<MouthDogAI>(); if (array == null || array.Length == 0) { DogsInsideShipIds.Clear(); return; } HashSet<int> hashSet = new HashSet<int>(); foreach (MouthDogAI val in array) { if (!((Object)(object)val == (Object)null) && !((EnemyAI)val).isEnemyDead) { int instanceID = ((Object)val).GetInstanceID(); if (DogsInsideShipIds.Contains(instanceID) && (((EnemyAI)val).isInsidePlayerShip || IsPositionInsideShip(((Component)val).transform.position)) && hashSet.Count < num) { hashSet.Add(instanceID); } } } if (hashSet.Count < num) { foreach (MouthDogAI val2 in array) { if ((Object)(object)val2 == (Object)null || ((EnemyAI)val2).isEnemyDead) { continue; } int instanceID2 = ((Object)val2).GetInstanceID(); if (!hashSet.Contains(instanceID2) && (((EnemyAI)val2).isInsidePlayerShip || IsPositionInsideShip(((Component)val2).transform.position))) { hashSet.Add(instanceID2); if (hashSet.Count >= num) { break; } } } } DogsInsideShipIds.Clear(); foreach (int item in hashSet) { DogsInsideShipIds.Add(item); } } private static bool IsDogAllowedInsideShip(MouthDogAI dog) { int num = Mathf.Max(0, SmartEyelessDogsPlugin.MaxDogsInsideShip.Value); if (num <= 0) { return false; } int instanceID = ((Object)dog).GetInstanceID(); if (DogsInsideShipIds.Contains(instanceID)) { return true; } return DogsInsideShipIds.Count < num; } private static void EnforceShipEntryCap(MouthDogAI dog) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) if (IsDogAllowedInsideShip(dog)) { return; } StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null) { return; } Vector3 exteriorDoorwayCrowdPosition = GetExteriorDoorwayCrowdPosition(dog, instance); if (IsPositionInsideShip(((EnemyAI)dog).destination)) { ((EnemyAI)dog).destination = exteriorDoorwayCrowdPosition; if ((Object)(object)((EnemyAI)dog).agent != (Object)null && ((EnemyAI)dog).agent.isOnNavMesh && ((NetworkBehaviour)dog).IsOwner) { ((EnemyAI)dog).agent.SetDestination(exteriorDoorwayCrowdPosition); } } if ((Object)(object)((EnemyAI)dog).agent != (Object)null && ((EnemyAI)dog).agent.isOnNavMesh && IsPositionInsideShip(((EnemyAI)dog).agent.destination) && ((NetworkBehaviour)dog).IsOwner) { ((EnemyAI)dog).agent.SetDestination(exteriorDoorwayCrowdPosition); } if (!((EnemyAI)dog).isInsidePlayerShip && !IsPositionInsideShip(((Component)dog).transform.position)) { return; } ((EnemyAI)dog).isInsidePlayerShip = false; if (InLungeField != null && (bool)InLungeField.GetValue(dog)) { InLungeField.SetValue(dog, false); if (EndingLungeField != null) { EndingLungeField.SetValue(dog, true); } if (LungeCooldownField != null) { LungeCooldownField.SetValue(dog, 0.5f); } } if ((Object)(object)((EnemyAI)dog).agent != (Object)null && ((EnemyAI)dog).agent.isOnNavMesh && ((NetworkBehaviour)dog).IsOwner) { ((EnemyAI)dog).agent.ResetPath(); ((EnemyAI)dog).agent.velocity = Vector3.zero; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(exteriorDoorwayCrowdPosition, ref val, 4f, -1)) { ((EnemyAI)dog).agent.Warp(((NavMeshHit)(ref val)).position); } ((EnemyAI)dog).agent.SetDestination(exteriorDoorwayCrowdPosition); } if (SmartEyelessDogsPlugin.DebugLogging.Value) { SmartEyelessDogsPlugin.Log.LogInfo((object)$"[SmartEyelessDogs] Held Dog #{((Object)dog).GetInstanceID()} outside the ship doorway (ship already at max capacity: {SmartEyelessDogsPlugin.MaxDogsInsideShip.Value})."); } } private static Vector3 GetExteriorDoorwayCrowdPosition(MouthDogAI dog, StartOfRound sor) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)sor.outsideDoorPosition != (Object)null) ? sor.outsideDoorPosition.position : (((Object)(object)sor.shipDoorNode != (Object)null) ? sor.shipDoorNode.position : ((Component)sor).transform.position)); Vector3 val2; if (!((Object)(object)sor.middleOfShipNode != (Object)null)) { if (!((Object)(object)sor.shipInnerRoomBounds != (Object)null)) { val2 = ((Component)sor).transform.position; } else { Bounds bounds = sor.shipInnerRoomBounds.bounds; val2 = ((Bounds)(ref bounds)).center; } } else { val2 = sor.middleOfShipNode.position; } Vector3 val3 = val2; Vector3 val4 = val - val3; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = -((Component)sor).transform.right; } else { ((Vector3)(ref val4)).Normalize(); } Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(val4.z, 0f, 0f - val4.x); int num = Math.Abs(((Object)dog).GetInstanceID()); float num2 = (float)(num % 5 - 2) * 0.85f; float num3 = 1.6f + (float)(num % 3) * 0.55f; Vector3 val6 = val + val4 * num3 + val5 * num2; if ((Object)(object)sor.shipInnerRoomBounds != (Object)null) { Bounds bounds2 = sor.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds2)).Contains(val6)) { val6 = val + val4 * (num3 + 2.5f) + val5 * num2; } } NavMeshHit val7 = default(NavMeshHit); if (NavMesh.SamplePosition(val6, ref val7, 5f, -1)) { return ((NavMeshHit)(ref val7)).position; } return val6; } private static bool HasOpenDoorwayAcousticPath(Vector3 dogPos, Vector3 noisePos) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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) StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || instance.hangarDoorsClosed) { return false; } int collidersAndRoomMaskAndDefault = instance.collidersAndRoomMaskAndDefault; Vector3 val = dogPos + Vector3.up * 1.2f; Vector3 val2 = noisePos + Vector3.up * 0.5f; if (!Physics.Linecast(val, val2, collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return true; } Transform val3 = (((Object)(object)instance.shipDoorNode != (Object)null) ? instance.shipDoorNode : instance.outsideDoorPosition); if ((Object)(object)val3 == (Object)null) { return false; } Vector3 position = val3.position; Vector3 val4; if (!((Object)(object)instance.middleOfShipNode != (Object)null)) { if (!((Object)(object)instance.shipInnerRoomBounds != (Object)null)) { val4 = ((Component)instance).transform.position; } else { Bounds bounds = instance.shipInnerRoomBounds.bounds; val4 = ((Bounds)(ref bounds)).center; } } else { val4 = instance.middleOfShipNode.position; } Vector3 val5 = val4; Vector3 val6 = position - val5; val6.y = 0f; if (((Vector3)(ref val6)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref val6)).Normalize(); Vector3 val7 = dogPos - position; float magnitude = ((Vector3)(ref val7)).magnitude; if (magnitude > 8.5f) { return false; } val7.y = 0f; if (((Vector3)(ref val7)).sqrMagnitude < 0.01f) { return true; } float num = Vector3.Angle(val6, ((Vector3)(ref val7)).normalized); return num <= SmartEyelessDogsPlugin.ShipDoorHearingConeAngle.Value; } }