Decompiled source of KiwiBirdTweaks v0.1.0
DLL/KiwiBirdTweaks.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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 KiwiBirdTweaks.Patches; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("KiwiBirdTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+65b753277387a2457d53c5c423a7f3d1046c65f0")] [assembly: AssemblyProduct("KiwiBirdTweaks")] [assembly: AssemblyTitle("KiwiBirdTweaks")] [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.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] [Microsoft.CodeAnalysis.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] [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; } } } public class GiantKiwiAIModified : EnemyAI, IVisibleThreat { private class SomeClass { public static float SomeMethod(float param) { return Mathf.Min(param + Time.deltaTime * 0.5f, 12f); } public static float SomeMethod2(float param) { return Mathf.Min(param + 1.2f, 2f); } public static float SomeMethod3(float param) { return Math.Max(1f / param, 0.2f); } public static bool SomeMethod4(EnemyAI otherEnemy) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return (int)otherEnemy.enemyType.EnemySize == 0 && otherEnemy.enemyType.canDie; } } public bool inKillAnimation; [Space(7f)] public float idlePatrolSpeed = 8f; public GameObject eggPrefab; public List<KiwiBabyItem> eggs = new List<KiwiBabyItem>(); private bool syncedEggsPosition; private bool hasSpawnedEggs; private int idleBehaviour; private float behaviourTimer; private float idleTimer; private int previousBehaviour; public Transform[] nestEggSpawnPositions; private Random idleRandom; private int previousIdleBehaviour; private Collider[] treeColliders; public Transform peckingTree; private bool isPeckingTree; public float peckTreeDistance = 4f; private float miscTimer; private Vector3 agentLocalVelocity; private float velX; private float velZ; public Transform animationContainer; private Vector3 previousPosition; [Header("Animation values")] private bool inMovement; [Header("Audios")] public AudioClip[] footstepSFX; public AudioClip[] footstepBassSFX; public AudioClip peckTreeSFX; public AudioSource peckAudio; public AudioSource longDistanceAudio; public DampedTransform dampedHeadTransform; public ParticleSystem woodChipParticle; [Header("Sight")] public Transform lookTarget; public Transform headLookTarget; public Transform eyesLookTarget; public MultiAimConstraint headLookRig; public MultiAimConstraint eyesLookRigA; public MultiAimConstraint eyesLookRigB; private float pingAttentionTimer; private int focusLevel; private Vector3 pingAttentionPosition; private float timeSincePingingAttention; private float timeAtLastHeardNoise; public Collider ownCollider; private int visibleThreatsMask = 524296; private int lookMask = 1073744129; private IVisibleThreat seenThreat; private IVisibleThreat watchingThreat; public Transform watchingThreatTransform; public Transform turnCompass; public Transform leftEyeMesh; public Transform rightEyeMesh; public Transform neck2; private float eyeTwitchInterval; private float turnHeadInterval; private float turnHeadOffset; public float eyeTwitchAmount; private Vector3 baseEyeRotation; private Vector3 baseEyeRotationLeft; [Header("Nest behaviour")] public float protectNestRadius = 7f; private List<KiwiBabyItem> LostEggs = new List<KiwiBabyItem>(3); private List<KiwiBabyItem> LostEggsFound = new List<KiwiBabyItem>(3); private KiwiBabyItem patrollingEgg; private KiwiBabyItem takeEggBackToNest; private float eggDist; public bool carryingEgg; public Transform grabTarget; private List<Transform> seenThreatsHoldingEgg = new List<Transform>(); private IVisibleThreat attackingThreat; private bool attackingLastFrame; private bool attacking; public GameObject birdNest; public GameObject birdNestPrefab; public string defenseBehaviour; private float timeSinceSeeingThreat; private float checkLOSDistance; private Vector3 lastSeenPositionOfWatchedThreat; private bool checkingLastSeenPosition; private bool patrollingInAttackMode; public AudioClip[] attackSFX; public float hitVelocityForce = 3f; private float timeSinceHittingPlayer; public ParticleSystem rocksParticle; public ParticleSystem runningParticle; private float walkAnimSpeed = 1f; public AudioClip[] screamSFX; public AudioClip squawkSFX; private bool wasPatrollingEgg; private bool wasOwnerLastFrame; public AISearchRoutine searchForLostEgg; public GameObject playerExplodePrefab; private float timeSinceHittingGround; private int destroyTreesInterval; private Random birdRandom; private float attackSpeedMultiplier; public float chaseAccelerationMultiplier; private float longChaseBonusSpeed; public GameObject feathersPrefab; public AudioClip wakeUpSFX; public EnemyType baboonHawkType; public bool pryingOpenDoor; public HangarShipDoor shipDoor; private float pryingDoorAnimTime; public float pryOpenDoorAnimLength; public AudioClip breakAndEnter; public AudioClip shipAlarm; public AudioSource breakDownDoorAudio; private AudioSource birdNestAmbience; private bool wasLookingForEggs; private PlayerControllerB lastPlayerWhoAttacked; private float timeSinceGettingHit; private NavMeshHit navHitB; private float sampleNavAreaInterval; public PlayerControllerB abandonedThreat; private float timeSpentChasingThreat; private float timeSinceExitingAttackMode; private bool triedRandomDance; private bool targetPlayerIsInTruck; private float timeSinceHittingEnemy; ThreatType IVisibleThreat.type => (ThreatType)9; int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition) { if (base.currentBehaviourStateIndex == 2) { return 18; } return 10; } int IVisibleThreat.GetInterestLevel() { return 0; } Transform IVisibleThreat.GetThreatLookTransform() { return base.eye; } Transform IVisibleThreat.GetThreatTransform() { return ((Component)this).transform; } Vector3 IVisibleThreat.GetThreatVelocity() { //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_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_0023: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsOwner) { return base.agent.velocity; } return agentLocalVelocity; } float IVisibleThreat.GetVisibility() { if (base.creatureAnimator.GetBool("Asleep")) { return 0.4f; } return 0.77f; } int IVisibleThreat.SendSpecialBehaviour(int id) { return 0; } GrabbableObject IVisibleThreat.GetHeldObject() { if (carryingEgg) { return (GrabbableObject)(object)takeEggBackToNest; } return null; } bool IVisibleThreat.IsThreatDead() { return base.isEnemyDead; } public override void Start() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_008d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); treeColliders = (Collider[])(object)new Collider[10]; if (StartOfRound.Instance.inShipPhase) { Debug.Log((object)"Giant kiwi has detected the game is in test mode."); if ((Object)(object)birdNest == (Object)null) { birdNest = ((Component)Object.FindObjectOfType<EnemyAINestSpawnObject>()).gameObject; ((Behaviour)base.agent).enabled = false; ((Component)this).transform.position = birdNest.transform.position; ((Component)this).transform.rotation = birdNest.transform.rotation; ((Behaviour)base.agent).enabled = true; } } if (((NetworkBehaviour)this).IsServer) { if (!StartOfRound.Instance.inShipPhase) { SpawnBirdNest(); } SpawnNestEggs(); syncedEggsPosition = true; } birdRandom = new Random(StartOfRound.Instance.randomMapSeed + 33); idleTimer = 15f; baseEyeRotationLeft = leftEyeMesh.localEulerAngles; baseEyeRotation = rightEyeMesh.localEulerAngles; shipDoor = Object.FindObjectOfType<HangarShipDoor>(); } private Vector3 GetRandomPositionAroundObject(Vector3 objectPos, float radius = 16f, Random seed = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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) //IL_0018: 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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) return RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(objectPos, radius, default(NavMeshHit), seed, -1, 0.5f); } [ServerRpc(RequireOwnership = false)] public void PeckTreeServerRpc(bool isPecking) { PeckTreeClientRpc(isPecking); } [ClientRpc] public void PeckTreeClientRpc(bool isPecking) { if (!((NetworkBehaviour)this).IsOwner) { isPeckingTree = isPecking; base.creatureAnimator.SetBool("peckTree", isPecking); } } [ServerRpc(RequireOwnership = false)] public void SetSleepingServerRpc() { SetSleepingClientRpc(); } [ClientRpc] public void SetSleepingClientRpc() { if (!((NetworkBehaviour)this).IsOwner) { base.creatureSFX.Play(); base.creatureAnimator.SetBool("Asleep", true); } } public override void OnDrawGizmos() { //IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnDrawGizmos(); if (!((Object)(object)HUDManager.Instance == (Object)null) && base.debugEnemyAI) { Gizmos.DrawWireSphere(base.eye.position + base.eye.forward * 38f + base.eye.up * 8f, 40f); } } private void LookAtTargetInterest() { } private bool CheckLOSForCreatures(Vector3 protectingPosition, bool protectAllEggs = false, bool mustHavePath = false) { //IL_0007: 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_001c: 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_0095: 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_00ca: 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) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_0192: 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_0785: Unknown result type (might be due to invalid IL or missing references) //IL_078a: 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_0205: Invalid comparison between Unknown and I4 //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Invalid comparison between Unknown and I4 //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Invalid comparison between Unknown and I4 //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Invalid comparison between Unknown and I4 //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapSphereNonAlloc(base.eye.position + base.eye.up * 8f, 40f, RoundManager.Instance.tempColliderResults, visibleThreatsMask, (QueryTriggerInteraction)2); IVisibleThreat val = watchingThreat; checkLOSDistance = 1000f; IVisibleThreat val2 = null; IVisibleThreat val3 = null; float num2 = 1000f; int num3 = -1; RaycastHit val5 = default(RaycastHit); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < num; i++) { if ((Object)(object)RoundManager.Instance.tempColliderResults[i] == (Object)(object)ownCollider) { continue; } float num4 = Vector3.Distance(base.eye.position, ((Component)RoundManager.Instance.tempColliderResults[i]).transform.position); Vector3.Angle(((Component)RoundManager.Instance.tempColliderResults[i]).transform.position - base.eye.position, base.eye.forward); if (!((Component)((Component)RoundManager.Instance.tempColliderResults[i]).transform).TryGetComponent<IVisibleThreat>(ref seenThreat)) { continue; } bool flag = false; PlayerControllerB val4 = null; if ((int)seenThreat.type == 0) { val4 = ((Component)seenThreat.GetThreatTransform()).GetComponent<PlayerControllerB>(); if ((Object)(object)abandonedThreat != (Object)null && (Object)(object)val4 == (Object)(object)abandonedThreat) { continue; } flag = val4.isInHangarShipRoom && base.isInsidePlayerShip; } if (!flag && Physics.Linecast(base.eye.position, seenThreat.GetThreatLookTransform().position, ref val5, 33556737, (QueryTriggerInteraction)1)) { if (base.debugEnemyAI) { } continue; } EnemyAI component = ((Component)seenThreat.GetThreatTransform()).GetComponent<EnemyAI>(); if ((Object)(object)component != (Object)null && (component.isEnemyDead || (int)seenThreat.type == 2 || (int)seenThreat.type == 4 || ((int)seenThreat.type == 3 && num4 > 6f) || num4 > 16f)) { continue; } float visibility = seenThreat.GetVisibility(); if (visibility < 1f) { if (visibility == 0f) { continue; } if (visibility < 0.2f && num4 > 10f) { if (base.currentBehaviourStateIndex != 2 || timeSinceSeeingThreat > 0.25f) { continue; } } else if (visibility < 0.6f && num4 > 20f) { if (base.currentBehaviourStateIndex != 2 || timeSinceSeeingThreat > 0.5f) { continue; } } else if (visibility < 0.8f && num4 > 24f) { continue; } } if (base.debugEnemyAI) { Debug.Log((object)$"Bird: Seeing visible threat: {((Object)((Component)RoundManager.Instance.tempColliderResults[i]).transform).name}; type: {seenThreat.type}"); } Transform threatTransform = seenThreat.GetThreatTransform(); if (mustHavePath && !flag) { bool flag2 = false; if (i > 10 && (Object)(object)val4 == (Object)null) { if (num4 > 12f) { continue; } if (num4 < 8f) { flag2 = true; } } if (num4 < 1f) { flag2 = true; } if (!flag2) { Vector3 val6 = threatTransform.position; if (Physics.Raycast(threatTransform.position + Vector3.up * 0.25f, Vector3.down, ref val7, 10f, 33556737, (QueryTriggerInteraction)1)) { val6 = ((RaycastHit)(ref val7)).point; Debug.DrawRay(threatTransform.position + Vector3.up * 0.25f, Vector3.down * ((RaycastHit)(ref val7)).distance, Color.blue, base.AIIntervalTime); } if (num4 < 30f && (Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)null && val4.isInHangarShipRoom) { val6 = StartOfRound.Instance.shipStrictInnerRoomBounds.ClosestPoint(val6); } float num5 = 2f; int num6 = -1; VehicleController val8 = Object.FindObjectOfType<VehicleController>(); if ((Object)(object)val8 != (Object)null && Vector3.Distance(threatTransform.position, ((Component)val8).transform.position) < 20f) { num5 = 6f; num6 = -33; } if (((EnemyAI)this).PathIsIntersectedByLineOfSight(RoundManager.Instance.GetNavMeshPosition(threatTransform.position, navHitB, num5, num6), true, false, false) || base.pathDistance - num4 > 20f) { continue; } } } bool flag3 = seenThreatsHoldingEgg.Contains(threatTransform); if (!flag3) { for (int j = 0; j < eggs.Count; j++) { if ((Object)(object)val4 != (Object)null && ((GrabbableObject)eggs[j]).isInShipRoom && val4.isInHangarShipRoom) { seenThreatsHoldingEgg.Add(threatTransform); num3 = (int)((Component)seenThreat.GetThreatTransform()).GetComponent<PlayerControllerB>().playerClientId; flag3 = true; break; } if (Vector3.Distance(((Component)eggs[j]).transform.position, threatTransform.position) < 3f) { seenThreatsHoldingEgg.Add(threatTransform); if ((int)seenThreat.type == 0) { num3 = (int)((Component)seenThreat.GetThreatTransform()).GetComponent<PlayerControllerB>().playerClientId; } flag3 = true; break; } } } int num7 = 1; if (protectAllEggs) { num7 = eggs.Count; } for (int k = 0; k < num7; k++) { if (protectAllEggs) { protectingPosition = ((Component)eggs[k]).transform.position; } num4 = Vector3.Distance(threatTransform.position, protectingPosition); if (flag3 && num4 < num2) { num2 = num4; val3 = seenThreat; } if (num4 < checkLOSDistance) { checkLOSDistance = num4; val2 = seenThreat; } } } if (num2 < 20f && val3 != null) { checkLOSDistance = num2; val2 = val3; } if (num3 != -1) { AddToThreatsHoldingEggListServerRpc(num3); } if (val2 != null) { if (watchingThreat == null || Vector3.Distance(watchingThreat.GetThreatTransform().position, protectingPosition) - checkLOSDistance > 4f) { watchingThreat = val2; if (val == null || watchingThreat != val) { SyncWatchingThreatServerRpc(NetworkObjectReference.op_Implicit(((Component)watchingThreat.GetThreatTransform()).GetComponent<NetworkObject>()), (int)GameNetworkManager.Instance.localPlayerController.playerClientId); } } lastSeenPositionOfWatchedThreat = watchingThreat.GetThreatTransform().position; return true; } return false; } [ServerRpc(RequireOwnership = false)] public void AddToThreatsHoldingEggListServerRpc(int idOfPlayerAdded) { AddToThreatsHoldingEggListClientRpc(idOfPlayerAdded); } [ClientRpc] public void AddToThreatsHoldingEggListClientRpc(int idOfPlayerAdded) { if (!seenThreatsHoldingEgg.Contains(((Component)StartOfRound.Instance.allPlayerScripts[idOfPlayerAdded]).transform)) { seenThreatsHoldingEgg.Add(((Component)StartOfRound.Instance.allPlayerScripts[idOfPlayerAdded]).transform); } } [ServerRpc(RequireOwnership = false)] public void SyncWatchingThreatServerRpc(NetworkObjectReference seenThreatNetworkObject, int playerWhoSent) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SyncWatchingThreatClientRpc(seenThreatNetworkObject, playerWhoSent); } [ClientRpc] public void SyncWatchingThreatClientRpc(NetworkObjectReference seenThreatNetworkObject, int playerWhoSent) { NetworkObject val = default(NetworkObject); if (playerWhoSent != (int)GameNetworkManager.Instance.localPlayerController.playerClientId && ((NetworkObjectReference)(ref seenThreatNetworkObject)).TryGet(ref val, (NetworkManager)null) && !((Component)val).TryGetComponent<IVisibleThreat>(ref watchingThreat)) { Debug.LogWarning((object)"Threat seen by bird synced across server did not have IVisibleThreat interface?"); } } private KiwiBabyItem GetClosestLostEgg(bool foundEggs = false, KiwiBabyItem excludeEgg = null, bool checkPath = false, bool allEggs = false) { //IL_004f: 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) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) float num = 2000f; int num2 = -1; if (allEggs) { for (int i = 0; i < eggs.Count; i++) { if (!((GrabbableObject)eggs[i]).deactivated && !((GrabbableObject)eggs[i]).isInFactory) { float num3 = Vector3.Distance(((Component)this).transform.position, ((Component)eggs[i]).transform.position); if (num3 < num) { num = num3; num2 = i; } } } if (num2 == -1) { return null; } return eggs[num2]; } if (foundEggs) { for (int j = 0; j < LostEggsFound.Count; j++) { if (!((GrabbableObject)LostEggsFound[j]).isInFactory && !((GrabbableObject)LostEggsFound[j]).deactivated && (!((Object)(object)excludeEgg != (Object)null) || !((Object)(object)LostEggsFound[j] == (Object)(object)excludeEgg))) { float num4 = Vector3.Distance(((Component)this).transform.position, ((Component)LostEggsFound[j]).transform.position); if ((!checkPath || (base.agent.isOnNavMesh && base.agent.CalculatePath(((Component)LostEggsFound[j]).transform.position, base.path1) && !(Vector3.Distance(base.path1.corners[base.path1.corners.Length - 1], ((Component)LostEggsFound[j]).transform.position) > 3f))) && num4 < num) { num = num4; num2 = j; } } } eggDist = num; if (num2 == -1) { return null; } return LostEggsFound[num2]; } for (int k = 0; k < LostEggs.Count; k++) { if (!((GrabbableObject)LostEggs[k]).isInFactory && (LostEggs[k].screaming || LostEggs[k].hasScreamed) && !((GrabbableObject)LostEggs[k]).deactivated && (!((Object)(object)excludeEgg != (Object)null) || !((Object)(object)LostEggs[k] == (Object)(object)excludeEgg))) { float num5 = Vector3.Distance(((Component)this).transform.position, ((Component)LostEggs[k]).transform.position); if (num5 < num) { num = num5; num2 = k; } } } eggDist = num; if (num2 == -1) { return null; } return LostEggs[num2]; } private void PickUpEgg(KiwiBabyItem egg) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)takeEggBackToNest != (Object)null && carryingEgg) { Debug.LogError((object)"Bird Error: GrabItemAndSync called when baboon is already carrying scrap!"); } NetworkObject component = ((Component)egg).GetComponent<NetworkObject>(); GrabScrap(component); GrabScrapServerRpc(NetworkObjectReference.op_Implicit(component), (int)GameNetworkManager.Instance.localPlayerController.playerClientId); } [ServerRpc] public void GrabScrapServerRpc(NetworkObjectReference item, int clientWhoSentRPC) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref item)).TryGet(ref val, (NetworkManager)null)) { Debug.LogError((object)$"Baboon #{base.thisEnemyIndex} error: Could not get grabbed network object from reference on server"); } else if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<GrabbableObject>()) && !((Component)val).GetComponent<GrabbableObject>().heldByPlayerOnServer) { GrabScrapClientRpc(item, clientWhoSentRPC); } } [ClientRpc] public void GrabScrapClientRpc(NetworkObjectReference item, int clientWhoSentRPC) { if (clientWhoSentRPC != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { NetworkObject item2 = default(NetworkObject); if (((NetworkObjectReference)(ref item)).TryGet(ref item2, (NetworkManager)null)) { GrabScrap(item2); } else { Debug.LogError((object)$"Baboon #{base.thisEnemyIndex}; Error, was not able to get id from grabbed item client rpc"); } } } private void GrabScrap(NetworkObject item) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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) if ((Object)(object)takeEggBackToNest != (Object)null && carryingEgg) { DropScrap(((GrabbableObject)takeEggBackToNest).GetItemFloorPosition(default(Vector3))); } KiwiBabyItem component = ((Component)item).gameObject.GetComponent<KiwiBabyItem>(); carryingEgg = true; takeEggBackToNest = component; ((GrabbableObject)component).parentObject = grabTarget; ((GrabbableObject)component).hasHitGround = false; ((GrabbableObject)component).GrabItemFromEnemy((EnemyAI)(object)this); ((GrabbableObject)component).isHeldByEnemy = true; ((GrabbableObject)component).EnablePhysics(false); } private void DropEgg(bool dropInNest = false) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) //IL_00da: 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_00ec: 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) if ((Object)(object)takeEggBackToNest == (Object)null || !carryingEgg) { Debug.LogError((object)"Bird Error: DropItemAndSync called when baboon has no scrap!"); } NetworkObject networkObject = ((NetworkBehaviour)takeEggBackToNest).NetworkObject; if (!networkObject.IsSpawned) { Debug.LogError((object)"Bird Error: Bird egg not spawned for clients"); return; } Vector3 targetFloorPosition; if (dropInNest) { int num = -1; for (int i = 0; i < eggs.Count; i++) { if ((Object)(object)takeEggBackToNest == (Object)(object)eggs[i]) { num = i; break; } } targetFloorPosition = birdNest.GetComponent<EnemyAINestSpawnObject>().nestPositions[num].position; } else { targetFloorPosition = ((GrabbableObject)takeEggBackToNest).GetItemFloorPosition(default(Vector3)); } DropScrap(targetFloorPosition, dropInNest); DropScrapServerRpc(NetworkObjectReference.op_Implicit(networkObject), targetFloorPosition, dropInNest, (int)GameNetworkManager.Instance.localPlayerController.playerClientId); } [ServerRpc(RequireOwnership = false)] public void DropScrapServerRpc(NetworkObjectReference item, Vector3 targetFloorPosition, bool droppedInNest, int clientWhoSentRPC) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) DropScrapClientRpc(item, targetFloorPosition, droppedInNest, clientWhoSentRPC); } [ClientRpc] public void DropScrapClientRpc(NetworkObjectReference item, Vector3 targetFloorPosition, bool droppedInNest, int clientWhoSentRPC) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (clientWhoSentRPC != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref item)).TryGet(ref val, (NetworkManager)null)) { DropScrap(targetFloorPosition); } else { Debug.LogError((object)"Bird: Error, was not able to get network object from dropped item client rpc"); } } } private void DropScrap(Vector3 targetFloorPosition, bool droppedInNest = false) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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) if ((Object)(object)takeEggBackToNest == (Object)null) { Debug.LogError((object)"Bird: my held item is null when attempting to drop it!!"); return; } if (((GrabbableObject)takeEggBackToNest).isHeld) { ((GrabbableObject)takeEggBackToNest).DiscardItemFromEnemy(); ((GrabbableObject)takeEggBackToNest).isHeldByEnemy = false; takeEggBackToNest = null; return; } ((GrabbableObject)takeEggBackToNest).parentObject = null; ((Component)takeEggBackToNest).transform.SetParent(StartOfRound.Instance.propsContainer, true); ((GrabbableObject)takeEggBackToNest).EnablePhysics(true); ((GrabbableObject)takeEggBackToNest).fallTime = 0f; ((GrabbableObject)takeEggBackToNest).startFallingPosition = ((Component)takeEggBackToNest).transform.parent.InverseTransformPoint(((Component)takeEggBackToNest).transform.position); ((GrabbableObject)takeEggBackToNest).targetFloorPosition = ((Component)takeEggBackToNest).transform.parent.InverseTransformPoint(targetFloorPosition); ((GrabbableObject)takeEggBackToNest).floorYRot = -1; ((GrabbableObject)takeEggBackToNest).DiscardItemFromEnemy(); ((GrabbableObject)takeEggBackToNest).isHeldByEnemy = false; if (droppedInNest) { if (LostEggsFound.Contains(takeEggBackToNest)) { LostEggsFound.Remove(takeEggBackToNest); } if (LostEggs.Contains(takeEggBackToNest)) { LostEggs.Remove(takeEggBackToNest); } } carryingEgg = false; takeEggBackToNest = null; } private bool AttackIfThreatened(bool onlyWhenAwake, Vector3 protectPosition, float aggroDistance = 10f, bool forget = false) { //IL_005f: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (onlyWhenAwake && base.currentBehaviourStateIndex == 0 && ((idleBehaviour == 2 && base.creatureAnimator.GetBool("Asleep") && miscTimer < 0.4f) || (idleBehaviour == 0 && miscTimer > 0.5f))) { return false; } if (CheckLOSForCreatures(protectPosition, protectAllEggs: false, mustHavePath: true)) { float num = Vector3.Distance(watchingThreat.GetThreatTransform().position, protectPosition); bool flag = false; VehicleController val = Object.FindObjectOfType<VehicleController>(); if ((Object)(object)val != (Object)null && Vector3.Distance(((Component)val).transform.position, protectPosition) < 20f) { flag = true; } if (flag || num < aggroDistance || seenThreatsHoldingEgg.Contains(watchingThreat.GetThreatTransform())) { if (num < 2f && !seenThreatsHoldingEgg.Contains(watchingThreat.GetThreatTransform())) { seenThreatsHoldingEgg.Add(watchingThreat.GetThreatTransform()); } return true; } if (forget) { if (num < 22f) { timeSinceSeeingThreat = 0f; } else { timeSinceSeeingThreat += base.AIIntervalTime; } } } else if (forget) { timeSinceSeeingThreat += base.AIIntervalTime; } return false; } private void CarryEggBackToNest() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) _ = miscTimer; ((EnemyAI)this).SetDestinationToPosition(birdNest.transform.position, false); if (Vector3.Distance(((Component)this).transform.position, birdNest.transform.position) < 3f) { DropEgg(dropInNest: true); } } private void PatrolAroundEgg() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) if (!patrollingEgg.screaming) { behaviourTimer -= base.AIIntervalTime; } else { ((EnemyAI)this).SetDestinationToPosition(((Component)patrollingEgg).transform.position, false); if (Vector3.Distance(((Component)this).transform.position, ((Component)patrollingEgg).transform.position) < 14f) { behaviourTimer -= base.AIIntervalTime * 0.65f; } } if (behaviourTimer < 0f) { if (LostEggs.Contains(patrollingEgg)) { LostEggs.Remove(patrollingEgg); } if (!LostEggsFound.Contains(patrollingEgg)) { LostEggsFound.Add(patrollingEgg); } patrollingEgg = null; miscTimer = 0f; } else if (miscTimer < 0f) { miscTimer = 1.5f; wasPatrollingEgg = true; Vector3 val = GetRandomPositionAroundObject(((Component)patrollingEgg).transform.position, 12f, idleRandom); if (((EnemyAI)this).PathIsIntersectedByLineOfSight(val, true, false, false) || base.pathDistance > 35f) { val = birdNest.transform.position; } ((EnemyAI)this).SetDestinationToPosition(val, false); } } private void AbandonLostEgg(KiwiBabyItem egg) { //IL_0024: 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) if (LostEggs.Contains(egg)) { egg.timeLastAbandoned = Time.realtimeSinceStartup; egg.positionWhenLastAbandoned = ((Component)egg).transform.position; LostEggs.Remove(egg); if (LostEggsFound.Contains(egg)) { LostEggsFound.Remove(egg); } } } private bool TryAbandonEgg(KiwiBabyItem egg, bool gotPath, Vector3 actualEggPosition) { //IL_000a: 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) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (!gotPath || (Vector3.Distance(((Component)this).transform.position, base.destination) < 16f && Vector3.Distance(base.destination, actualEggPosition) >= 3f)) { if (!(eggDist > 20f)) { AbandonLostEgg(egg); return true; } if (behaviourTimer < 0f) { behaviourTimer = 3f; AbandonLostEgg(egg); return true; } } return false; } private Vector3 GetActualEggPosition(KiwiBabyItem closestEgg) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0025: 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_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_005c: 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_006e: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)closestEgg).transform.position; if (IsEggInsideClosedTruck(closestEgg)) { RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(((Component)closestEgg).transform.position + Vector3.up * 0.5f, Vector3.down, ref val2, 25f, 33556737, (QueryTriggerInteraction)1)) { val = RoundManager.Instance.GetNavMeshPosition(((RaycastHit)(ref val2)).point, navHitB, 10f, -33); } } else if (((GrabbableObject)closestEgg).isHeld && (Object)(object)((GrabbableObject)closestEgg).playerHeldBy != (Object)null) { RaycastHit val3 = default(RaycastHit); val = ((!Physics.Raycast(((Component)((GrabbableObject)closestEgg).playerHeldBy).transform.position + Vector3.up * 0.5f, Vector3.down, ref val3, 25f, 33556737, (QueryTriggerInteraction)1)) ? ((Component)((GrabbableObject)closestEgg).playerHeldBy).transform.position : ((RaycastHit)(ref val3)).point); } else if (((GrabbableObject)closestEgg).isHeldByEnemy) { for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++) { if (RoundManager.Instance.SpawnedEnemies[i].enemyType.isOutsideEnemy && !RoundManager.Instance.SpawnedEnemies[i].enemyType.isDaytimeEnemy && (Object)(object)RoundManager.Instance.SpawnedEnemies[i].enemyType == (Object)(object)baboonHawkType) { val = ((Component)RoundManager.Instance.SpawnedEnemies[i]).transform.position; } } } if (((GrabbableObject)closestEgg).isInShipRoom || ((Object)(object)((GrabbableObject)closestEgg).playerHeldBy != (Object)null && ((GrabbableObject)closestEgg).playerHeldBy.isInHangarShipRoom)) { val = StartOfRound.Instance.shipStrictInnerRoomBounds.ClosestPoint(val); val.y = StartOfRound.Instance.playerSpawnPositions[0].position.y; } return val; } private void BeginPryOpenDoor() { StartPryOpenDoorAnimationOnLocalClient(); PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId); } private void FinishPryOpenDoor(bool cancelledEarly) { FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly); PryOpenDoorServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId, finishAnim: true, cancelledEarly); } [ServerRpc(RequireOwnership = false)] public void PryOpenDoorServerRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false) { PryOpenDoorClientRpc(playerWhoSent, finishAnim, cancelledEarly); } [ClientRpc] public void PryOpenDoorClientRpc(int playerWhoSent, bool finishAnim = false, bool cancelledEarly = false) { if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId != playerWhoSent) { if (!finishAnim) { StartPryOpenDoorAnimationOnLocalClient(); } else { FinishPryOpenDoorAnimationOnLocalClient(cancelledEarly); } } } private void FinishPryOpenDoorAnimationOnLocalClient(bool cancelledEarly = false) { if (!cancelledEarly) { shipDoor.shipDoorsAnimator.SetBool("Closed", false); StartOfRound.Instance.SetShipDoorsClosed(false); StartOfRound.Instance.SetShipDoorsOverheatLocalClient(); shipDoor.doorPower = 0f; } pryingOpenDoor = false; base.inSpecialAnimation = false; base.creatureAnimator.SetBool("PryingOpenDoor", false); shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", false); base.creatureAnimator.SetLayerWeight(1, 1f); } private void StartPryOpenDoorAnimationOnLocalClient() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)base.agent).enabled = false; pryingOpenDoor = true; base.inSpecialAnimation = true; base.creatureAnimator.SetBool("PryingOpenDoor", true); shipDoor.shipDoorsAnimator.SetBool("PryingOpenDoor", true); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", 0f); breakDownDoorAudio.PlayOneShot(breakAndEnter); WalkieTalkie.TransmitOneShotAudio(breakDownDoorAudio, breakAndEnter, 1f); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 0.9f, 0, false, 0); StartOfRound.Instance.speakerAudioSource.PlayOneShot(shipAlarm); WalkieTalkie.TransmitOneShotAudio(StartOfRound.Instance.speakerAudioSource, shipAlarm, 1f); if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, ((Component)this).transform.position) < 18f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)3); } } public bool BreakIntoShip() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)shipDoor == (Object)null) { Debug.LogError((object)"Bird error: ship door is null"); return false; } if (pryingOpenDoor) { if (pryingDoorAnimTime >= 1f) { FinishPryOpenDoor(cancelledEarly: false); } return true; } if (StartOfRound.Instance.hangarDoorsClosed) { Bounds bounds = StartOfRound.Instance.shipStrictInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(base.destination) && Vector3.Distance(((Component)this).transform.position, shipDoor.outsideDoorPoint.position) < 4f) { BeginPryOpenDoor(); return true; } } return false; } private bool IsEggInsideClosedTruck(KiwiBabyItem egg, bool closedTruck = false) { VehicleController val = Object.FindObjectOfType<VehicleController>(); if ((Object)(object)val == (Object)null) { return false; } if ((Object)(object)((GrabbableObject)egg).parentObject == (Object)(object)((Component)val.physicsRegion.parentNetworkObject).transform) { if (closedTruck) { return !val.backDoorOpen; } return true; } return false; } [ServerRpc(RequireOwnership = false)] public void SetDancingServerRpc(bool setDance) { SetDancingClientRpc(setDance); } [ClientRpc] public void SetDancingClientRpc(bool setDance) { if (!((NetworkBehaviour)this).IsOwner) { base.creatureAnimator.SetBool("Dancing", setDance); } } private bool HasLOSToEgg(KiwiBabyItem egg) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (Physics.Linecast(((Component)egg).transform.position + Vector3.up * 1.6f, ((Component)this).transform.position + Vector3.up * 1.6f, 256, (QueryTriggerInteraction)1)) { if (base.isInsidePlayerShip) { return ((GrabbableObject)egg).isInShipRoom; } return false; } return true; } public bool PreoccupiedWithDefensePriorities() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) base.agent.stoppingDistance = 1f; if (carryingEgg && (Object)(object)takeEggBackToNest != (Object)null) { behaviourTimer = 3f; if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } if (AttackIfThreatened(onlyWhenAwake: false, ((Component)this).transform.position, 8f)) { StartAttackingAndSync(); return true; } miscTimer -= base.AIIntervalTime; CarryEggBackToNest(); return true; } if (Object.op_Implicit((Object)(object)patrollingEgg)) { miscTimer -= base.AIIntervalTime; if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } if (AttackIfThreatened(onlyWhenAwake: false, ((Component)patrollingEgg).transform.position, 12f)) { StartAttackingAndSync(); return true; } PatrolAroundEgg(); return true; } if (LostEggs.Count > 0) { if (carryingEgg && (Object)(object)takeEggBackToNest != (Object)null) { DropEgg(Object.op_Implicit((Object)(object)takeEggBackToNest)); } if (wasPatrollingEgg) { wasPatrollingEgg = false; } if (!wasLookingForEggs) { wasLookingForEggs = true; Screech(enraged: true, sync: true); } KiwiBabyItem closestLostEgg = GetClosestLostEgg(); if ((Object)(object)closestLostEgg == (Object)null) { if (!searchForLostEgg.inProgress) { if (watchingThreat != null) { ((EnemyAI)this).StartSearch(watchingThreat.GetThreatTransform().position, searchForLostEgg); } else { ((EnemyAI)this).StartSearch(StartOfRound.Instance.shipLandingPosition.position, searchForLostEgg); } } if (AttackIfThreatened(onlyWhenAwake: false, ((Component)this).transform.position)) { StartAttackingAndSync(); return true; } for (int i = 0; i < LostEggs.Count; i++) { if (HasLOSToEgg(LostEggs[i]) && Vector3.Distance(((Component)this).transform.position, ((Component)LostEggs[i]).transform.position) < 24f) { patrollingEgg = LostEggs[i]; behaviourTimer = 3f; miscTimer = 1f; return true; } } return true; } if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } if (AttackIfThreatened(onlyWhenAwake: false, ((Component)closestLostEgg).transform.position)) { StartAttackingAndSync(); return true; } Vector3 actualEggPosition = GetActualEggPosition(closestLostEgg); ((EnemyAI)this).SetDestinationToPosition(actualEggPosition, false); if (((GrabbableObject)closestLostEgg).isInShipRoom) { base.destination = StartOfRound.Instance.shipStrictInnerRoomBounds.ClosestPoint(base.destination); base.destination.y = StartOfRound.Instance.playerSpawnPositions[0].position.y; } bool gotPath = ((EnemyAI)this).SetDestinationToPosition(actualEggPosition, true); if (TryAbandonEgg(closestLostEgg, gotPath, actualEggPosition)) { behaviourTimer = 3f; return true; } behaviourTimer -= base.AIIntervalTime * 0.65f; if (HasLOSToEgg(closestLostEgg) && eggDist < 6f) { if (AttackIfThreatened(onlyWhenAwake: false, ((Component)closestLostEgg).transform.position)) { StartAttackingAndSync(); return true; } patrollingEgg = closestLostEgg; behaviourTimer = 3f; miscTimer = 1f; closestLostEgg = GetClosestLostEgg(foundEggs: false, closestLostEgg); if ((Object)(object)closestLostEgg != (Object)null && eggDist < 20f) { LostEggs.Remove(patrollingEgg); if (!LostEggsFound.Contains(patrollingEgg)) { LostEggsFound.Add(patrollingEgg); } miscTimer = 0f; patrollingEgg = null; } } return true; } if (LostEggsFound.Count > 0) { behaviourTimer = 3f; if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } defenseBehaviour = "return eggs"; if ((Object)(object)takeEggBackToNest != (Object)null) { if (HasLOSToEgg(takeEggBackToNest) && Vector3.Distance(((Component)this).transform.position, ((Component)takeEggBackToNest).transform.position) <= 3f) { PickUpEgg(takeEggBackToNest); miscTimer = 0.7f; return true; } if (AttackIfThreatened(onlyWhenAwake: false, ((Component)takeEggBackToNest).transform.position)) { StartAttackingAndSync(); return true; } } else if (AttackIfThreatened(onlyWhenAwake: false, ((Component)this).transform.position)) { StartAttackingAndSync(); return true; } miscTimer -= base.AIIntervalTime; if (miscTimer <= 0f) { miscTimer = 6f; KiwiBabyItem closestLostEgg2 = GetClosestLostEgg(foundEggs: true, null, checkPath: true); if ((Object)(object)closestLostEgg2 != (Object)null) { Vector3 actualEggPosition2 = GetActualEggPosition(closestLostEgg2); ((EnemyAI)this).SetDestinationToPosition(actualEggPosition2, false); if (((GrabbableObject)closestLostEgg2).isInShipRoom) { base.destination = StartOfRound.Instance.shipStrictInnerRoomBounds.ClosestPoint(base.destination); base.destination.y = StartOfRound.Instance.playerSpawnPositions[0].position.y; } bool gotPath2 = ((EnemyAI)this).SetDestinationToPosition(actualEggPosition2, true); if (TryAbandonEgg(closestLostEgg2, gotPath2, actualEggPosition2)) { behaviourTimer = 3f; takeEggBackToNest = null; return true; } behaviourTimer -= base.AIIntervalTime * 0.65f; takeEggBackToNest = closestLostEgg2; } } return true; } return false; } private bool CheckNestForLostEgg() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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) bool result = false; if (Vector3.Distance(((Component)this).transform.position, birdNest.transform.position) < 12f && !Physics.Linecast(base.eye.position, birdNest.transform.position + Vector3.up * 1.2f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { int num = 0; for (int i = 0; i < eggs.Count; i++) { if (Vector3.Distance(((Component)eggs[i]).transform.position, birdNest.transform.position) > 6f) { num++; } } if (num >= 2) { for (int j = 0; j < eggs.Count; j++) { if (Vector3.Distance(((Component)eggs[j]).transform.position, birdNest.transform.position) > 6f && !LostEggs.Contains(eggs[j])) { LostEggs.Add(eggs[j]); result = true; } } } } return result; } private void ReactToThreatAttack(IVisibleThreat threat, bool doLOSCheck = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_003a: Unknown result type (might be due to invalid IL or missing references) if (threat != null && Vector3.Distance(((Component)this).transform.position, threat.GetThreatTransform().position) < 22f && (!doLOSCheck || !Physics.Linecast(base.eye.position, threat.GetThreatLookTransform().position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { if (!seenThreatsHoldingEgg.Contains(threat.GetThreatTransform())) { seenThreatsHoldingEgg.Add(threat.GetThreatTransform()); } if (base.currentBehaviourStateIndex != 2) { watchingThreat = threat; attackingThreat = threat; StartAttackingAndSync(); } } } public override void NavigateTowardsTargetPlayer() { //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_013b: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (base.setDestinationToPlayerInterval <= 0f) { base.setDestinationToPlayerInterval = 0.25f; VehicleController val = Object.FindObjectOfType<VehicleController>(); if ((Object)(object)val != (Object)null) { Debug.Log((object)$"dist: {Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)val).transform.position)}"); } if ((Object)(object)val != (Object)null && Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)val).transform.position) < 10f) { bool flag = (Object)(object)val.currentDriver == (Object)(object)base.targetPlayer || (Object)(object)val.currentPassenger == (Object)(object)base.targetPlayer; bool flag2 = ((Collider)val.boundsCollider).ClosestPoint(((Component)base.targetPlayer).transform.position) == ((Component)base.targetPlayer).transform.position; int num = -1; if (flag || (flag2 && !val.backDoorOpen) || val.ontopOfTruckCollider.ClosestPoint(((Component)base.targetPlayer).transform.position) == ((Component)base.targetPlayer).transform.position) { targetPlayerIsInTruck = true; num = -33; } base.destination = RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, RoundManager.Instance.navHit, 5.5f, num); } else { targetPlayerIsInTruck = false; base.destination = RoundManager.Instance.GetNavMeshPosition(((Component)base.targetPlayer).transform.position, RoundManager.Instance.navHit, 2.7f, -1); } } else { if (!targetPlayerIsInTruck) { base.destination = new Vector3(((Component)base.targetPlayer).transform.position.x, base.destination.y, ((Component)base.targetPlayer).transform.position.z); } base.setDestinationToPlayerInterval -= Time.deltaTime; } if (base.addPlayerVelocityToDestination > 0f) { if ((Object)(object)base.targetPlayer == (Object)(object)GameNetworkManager.Instance.localPlayerController) { base.destination += Vector3.Normalize(base.targetPlayer.thisController.velocity * 100f) * base.addPlayerVelocityToDestination; } else if (base.targetPlayer.timeSincePlayerMoving < 0.25f) { base.destination += Vector3.Normalize((base.targetPlayer.serverPlayerPosition - base.targetPlayer.oldPlayerPosition) * 100f) * base.addPlayerVelocityToDestination; } } } public override void DoAIInterval() { //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0689: Unknown result type (might be due to invalid IL or missing references) //IL_0bb3: Unknown result type (might be due to invalid IL or missing references) //IL_0bc3: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_0c26: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) //IL_08e5: Unknown result type (might be due to invalid IL or missing references) //IL_0ad3: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) //IL_0970: Unknown result type (might be due to invalid IL or missing references) //IL_0980: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09e7: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0ccc: Unknown result type (might be due to invalid IL or missing references) //IL_0cd2: Invalid comparison between Unknown and I4 //IL_0dfe: Unknown result type (might be due to invalid IL or missing references) //IL_0e0e: Unknown result type (might be due to invalid IL or missing references) //IL_0e7d: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Invalid comparison between Unknown and I4 //IL_0ef5: Unknown result type (might be due to invalid IL or missing references) //IL_0f3f: Unknown result type (might be due to invalid IL or missing references) //IL_0f45: Unknown result type (might be due to invalid IL or missing references) //IL_0f5f: Unknown result type (might be due to invalid IL or missing references) //IL_0fd6: Unknown result type (might be due to invalid IL or missing references) //IL_0fe6: Unknown result type (might be due to invalid IL or missing references) //IL_0feb: Unknown result type (might be due to invalid IL or missing references) //IL_1010: Unknown result type (might be due to invalid IL or missing references) //IL_1005: Unknown result type (might be due to invalid IL or missing references) //IL_1007: Unknown result type (might be due to invalid IL or missing references) //IL_100c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); if (base.stunNormalizedTimer > 0f) { IVisibleThreat threat = default(IVisibleThreat); if ((Object)(object)base.stunnedByPlayer != (Object)null && ((Component)base.stunnedByPlayer).TryGetComponent<IVisibleThreat>(ref threat)) { ReactToThreatAttack(threat); } } else if (base.currentBehaviourStateIndex != 2 && !((NetworkBehaviour)this).IsServer) { if (((NetworkBehaviour)this).IsOwner) { ((EnemyAI)this).ChangeOwnershipOfEnemy(((NetworkBehaviour)StartOfRound.Instance).OwnerClientId); } } else { if ((Object)(object)birdNest == (Object)null || StartOfRound.Instance.livingPlayers == 0) { return; } if (base.currentBehaviourStateIndex == 0 && (idleBehaviour != 2 || miscTimer > 0f) && CheckNestForLostEgg()) { Screech(enraged: true, sync: true); ((EnemyAI)this).SwitchToBehaviourState(1); return; } switch (base.currentBehaviourStateIndex) { case 0: if (LostEggs.Count > 0) { ((EnemyAI)this).SwitchToBehaviourState(1); break; } if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } timeSinceExitingAttackMode += base.AIIntervalTime; abandonedThreat = null; base.agent.acceleration = 41f; if (AttackIfThreatened(onlyWhenAwake: true, birdNest.transform.position, 22f, forget: true)) { if (checkLOSDistance < 6f) { StartAttackingAndSync(); break; } if (Random.Range(0, 100) < 50) { Screech(enraged: false, sync: true); } timeSinceSeeingThreat = 0f; ((EnemyAI)this).SwitchToBehaviourState(1); break; } if (timeSinceSeeingThreat > 2f) { watchingThreat = null; } if (idleBehaviour == 0) { if (miscTimer > 0f) { miscTimer -= base.AIIntervalTime; base.agent.speed = 0f; break; } base.agent.speed = idlePatrolSpeed; base.agent.stoppingDistance = 0f; idleTimer -= base.AIIntervalTime; if (!triedRandomDance && Vector3.Distance(((Component)this).transform.position, base.destination) < 1f) { triedRandomDance = true; if (Random.Range(0, 100) < 7) { base.creatureAnimator.SetBool("Dancing", true); SetDancingServerRpc(setDance: true); } } if (idleTimer < 0f) { idleTimer = 7f; Vector3 val2 = GetRandomPositionAroundObject(birdNest.transform.position, 16f, idleRandom); if (((EnemyAI)this).PathIsIntersectedByLineOfSight(val2, true, false, false) || base.pathDistance > 25f) { val2 = birdNest.transform.position; } Debug.DrawRay(val2, Vector3.up * 5f, Color.cyan); ((EnemyAI)this).SetDestinationToPosition(val2, false); triedRandomDance = false; base.creatureAnimator.SetBool("Dancing", false); SetDancingServerRpc(setDance: false); } break; } if (idleBehaviour == 1) { base.agent.stoppingDistance = 1f; base.agent.speed = idlePatrolSpeed; idleTimer -= base.AIIntervalTime; if (idleTimer < 0f || (Object)(object)peckingTree == (Object)null) { idleTimer = 12f; if (isPeckingTree) { isPeckingTree = false; PeckTreeServerRpc(isPecking: false); base.creatureAnimator.SetBool("peckTree", false); } int num = Physics.OverlapSphereNonAlloc(birdNest.transform.position, 20f, treeColliders, 33554432); if (num <= 0) { idleBehaviour = 2; ChangeIdleBehaviorClientRpc(2); break; } int num2 = idleRandom.Next(0, num); peckingTree = ((Component)treeColliders[num2]).transform; ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetNavMeshPosition(peckingTree.position, navHitB, 5f, -1), false); } float num3 = Vector3.Distance(((Component)this).transform.position, base.destination); if (num3 < 4f) { if (!isPeckingTree) { isPeckingTree = true; PeckTreeServerRpc(isPecking: true); base.creatureAnimator.SetBool("peckTree", true); } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(((Component)peckingTree).transform.position.x, ((Component)this).transform.position.y, ((Component)peckingTree).transform.position.z); Ray val4 = new Ray(val3, ((Component)this).transform.position - val3); ((EnemyAI)this).SetDestinationToPosition(((Ray)(ref val4)).GetPoint(peckTreeDistance), false); } else if (num3 > 5f) { if (isPeckingTree) { isPeckingTree = false; PeckTreeServerRpc(isPecking: false); base.creatureAnimator.SetBool("peckTree", false); } ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetNavMeshPosition(peckingTree.position, default(NavMeshHit), 5f, -1), false); } break; } base.agent.stoppingDistance = 0f; idleTimer -= base.AIIntervalTime; if (Vector3.Distance(((Component)this).transform.position, base.destination) < 2f) { miscTimer -= base.AIIntervalTime; base.agent.speed = 0f; if (miscTimer < 0.5f) { watchingThreat = null; } if (miscTimer < 0f && !base.creatureAnimator.GetBool("Asleep")) { base.creatureAnimator.SetBool("Asleep", true); base.creatureSFX.Play(); SetSleepingServerRpc(); } } else { base.agent.speed = idlePatrolSpeed; } break; case 1: { if (BreakIntoShip()) { break; } timeSinceExitingAttackMode += base.AIIntervalTime; if ((Object)(object)abandonedThreat != (Object)null && timeSinceExitingAttackMode > 11f) { abandonedThreat = null; } float num4 = Vector3.Distance(((Component)this).transform.position, base.destination); if (num4 > 8f) { base.agent.speed = 18f; if (walkAnimSpeed < 1.5f) { walkAnimSpeed = 1.8f; base.creatureAnimator.SetFloat("WalkSpeed", walkAnimSpeed); SyncWalkAnimSpeedServerRpc(walkAnimSpeed); } } else if (num4 < 6f) { base.agent.speed = 12f; if (walkAnimSpeed > 1.5f) { walkAnimSpeed = 1f; base.creatureAnimator.SetFloat("WalkSpeed", walkAnimSpeed); SyncWalkAnimSpeedServerRpc(walkAnimSpeed); } } base.agent.acceleration = 41f; if (PreoccupiedWithDefensePriorities()) { break; } if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } behaviourTimer = 3f; if (AttackIfThreatened(onlyWhenAwake: false, birdNest.transform.position, 12f, forget: true)) { StartAttackingAndSync(); break; } if (timeSinceSeeingThreat > 4f) { watchingThreat = null; } if (watchingThreat == null) { ((EnemyAI)this).SwitchToBehaviourState(0); break; } base.agent.stoppingDistance = 4f; base.agent.acceleration = 51f; Ray val5 = default(Ray); ((Ray)(ref val5))..ctor(birdNest.transform.position, watchingThreat.GetThreatTransform().position - birdNest.transform.position); float num5 = Vector3.Distance(watchingThreat.GetThreatTransform().position, birdNest.transform.position); ((EnemyAI)this).SetDestinationToPosition(RoundManager.Instance.GetNavMeshPosition(((Ray)(ref val5)).GetPoint(Mathf.Max(num5 * 0.5f, protectNestRadius)), navHitB, 8f, -1), false); break; } case 2: { if (searchForLostEgg.inProgress) { ((EnemyAI)this).StopSearch(searchForLostEgg, true); } if (!wasOwnerLastFrame) { wasOwnerLastFrame = true; timeSpentChasingThreat = 0f; } if (BreakIntoShip()) { break; } bool flag = false; bool flag2 = attackingThreat.IsThreatDead(); if (attackingThreat != null) { timeSpentChasingThreat += base.AIIntervalTime; if (flag2 && LostEggs.Count > 0) { timeSinceSeeingThreat += base.AIIntervalTime; } if (timeSpentChasingThreat > 12f && (int)attackingThreat.type == 0 && LostEggs.Count > 0) { abandonedThreat = base.targetPlayer; for (int i = 0; i < LostEggs.Count; i++) { if (((GrabbableObject)LostEggs[i]).isHeld && (Object)(object)((GrabbableObject)LostEggs[i]).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)LostEggs[i]).playerHeldBy == (Object)(object)abandonedThreat) { AbandonLostEgg(LostEggs[i]); } } } } if ((Object)(object)lastPlayerWhoAttacked != (Object)null && timeSinceGettingHit < 0.5f && Vector3.Distance(((Component)this).transform.position, ((Component)lastPlayerWhoAttacked).transform.position) < 5f && !((EnemyAI)this).PathIsIntersectedByLineOfSight(((Component)lastPlayerWhoAttacked).transform.position, false, false, false)) { ((Component)lastPlayerWhoAttacked).TryGetComponent<IVisibleThreat>(ref watchingThreat); attackingThreat = watchingThreat; flag = true; } else { flag = CheckLOSForCreatures(((Component)this).transform.position, protectAllEggs: true, mustHavePath: true); } if (flag) { if (checkLOSDistance >= 17f && !seenThreatsHoldingEgg.Contains(watchingThreat.GetThreatTransform())) { timeSinceSeeingThreat += base.AIIntervalTime; } else { timeSinceSeeingThreat = 0f; } if (watchingThreat != attackingThreat) { timeSpentChasingThreat = 0f; attackingThreat = watchingThreat; if ((int)watchingThreat.type == 0) { PlayerControllerB component = ((Component)watchingThreat.GetThreatTransform()).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && base.currentOwnershipOnThisClient == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { wasOwnerLastFrame = false; ((EnemyAI)this).ChangeOwnershipOfEnemy(component.actualClientId); } break; } if (base.currentOwnershipOnThisClient != 0) { base.targetPlayer = null; base.movingTowardsTargetPlayer = false; ((EnemyAI)this).ChangeOwnershipOfEnemy(((NetworkBehaviour)StartOfRound.Instance).OwnerClientId); break; } } } else { timeSinceSeeingThreat += base.AIIntervalTime; } if (timeSinceSeeingThreat > 4f) { ((EnemyAI)this).SwitchToBehaviourState(1); ((EnemyAI)this).ChangeOwnershipOfEnemy(((NetworkBehaviour)StartOfRound.Instance).OwnerClientId); break; } if (attackingThreat != null) { bool flag3 = false; for (int j = 0; j < eggs.Count; j++) { if (eggs[j].screaming && Vector3.Distance(((Component)eggs[j]).transform.position, attackingThreat.GetThreatTransform().position) < 3f) { flag3 = true; break; } } if (flag || flag3 || (timeSinceSeeingThreat < 0.5f && attackingThreat != null)) { if ((int)attackingThreat.type == 0) { base.targetPlayer = ((Component)attackingThreat.GetThreatTransform()).GetComponent<PlayerControllerB>(); base.movingTowardsTargetPlayer = true; if (!targetPlayerIsInTruck) { base.addPlayerVelocityToDestination = 1f; } else { base.addPlayerVelocityToDestination = 0f; } base.agent.stoppingDistance = 0f; } else { ((EnemyAI)this).SetDestinationToPosition(attackingThreat.GetThreatTransform().position, false); } checkingLastSeenPosition = true; miscTimer = 0f; } else { watchingThreat = null; if (checkingLastSeenPosition && !flag2) { if (Vector3.Distance(((Component)this).transform.position, lastSeenPositionOfWatchedThreat) > 3f) { ((EnemyAI)this).SetDestinationToPosition(lastSeenPositionOfWatchedThreat, false); } else { checkingLastSeenPosition = false; } } else { KiwiBabyItem closestLostEgg = GetClosestLostEgg(foundEggs: false, null, checkPath: false, allEggs: true); if ((Object)(object)closestLostEgg != (Object)null) { miscTimer -= base.AIIntervalTime; if (miscTimer < 0f) { miscTimer = 1.5f; Vector3 val = GetRandomPositionAroundObject(((Component)closestLostEgg).transform.position, 8f, birdRandom); if (((GrabbableObject)closestLostEgg).isInShipRoom) { val = StartOfRound.Instance.shipStrictInnerRoomBounds.ClosestPoint(val); } ((EnemyAI)this).SetDestinationToPosition(val, false); } } } } } base.agent.stoppingDistance = 0f; break; } } } } private void SpawnExplosionAtDeadBodyAndSync() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) if (((NetworkBehaviour)this).IsOwner) { base.targetPlayer.deadBody.DeactivateBody(false); Object.Instantiate<GameObject>(playerExplodePrefab, ((Component)base.targetPlayer.deadBody).transform.position, ((Component)base.targetPlayer).transform.rotation, RoundManager.Instance.mapPropsContainer.transform); int deactivatePlayerBody = (int)base.targetPlayer.playerClientId; SpawnExplosionAtPlayerBodyServerRpc(((Component)base.targetPlayer.deadBody).transform.position, ((Component)base.targetPlayer).transform.rotation, (int)GameNetworkManager.Instance.localPlayerController.playerClientId, deactivatePlayerBody); } } [ServerRpc(RequireOwnership = false)] public void SpawnExplosionAtPlayerBodyServerRpc(Vector3 pos, Quaternion rot, int playerWhoSent, int deactivatePlayerBody) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) SpawnExplosionAtPlayerBodyClientRpc(pos, rot, playerWhoSent, deactivatePlayerBody); } [ClientRpc] public void SpawnExplosionAtPlayerBodyClientRpc(Vector3 pos, Quaternion rot, int playerWhoSent, int deactivatePlayerBody) { //IL_0034: 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) if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId != playerWhoSent) { base.targetPlayer.deadBody.DeactivateBody(false); Object.Instantiate<GameObject>(playerExplodePrefab, pos, rot, RoundManager.Instance.mapPropsContainer.transform); if ((Object)(object)StartOfRound.Instance.allPlayerScripts[deactivatePlayerBody].deadBody != (Object)null) { StartOfRound.Instance.allPlayerScripts[deactivatePlayerBody].deadBody.DeactivateBody(false); } } } [ServerRpc(RequireOwnership = false)] public void SyncWalkAnimSpeedServerRpc(float speed) { SyncWalkAnimSpeedClientRpc(speed); } [ClientRpc] public void SyncWalkAnimSpeedClientRpc(float speed) { if (!((NetworkBehaviour)this).IsOwner) { walkAnimSpeed = speed; } } private void StartAttackingAndSync() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_01fd: Unknown result type (might be due to invalid IL or missing references) if (watchingThreat == null) { Debug.LogError((object)"StartAttackingAndSync called with no watchingThreat currently set"); return; } if ((int)watchingThreat.type == 0) { base.targetPlayer = ((Component)watchingThreat.GetThreatTransform()).gameObject.GetComponent<PlayerControllerB>(); base.currentOwnershipOnThisClient = (int)base.targetPlayer.playerClientId; } else { base.targetPlayer = null; base.currentOwnershipOnThisClient = (int)StartOfRound.Instance.allPlayerScripts[0].playerClientId; } attackingThreat = watchingThreat; if (((NetworkBehaviour)this).IsServer) { if ((Object)(object)base.targetPlayer != (Object)null) { if (((Component)this).gameObject.GetComponent<NetworkObject>().OwnerClientId != base.targetPlayer.actualClientId) { base.thisNetworkObject.ChangeOwnership(base.targetPlayer.actualClientId); } } else if (((Component)this).gameObject.GetComponent<NetworkObject>().OwnerClientId != StartOfRound.Instance.allPlayerScripts[0].actualClientId) { base.thisNetworkObject.ChangeOwnership(StartOfRound.Instance.allPlayerScripts[0].actualClientId); } } Screech(); timeSpentChasingThreat = 0f; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); List<int> list = new List<int>(); for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { if (seenThreatsHoldingEgg.Contains(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform)) { list.Add((int)StartOfRound.Instance.allPlayerScripts[i].playerClientId); } } int abandonedThreatInt = -1; if ((Object)(object)abandonedThreat != (Object)null) { abandonedThreatInt = (int)abandonedThreat.playerClientId; } StartAttackingThreatServerRpc(NetworkObjectReference.op_Implicit(((Component)attackingThreat.GetThreatTransform()).gameObject.GetComponent<NetworkObject>()), (int)GameNetworkManager.Instance.localPlayerController.playerClientId, list.ToArray(), abandonedThreatInt); } private void AddPlayerIDsToSeenThreatsHoldingEggsList(int[] IDs) { for (int i = 0; i < IDs.Length; i++) { if (!seenThreatsHoldingEgg.Contains(((Component)StartOfRound.Instance.allPlayerScripts[IDs[i]]).transform)) { seenThreatsHoldingEgg.Add(((Component)StartOfRound.Instance.allPlayerScripts[IDs[i]]).transform); } } } [ServerRpc(RequireOwnership = false)] public void StartAttackingThreatServerRpc(NetworkObjectReference threatObjectRef, int playerWhoSent, int[] seenThreatsHoldingEggsPlayerIDs, int abandonedThreatInt) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_01d4: Unknown result type (might be due to invalid IL or missing references) NetworkObject val = default(NetworkObject); if (!((NetworkObjectReference)(ref threatObjectRef)).TryGet(ref val, (NetworkManager)null)) { Debug.LogError((object)$"Bird error: Unable to get network object out of synced net object ref for StartAttackingServerRpc; id: {((NetworkObjectReference)(ref threatObjectRef)).NetworkObjectId}"); return; } if (!((Component)val).gameObject.TryGetComponent<IVisibleThreat>(ref attackingThreat)) { Debug.LogError((object)("Bird error: Unable to get IVisibleThreat interface out of synced network object ref for StartAttackingServerRpc; object: '" + ((Object)((Component)val).gameObject).name + "'")); return; } ulong num; int value; if ((int)attackingThreat.type > 0) { num = ((NetworkBehaviour)StartOfRound.Instance).OwnerClientId; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(num, out value)) { Debug.LogError((object)$"Bird: Unable to get player value from clientplayerlist for client id: {num} which should be host."); } base.targetPlayer = null; } else { PlayerControllerB component = ((Component)attackingThreat.GetThreatTransform()).GetComponent<PlayerControllerB>(); num = component.actualClientId; base.targetPlayer = component; if (!StartOfRound.Instance.ClientPlayerList.TryGetValue(num, out value)) { Debug.LogError((object)$"Bird: Unable to get player value from clientplayerlist for client id: {num}"); base.targetPlayer = null; } } if (((Component)this).gameObject.GetComponent<NetworkObject>().OwnerClientId != num) { base.thisNetworkObject.ChangeOwnership(num); } base.currentOwnershipOnThisClient = value; if (playerWhoSent != (int)GameNetworkManager.Instance.localPlayerController.playerClientId) { Screech(); timeSpentChasingThreat = 0f; AddPlayerIDsToSeenThreatsHoldingEggsList(seenThreatsHoldingEggsPlayerIDs); if (abandonedThreatInt != -1) { abandonedThreat = StartOfRound.Instance.allPlayerScripts[abandonedThreatInt]; } } StartAttackingClientRpc(NetworkObjectReference.op_Implicit(((Component)attackingThreat.GetThreatTransform()).gameObject.GetComponent<NetworkObject>()), value, playerWhoSent, seenThreatsHoldingEggsPlayerIDs, abandonedThreatInt); } [ClientRpc] public void StartAttackingClientRpc(NetworkObjectReference threat, int playerVal, int playerWhoSent, int[] seenThreatsHoldingEggsPlayerIDs, int abandonedThreatInt) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 if ((int)GameNetworkManager.Instance.localPlayerController.playerClientId == playerWhoSent) { return; } NetworkObject val = default(NetworkObject); if (((NetworkObjectReference)(ref threat)).TryGet(ref val, (NetworkManager)null)) { IVisibleThreat val2 = default(IVisibleThreat); if (!((Component)val).gameObject.TryGetComponent<IVisibleThreat>(ref val2)) { Debug.LogError((object)("Bird Error: StartAttackingClientRpc - Could not get an IVisibleThreat interface from synced NetworkObject '" + ((Object)((Component)val).gameObject).name + "'")); } else { if ((int)val2.type == 0) { base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerVal]; } else { base.targetPlayer = null; } attackingThreat = val2; watchingThreat = val2; } } Screech(); timeSpentChasingThreat = 0f; if (abandonedThreatInt != -1) { abandonedThreat = StartOfRound.Instance.allPlayerScripts[abandonedThreatInt]; } base.currentOwnershipOnThisClient = playerVal; ((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2); AddPlayerIDsToSeenThreatsHoldingEggsList(seenThreatsHoldingEggsPlayerIDs); } public override void Update() { //IL_0152: 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_0172: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_10aa: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10b9: Unknown result type (might be due to invalid IL or missing references) //IL_10be: Unknown result type (might be due to invalid IL or missing references) //IL_10c3: Unknown result type (might be due to invalid IL or missing references) //IL_1030: Unknown result type (might be due to invalid IL or missing references) //IL_1035: Unknown result type (might be due to invalid IL or missing references) //IL_103f: Unknown result type (might be due to invalid IL or missing references) //IL_1044: Unknown result type (might be due to invalid IL or missing references) //IL_1049: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07fe: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_0857: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0ade: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0de8: Unknown result type (might be due to invalid IL or missing references) //IL_0df8: Unknown result type (might be due to invalid IL or missing references) //IL_0e27: Unknown result type (might be due to invalid IL or missing references) //IL_0e37: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Unknown result type (might be due to invalid IL or missing references) //IL_0e89: Invalid comparison between Unknown and I4 //IL_0f43: Unknown result type (might be due to invalid IL or missing references) //IL_0f48: Unknown result type (might be due to invalid IL or missing references) //IL_0f4d: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_0ec7: Unknown result type (might be due to invalid IL or missing references) //IL_0edf: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (watchingThreat != null) { watchingThreatTransform = watchingThreat.GetThreatTransform(); } else { watchingThreatTransform = null; } if (base.isEnemyDead) { base.creatureAnimator.SetLayerWeight(1, Mathf.Max(0f, base.creatureAnimator.GetLayerWeight(1) - Time.deltaTime * 5f)); } else { if (inKillAnimation) { return; } if ((Object)(object)birdNest == (Object)null) { if (((NetworkBehaviour)this).IsServer) { return; } EnemyAINestSpawnObject[] array = Object.FindObjectsByType<EnemyAINestSpawnObject>((FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i].enemyType == (Object)(object)base.enemyType) { birdNest = ((Component)array[i]).gameObject; birdNestAmbience = ((Component)array[i]).GetComponent<AudioSource>(); break; } } return; } base.creatureAnimator.SetBool("Stunned", base.stunNormalizedTimer > 0f); if (pryingOpenDoor && base.inSpecialAnimation) { ((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, shipDoor.outsideDoorPoint.position, 7f * Time.deltaTime); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, shipDoor.outsideDoorPoint.rotation, 7f * Time.deltaTime); pryingDoorAnimTime = Mathf.Min(pryingDoorAnimTime + Time.deltaTime / pryOpenDoorAnimLength, 1f); base.creatureAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime); shipDoor.shipDoorsAnimator.SetFloat("pryOpenDoor", pryingDoorAnimTime); base.creatureAnimator.SetLayerWeight(1, Mathf.Max(0f, base.creatureAnimator.GetLayerWeight(1) - Time.deltaTime * 5f)); if (pryingDoorAnimTime > 0.12f) { ((EnemyAI)this).EnableEnemyMesh(true, false); } BreakIntoShip(); return; } if (base.stunNormalizedTimer > 0f) { if (((NetworkBehaviour)this).IsOwner) { base.agent.speed = 0f; base.agent.acceleration = 5000f; } base.creatureAnimator.SetBool("Attacking