Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NajMonsters v0.2.0
plugins/NajMonsters.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NajMonsters")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0+7d8f0a8faca9c2c7fdbfe6f30651fb54acc106ef")] [assembly: AssemblyProduct("NajMonsters")] [assembly: AssemblyTitle("NajMonsters")] [assembly: AssemblyVersion("0.2.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace NajMonsters { [DefaultExecutionOrder(100)] internal sealed class MiniBusMonster : MonoBehaviour { private enum DriveState { Patrol, Investigate, ApproachCart, AlignCart, ReverseToCart, TowCart, LeaveCart, Aim, Charge, Braking, Recovering, Stunned, Carried, Landing, Dead } private sealed class WheelVisual { public readonly Vector3 Hub; public bool IsFront; private readonly Transform _wheel; private readonly Quaternion _rest; private readonly Vector3 _axle; private readonly float _radius; private readonly Vector3 _meshCentre; private readonly Vector3 _hubInParent; private float _spin; public WheelVisual(Transform wheel, Transform body, Vector3 axle, float radius) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001c: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0088: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_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) _wheel = wheel; _rest = wheel.localRotation; _axle = ((Vector3.Dot(wheel.TransformVector(axle), body.right) >= 0f) ? axle : (-axle)); _radius = radius; MeshFilter component = ((Component)wheel).GetComponent<MeshFilter>(); Mesh val = ((component != null) ? component.sharedMesh : null); Vector3 val2; if (!((Object)(object)val != (Object)null)) { val2 = Vector3.zero; } else { Bounds bounds = val.bounds; val2 = ((Bounds)(ref bounds)).center; } Vector3 val3 = val2; _meshCentre = Vector3.Scale(wheel.localScale, val3); _hubInParent = wheel.localPosition + _rest * _meshCentre; Hub = body.InverseTransformPoint(wheel.TransformPoint(val3)); } public void Pose(Transform body, float travel, float turnRadians, float steer) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00dd: 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_00e4: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_wheel == (Object)null)) { Transform parent = _wheel.parent; if (_radius > 0.001f) { float num = Mathf.Abs(travel) * 0.65f; float num2 = Mathf.Clamp((0f - turnRadians) * Hub.x, 0f - num, num); _spin = Mathf.Repeat(_spin + (travel + num2) / _radius * 57.29578f, 360f); } Quaternion val = Quaternion.identity; if (IsFront) { val = Quaternion.AngleAxis(steer * (1f + Mathf.Sign(Hub.x) * steer / 22f * 0.14f), parent.InverseTransformDirection(body.up)); } Quaternion val2 = val * _rest * Quaternion.AngleAxis(_spin, _axle); float y = (body.localPosition + body.localRotation * Hub).y; float num3 = Mathf.Clamp((Hub.y - y) * 0.65f, -0.07f, 0.07f); Vector3 val3 = parent.InverseTransformVector(body.parent.up * num3); _wheel.SetLocalPositionAndRotation(_hubInParent + val3 - val2 * _meshCentre, val2); } } } private struct CartApproach { public Vector3 Center; public Vector3 Stage; public NavMeshPath Path; } private const float SightRange = 10f; private const float AimTime = 1.2f; private const float AimLockTime = 0.35f; private const float WindupDistance = 0.5f; private const float WindupSpeed = 1.2f; private const float FlashTime = 0.57f; private const float GlareStartTime = 0.3f; private const RigidbodyConstraints DrivingConstraints = (RigidbodyConstraints)80; private const float ChargeSpeed = 8f; private const float ChargeAcceleration = 18f; private const float ChargeDistance = 12f; private const float ChargeBrakeDistance = 2.1f; private const float BrakeRecovery = 1.6f; private const int ChargeDamage = 20; private const float ChargeReach = 0.5f; private const float WallStunTime = 5f; private const float AttackCooldown = 3f; private const float CollisionSkin = 0.04f; private static readonly FieldRef<PlayerAvatar, bool> PlayerDisabled = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> PlayerTumbleBody = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly FieldRef<PhysGrabber, float> GrabStrengthOverride = AccessTools.FieldRefAccess<PhysGrabber, float>("overrideGrabStrength"); private static readonly FieldRef<PlayerAvatar, bool> PlayerTumbling = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isTumbling"); private static readonly FieldRef<PlayerAvatar, bool> PlayerDead = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet"); private static readonly int FloorMask = LayerMask.GetMask(new string[2] { "Default", "StaticGrabObject" }); private static readonly int WallMask = FloorMask | LayerMask.GetMask(new string[2] { "PhysGrabObjectHinge", "PlayerOnlyCollision" }); private static readonly int PlayerHitMask = LayerMask.GetMask(new string[3] { "Player", "PhysGrabObject", "PlayerOnlyCollision" }); private static readonly int LooseObjectMask = LayerMask.GetMask(new string[1] { "PhysGrabObject" }); private static readonly int CartLayer = LayerMask.GetMask(new string[1] { "PhysGrabObjectCart" }); private static readonly int CartQueryMask = CartLayer | LooseObjectMask; private static readonly int BodyCoverMask = LayerMask.GetMask(new string[5] { "Default", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "StaticGrabObject" }); private readonly RaycastHit[] _worldHits = (RaycastHit[])(object)new RaycastHit[24]; private readonly Collider[] _overlaps = (Collider[])(object)new Collider[48]; private DriveState _state; private Rigidbody _rigidbody; private PhysGrabObject _grab; private MiniBusEffects _effects; private PlayerAvatar _attackTarget; private Vector3 _chargeDirection; private Vector3 _headlightTarget; private Vector3 _lastDrivenPosition; private float _aimElapsed; private float _windupRemaining; private float _chargeSpeed; private float _chargeRemaining; private float _recoveryUntil; private float _stunnedUntil; private float _repairUntil; private float _nextAttack; private float _landingStarted; private float _grabPullTime; private float _nextPerception; private float _nextImpactStun; private readonly HashSet<PlayerAvatar> _chargeHits = new HashSet<PlayerAvatar>(); private bool _flashHitPlayer; private bool _knockedOver; private Vector3 _knockoverPush; private readonly Dictionary<PlayerTumble, float> _ownTumbleUntil = new Dictionary<PlayerTumble, float>(); private const int EngineMaxHealth = 120; private const float DeathEffectTime = 1.3f; private const float InvestigationRange = 14f; private const float InvestigationTravelTime = 9f; private const float InvestigationScanTime = 2.4f; private int _engineHealth = 120; private bool _deathStarted; private bool _deathDespawned; private bool _orbDropped; private LevelGenerator _deathGenerator; private float _investigateUntil; private float _scanStarted; private Quaternion _scanFacing; private Vector3 _investigateTarget; private float _nextNoise; private const float MoveFactDistance = 2f; private const float TrudgeMass = 3f; private const float TrudgeGrabForce = 21f; private const float TrudgeGrabTime = 0.5f; private const float MaxSteerDeg = 22f; private const float MaxRollDeg = 7f; private const float SteerResponse = 6f; private const float FrontAxleTolerance = 0.2f; private const float MaxWheelSpinDeg = 360f; private const float DoorProbeInterval = 0.1f; private const float DoorCastDistance = 0.85f; private const float DoorAngularSpeed = 4.5f; private static readonly int DoorQueryMask = LayerMask.GetMask(new string[3] { "Default", "StaticGrabObject", "PhysGrabObjectHinge" }); private ManualLogSource _log; private NavMeshAgent _agent; private Transform _body; private BoxCollider _bodyCollider; private WheelVisual[] _wheels; private int _frontWheelCount; private Vector3[] _patrolPoints; private Vector3 _spawnPosition; private Vector3 _lastPosition; private Vector3 _stuckAnchor; private float _stuckTimer; private float _repathCooldown; private float _travelled; private bool _moveLogged; private bool _navWarned; private bool _targetWarned; private bool _stallWarned; private bool _steerLogged; private float _idleTimer; private float _steer; private float _lastHeading; private string _levelName = "?"; private bool _networkReplica; private bool _networkCombatOnly; private bool _networkHost; private readonly HashSet<DirtFinderMapDoor> _pushedDoors = new HashSet<DirtFinderMapDoor>(); private readonly List<(Collider Body, Collider Panel)> _doorPassages = new List<(Collider, Collider)>(); private float _nextDoorProbe; private const float NetworkSnapshotTimeout = 0.75f; private byte _lastTxPhase = byte.MaxValue; private int _revEventCounter; private int _brakeEventCounter; private int _impactEventCounter; private Vector3 _impactEventPoint; private bool _impactEventHeavy; private bool _networkSmoke; private bool _remoteSnapshotValid; private float _remoteSnapshotAt; private int _remoteSequence = int.MinValue; private bool _remoteInitialized; private DriveState _remotePhase; private float _remoteAimElapsed; private Vector3 _remoteHeadlightTarget = Vector3.forward; private bool _remoteSmoke; private float _remoteRepairRemaining; private int _remoteRevSeen; private int _remoteBrakeSeen; private int _remoteImpactSeen; private Vector3 _remoteImpactPoint; private bool _remoteImpactHeavy; private bool _glareLogged; private bool _loggedHostDynamic; private bool _loggedReplicaKinematic; private float _nextSnapshotLog; private PhotonView _networkView; private const float PatrolSpeed = 2.2f; private const float CartSightRange = 10f; private const float CartRetryDelay = 10f; private const float CartRecoveryDelay = 45f; private const float CartDetachForce = 18f; private const float CartDetachTime = 0.35f; private const float CartDepartureTime = 9f; private static readonly FieldRef<PhysGrabObject, Vector3> CartPull = AccessTools.FieldRefAccess<PhysGrabObject, Vector3>("grabDisplacementCurrent"); private const float CartStuckTime = 4f; private const float ReverseSpeed = 1.15f; private const float CartTurnSpeed = 3.4f; private const float CartTurnAcceleration = 24f; private const float TowSpeed = 1.65f; private const float TowCatchUpSpeed = 0.35f; private const float TowPauseGap = 0.9f; private const float TowResumeGap = 0.65f; private const float TowGapLimit = 1.2f; private const float TowGapGrace = 0.15f; private const float LocalArrivalSettleMin = 0.5f; private const float LocalArrivalSettleTimeout = 2f; private const float MinTowRouteLength = 10f; private const float RelaxedRouteClearance = 0.85f; private const float HitchReach = 0.23f; private const float CartStageOffset = 0.95f; private const float ParkSpeed = 0.35f; private const float HiddenPreferredDistance = 50f; private static readonly int RoomMask = LayerMask.GetMask(new string[1] { "RoomVolume" }); private static readonly int TowRouteMask = LayerMask.GetMask(new string[3] { "Default", "StaticGrabObject", "PhysGrabObjectHinge" }); private static readonly float[] CartStageAngles = new float[8] { 0f, -38f, 38f, -75f, 75f, -120f, 120f, 180f }; private static readonly float[] CartStageDistances = new float[3] { 0.95f, 0.52f, 1.35f }; private static readonly float[] LocalTowDistances = new float[5] { 6f, 4.5f, 3.5f, 2.5f, 1.6f }; private static readonly float[] LocalTowAngles = new float[7] { 0f, -25f, 25f, -50f, 50f, -65f, 65f }; private readonly Dictionary<int, float> _cartRetryAfter = new Dictionary<int, float>(); private readonly List<Vector3> _failedCartStages = new List<Vector3>(); private PhysGrabCart _cart; private PhysGrabObject _cartGrab; private Collider[] _cartColliders; private Transform _cartHandle; private ConfigurableJoint _hitch; private Vector3 _cartStage; private Vector3 _cartApproachCenter; private Vector3 _cartAlignmentStart; private Vector3 _cartAlignmentHeading; private float _cartRotationDirection; private float _cartLastYaw; private float _cartLastTurnProgress; private bool _cartTriedOtherTurn; private Vector3 _cartProgressPosition; private Vector3 _cartTowStart; private float _nextCartScan; private float _cartLastProgress; private float _cartStageStarted; private float _nextReverseBeep; private float _cartDetachPullTime; private float _cartDepartureUntil; private float _cartNextReplan; private int _towReroutesLeft; private RoomVolume _towRoom; private bool _towLocalStage; private bool _towUsedLocalStage; private bool _towRouteRelaxed; private float _towRouteLength; private int _towRouteTurns; private float _towLocalArrivalAt; private float _towLocalArrivalGap; private bool _towTractionPaused; private float _towGapOverTime; private bool UsesPathHeading { get { if (_state != DriveState.Patrol && _state != DriveState.Investigate && _state != DriveState.ApproachCart && _state != DriveState.TowCart) { return _state == DriveState.LeaveCart; } return true; } } internal bool IsAiming => _state == DriveState.Aim; internal bool IsNetworkCombatOnly => _networkCombatOnly; internal bool IsNetworkHost => _networkHost; internal bool IsNetworkReplica => _networkReplica; internal bool IsDeathAnimating { get { if (_deathStarted) { return !_deathDespawned; } return false; } } private PhotonView NetworkView { get { if (!((Object)(object)_networkView != (Object)null)) { return _networkView = ((Component)this).GetComponent<PhotonView>(); } return _networkView; } } private bool IsCartTask { get { if (_state != DriveState.ApproachCart && _state != DriveState.AlignCart && _state != DriveState.ReverseToCart) { return _state == DriveState.TowCart; } return true; } } private bool UpdateBehavior() { //IL_0192: Unknown result type (might be due to invalid IL or missing references) if (_state == DriveState.Dead) { return false; } _effects.SetSmoke(_state == DriveState.Carried || _knockedOver || (Time.time < _stunnedUntil && Time.time >= _repairUntil) || _engineHealth <= 30); if (_state == DriveState.Carried || _state == DriveState.Landing) { return false; } if (!_rigidbody.isKinematic) { SetPhysicsDriven(dynamic: false); } if (_state == DriveState.Stunned) { if (Time.time >= _stunnedUntil) { _effects.SetSmoke(active: false); if (_networkHost) { _log.LogInfo((object)"[NajMonsters] MP FX host repair finished"); } ResumePatrol("stun expired"); } return false; } if (_state == DriveState.Aim) { UpdateAim(); return false; } if (_state == DriveState.Charge || _state == DriveState.Braking) { return false; } if (_state == DriveState.Recovering) { if (Time.time >= _recoveryUntil) { ResumePatrol("recovered after braking"); } return false; } if (_state == DriveState.LeaveCart) { UpdateCartDeparture(); return false; } if (IsCartTask) { UpdateCartTask(); return false; } if (!_agent.isOnNavMesh) { return true; } if (TryStartCartTask()) { _effects.SetHeadlights(0f); return false; } if (Time.time >= _nextPerception) { _nextPerception = Time.time + 0.1f; if (Time.time >= _nextAttack && TryFindVisibleTarget(out var target, out var point)) { StartAim(target, point); return false; } } if (_state == DriveState.Investigate) { UpdateInvestigation(); return false; } return true; } private bool UpdateNetworkCombat() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) UpdateHostNetworkVisuals(); if (_state == DriveState.Aim) { UpdateAim(); return false; } if (_state == DriveState.Charge || _state == DriveState.Braking) { return false; } if (_state == DriveState.Recovering) { if (Time.time >= _recoveryUntil) { ResumePatrol("recovered after braking"); } return false; } if (_state != DriveState.Patrol) { ResumePatrol("network combat: non-patrol state reset"); return true; } if (!_agent.isOnNavMesh) { return true; } if (Time.time >= _nextPerception) { _nextPerception = Time.time + 0.1f; if (Time.time >= _nextAttack && TryFindVisibleTarget(out var target, out var point)) { StartAim(target, point); return false; } } return true; } private bool TryFindVisibleTarget(out PlayerAvatar target, out Vector3 point) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) target = null; point = default(Vector3); if (!SemiFunc.IsMultiplayer()) { target = LocalPlayer(); return CanSeePlayer(target, out point); } if (!SemiFunc.IsMasterClient()) { return false; } List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return false; } float num = float.PositiveInfinity; for (int i = 0; i < list.Count; i++) { PlayerAvatar val = list[i]; if (IsActiveTarget(val) && CanSeePlayer(val, out var point2)) { Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; target = val; point = point2; } } } return (Object)(object)target != (Object)null; } private static bool IsActiveTarget(PlayerAvatar player) { if ((Object)(object)player != (Object)null && !PlayerDisabled.Invoke(player) && !PlayerDead.Invoke(player) && (Object)(object)player.PlayerVisionTarget != (Object)null) { return (Object)(object)player.PlayerVisionTarget.VisionTransform != (Object)null; } return false; } private static Vector3 NetworkPlayerPoint(PlayerAvatar player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_001a: Unknown result type (might be due to invalid IL or missing references) return ((Component)player).transform.position + Vector3.up * 0.5f; } private void FixedUpdate() { if ((Object)(object)_agent == (Object)null || _state == DriveState.Dead || _networkReplica || HostGenerationBlocked()) { return; } UpdateDoors(); if (UpdateGrab()) { return; } if (_state == DriveState.Landing) { UpdateLanding(); return; } CheckLooseObjectImpact(); if (_state == DriveState.Aim) { MoveWindup(); } if (_state == DriveState.Charge || _state == DriveState.Braking) { MoveCharge(); } if (_state == DriveState.AlignCart) { AlignCart(); } if (_state == DriveState.ReverseToCart) { MoveReverse(); } if (_state == DriveState.TowCart && !TryDetachCart()) { SteerTrailer(); } } private void OnDisable() { _deathDespawned = true; ReleaseCart(0f, allCollisions: true); RestoreDoorCollisions(all: true); _grabPullTime = 0f; _effects?.SetHeadlights(0f); _effects?.StopHeadlightGlare(); _effects?.SetSmoke(active: false); _effects?.StopEngine(); _effects?.StopDriveLoop(); } private void BeginCarry() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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) _knockoverPush = Vector3.zero; _lastDrivenPosition = ((Component)this).transform.position; ReleaseCart(0f, allCollisions: true); EndAttack(); SuspendNavigation(manualPosition: true); SetPhysicsDriven(dynamic: true); SetState(DriveState.Carried, "grabbed"); _effects.SetSmoke(active: true); } private void UpdateLanding() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_006a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00d5: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref _knockoverPush)).sqrMagnitude > 0f) { _rigidbody.WakeUp(); Rigidbody rigidbody = _rigidbody; rigidbody.position += Vector3.up * 0.1f; _rigidbody.linearVelocity = _knockoverPush * 1.75f + Vector3.up * 2.3f; _rigidbody.angularVelocity = Vector3.Cross(Vector3.up, _knockoverPush) * 5.5f; _knockoverPush = Vector3.zero; } float num = Time.time - _landingStarted; Vector3 position = _rigidbody.position; if (!(num < (_knockedOver ? 0.9f : 0.18f))) { NavMeshHit val = default(NavMeshHit); if (TryFloor(position, _knockedOver ? 0.95f : 0.2f, out var height) && (Mathf.Abs(_rigidbody.linearVelocity.y) < 0.5f || (_knockedOver && num > 2.5f)) && NavMesh.SamplePosition(new Vector3(position.x, height, position.z), ref val, 0.55f, -1)) { FinishLanding(((NavMeshHit)(ref val)).position); } else if (position.y < _lastDrivenPosition.y - 8f || num > (_knockedOver ? 3f : 6f)) { FinishLanding(_lastDrivenPosition); } } } private void FinishLanding(Vector3 position) { //IL_000d: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) SetPhysicsDriven(dynamic: false); _rigidbody.position = position; ((Component)this).transform.position = position; Quaternion rotation = Quaternion.Euler(0f, ((Component)this).transform.eulerAngles.y, 0f); _rigidbody.rotation = rotation; ((Component)this).transform.rotation = rotation; _knockedOver = false; _knockoverPush = Vector3.zero; if (!((Behaviour)_agent).enabled) { ((Behaviour)_agent).enabled = true; _agent.Warp(position); } if (Time.time < _stunnedUntil) { SetState(DriveState.Stunned, "landed while stunned"); } else { ResumePatrol("landed"); } } private void SetPhysicsDriven(bool dynamic) { //IL_0016: 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) if (!dynamic && !_rigidbody.isKinematic) { _rigidbody.linearVelocity = Vector3.zero; _rigidbody.angularVelocity = Vector3.zero; } _rigidbody.constraints = (RigidbodyConstraints)((!dynamic) ? 80 : 0); _rigidbody.isKinematic = !dynamic; _rigidbody.useGravity = dynamic; _rigidbody.collisionDetectionMode = (CollisionDetectionMode)(dynamic ? 2 : 3); _rigidbody.interpolation = (RigidbodyInterpolation)(dynamic ? 1 : 0); } internal void Stun(float duration, string reason, Vector3? impactSource = null) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!_networkReplica && ((Behaviour)this).isActiveAndEnabled && _state != DriveState.Dead && float.IsFinite(duration) && !(duration <= 0f)) { _stunnedUntil = Mathf.Max(_stunnedUntil, Time.time + duration); _nextAttack = Mathf.Max(_nextAttack, _stunnedUntil + 3f); bool num = _state == DriveState.Aim && impactSource.HasValue; ReleaseCart(0f, allCollisions: true); EndAttack(); if (num) { KnockOver(impactSource.Value, reason); } else if (_state != DriveState.Carried && _state != DriveState.Landing) { SuspendNavigation(_state == DriveState.Charge || _state == DriveState.Braking || _state == DriveState.ReverseToCart); SetState(DriveState.Stunned, reason); } _effects.SetSmoke(active: true); } } private void KnockOver(Vector3 source, string reason) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Flat(_rigidbody.worldCenterOfMass - source); Vector3 knockoverPush = ((Vector3)(ref val)).normalized; if (((Vector3)(ref knockoverPush)).sqrMagnitude < 0.01f) { knockoverPush = ((Component)this).transform.right; } SuspendNavigation(manualPosition: true); ((Behaviour)_agent).enabled = false; _lastDrivenPosition = ((Component)this).transform.position; _landingStarted = Time.time; _knockedOver = true; SetPhysicsDriven(dynamic: true); _knockoverPush = knockoverPush; SetState(DriveState.Landing, "knocked over: " + reason); } private void CheckLooseObjectImpact() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //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) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_004a: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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 (Time.time < _nextImpactStun) { return; } Vector3 val = ((Component)_bodyCollider).transform.TransformPoint(_bodyCollider.center); int num = Physics.OverlapBoxNonAlloc(val, _bodyCollider.size * 0.5f + Vector3.one * 0.08f, _overlaps, ((Component)this).transform.rotation, LooseObjectMask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Rigidbody attachedRigidbody = _overlaps[i].attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)null) && !((Object)(object)attachedRigidbody == (Object)(object)_rigidbody) && !attachedRigidbody.isKinematic && !(attachedRigidbody.mass < 0.5f) && !((Object)(object)((Component)attachedRigidbody).GetComponent<PlayerTumble>() != (Object)null) && !((Object)(object)((Component)attachedRigidbody).GetComponent<PhysGrabCart>() != (Object)null) && !((Object)(object)((Component)attachedRigidbody).GetComponent<PhysGrabObject>() == (Object)null)) { Vector3 val2 = ((Collider)_bodyCollider).ClosestPoint(attachedRigidbody.worldCenterOfMass) - attachedRigidbody.worldCenterOfMass; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { val2 = val - attachedRigidbody.worldCenterOfMass; } if (!(Vector3.Dot(attachedRigidbody.linearVelocity, ((Vector3)(ref val2)).normalized) < 4.5f)) { _nextImpactStun = Time.time + 0.6f; float mass = attachedRigidbody.mass; Vector3 linearVelocity = attachedRigidbody.linearVelocity; int damage = Mathf.Clamp(Mathf.RoundToInt(mass * ((Vector3)(ref linearVelocity)).magnitude), 4, 40); DamageEngine(damage, 2f, "thrown object", attachedRigidbody.worldCenterOfMass); break; } } } } private static PlayerAvatar LocalPlayer() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } private static bool IsGrabbed(PhysGrabObject grab) { if ((Object)(object)grab != (Object)null) { if (!grab.grabbedLocal) { return grab.playerGrabbing.Count != 0; } return true; } return false; } private bool UpdateGrab() { //IL_004c: 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) bool flag = false; float num = 0f; float num2 = 0f; foreach (PhysGrabber item in _grab.playerGrabbing) { float num3 = GrabCapacity(item); if (!(num3 <= 0f)) { num2 += num3; float num4 = EffectiveGrabStrength(item); float num5 = Vector3.Distance(item.physGrabPointPullerPosition, item.physGrabPoint.position); num += Mathf.Min(num5 * 10f, item.forceMax) * num4; } } flag = num2 >= 21f; if (_state == DriveState.Carried) { if (flag) { return true; } _landingStarted = Time.time; SetState(DriveState.Landing, "released"); return false; } _grabPullTime = ((_state == DriveState.Landing || num < 21f) ? 0f : (_grabPullTime + Time.fixedDeltaTime)); if (_grabPullTime < 0.5f) { return false; } _grabPullTime = 0f; BeginCarry(); return true; } private static float EffectiveGrabStrength(PhysGrabber grabber) { float num = GrabStrengthOverride.Invoke(grabber); if (!(num >= 0f)) { if (!PlayerTumbling.Invoke(grabber.playerAvatar)) { return grabber.grabStrength; } return 1f; } return num; } private static float GrabCapacity(PhysGrabber grabber) { if ((Object)(object)grabber == (Object)null || (Object)(object)grabber.playerAvatar == (Object)null || (Object)(object)grabber.physGrabPoint == (Object)null || grabber.physGrabForcesDisabledTimer > 0f || PlayerDisabled.Invoke(grabber.playerAvatar)) { return 0f; } return grabber.forceMax * EffectiveGrabStrength(grabber); } private bool CanSeePlayer(PlayerAvatar player, out Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) point = default(Vector3); if ((Object)(object)player == (Object)null || PlayerDisabled.Invoke(player) || PlayerDead.Invoke(player) || (Object)(object)player.PlayerVisionTarget == (Object)null || (Object)(object)player.PlayerVisionTarget.VisionTransform == (Object)null) { return false; } point = player.PlayerVisionTarget.VisionTransform.position; if (_effects.IsInBeam(point, 10f)) { return HasLineOfSight(_effects.SightOrigin, point, ((Component)player).transform, player); } return false; } private bool HasLineOfSight(Vector3 origin, Vector3 point, Transform target, PlayerAvatar player = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - origin; int num = Physics.RaycastNonAlloc(origin, ((Vector3)(ref val)).normalized, _worldHits, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()), (QueryTriggerInteraction)1); if (num == _worldHits.Length) { return false; } for (int i = 0; i < num; i++) { Collider collider = ((RaycastHit)(ref _worldHits[i])).collider; if (!((Object)(object)collider.attachedRigidbody == (Object)(object)_rigidbody) && !((Component)collider).transform.IsChildOf(target) && ((Object)(object)player == (Object)null || (Object)(object)PlayerForCollider(collider) != (Object)(object)player)) { return false; } } return true; } private void StartAim(PlayerAvatar player, Vector3 point) { //IL_0049: 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_0054: Unknown result type (might be due to invalid IL or missing references) ReleaseCart(0f, allCollisions: true); SuspendNavigation(manualPosition: true); _attackTarget = player; _aimElapsed = 0f; _windupRemaining = 0.5f; _flashHitPlayer = false; _chargeHits.Clear(); _chargeDirection = ((Component)this).transform.forward; AimAt(point); _effects.SetHeadlights(0.3f); NetworkRev(); SetState(DriveState.Aim, "player sighted"); } private void UpdateAim() { //IL_0041: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (_aimElapsed < 0.85f) { if (!CanSeePlayer(_attackTarget, out var point)) { EndAttack(); _nextAttack = Time.time + 0.75f; ResumePatrol("player broke line of sight"); return; } AimAt(point); } _aimElapsed += Time.deltaTime; _effects.SetHeadlights(Mathf.Lerp(0.3f, 1f, _aimElapsed / 0.57f)); if (!_flashHitPlayer && _aimElapsed >= 0.57f && CanSeePlayer(_attackTarget, out var _)) { _flashHitPlayer = true; TumblePlayer(_attackTarget, _chargeDirection * 2f + Vector3.up * 0.4f, 0.36f); _log.LogInfo((object)"[NajMonsters] FLASH player staggered"); } if (!(_aimElapsed < 1.2f)) { _effects.StopHeadlightGlare(); _agent.updatePosition = false; _chargeSpeed = 0f; _chargeRemaining = 12f; _chargeHits.Clear(); SetState(DriveState.Charge, "aim complete"); } } private void MoveWindup() { //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_0026: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!(_windupRemaining <= 0f) && !(_aimElapsed >= 0.57f)) { Vector3 val = -_chargeDirection; float num = Mathf.Min(_windupRemaining, 1.2f * Time.fixedDeltaTime); RaycastHit blocker; float num2 = ClearDistance(((Component)this).transform.position, val, num, out blocker); if (num2 <= 0.001f || !HasDrivingSurface(((Component)this).transform.position + val * num2, val, out var grounded)) { _windupRemaining = 0f; return; } _rigidbody.MovePosition(grounded); _windupRemaining = ((num2 < num) ? 0f : (_windupRemaining - num2)); } } private void AimAt(Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) _headlightTarget = point; Vector3 val = Flat(point - ((Component)this).transform.position); if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Quaternion val2 = Quaternion.LookRotation(val); Quaternion rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val2, 320f * Time.deltaTime); if (_networkReplica) { ((Component)this).transform.rotation = rotation; } else { TurnWithoutClippingCart(rotation); } _chargeDirection = ((Component)this).transform.forward; } } private void UpdateAttackLighting() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (_state != DriveState.Aim) { return; } _effects.AimHeadlight(_headlightTarget); if ((!_networkCombatOnly || !((Object)(object)_attackTarget != (Object)(object)LocalPlayer())) && !(_aimElapsed < 0.3f) && !((Object)(object)_attackTarget == (Object)null) && !PlayerDisabled.Invoke(_attackTarget)) { Camera val = (((Object)(object)CameraUtils.Instance != (Object)null) ? CameraUtils.Instance.MainCamera : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)PostProcessing.Instance == (Object)null) && !((Object)(object)RenderTextureMain.instance == (Object)null) && _effects.IsInBeam(((Component)val).transform.position, 10f)) { _effects.UpdateHeadlightGlare(HasLineOfSight(_effects.SightOrigin, ((Component)val).transform.position, ((Component)_attackTarget).transform, _attackTarget)); } } } private void MoveCharge() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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) if (_chargeRemaining <= 2.1f && _state == DriveState.Charge) { SetState(DriveState.Braking, "charge distance limit"); NetworkBrakes(); } float num = ((_state == DriveState.Braking) ? Mathf.Sqrt(36f * Mathf.Max(_chargeRemaining, 0f)) : 8f); _chargeSpeed = Mathf.MoveTowards(_chargeSpeed, num, 18f * Time.fixedDeltaTime); float num2 = Mathf.Min(_chargeRemaining, _chargeSpeed * Time.fixedDeltaTime); RaycastHit blocker; float num3 = ClearDistance(((Component)this).transform.position, _chargeDirection, num2, out blocker); bool flag = num3 < num2; Vector3 grounded = ((Component)this).transform.position + _chargeDirection * num3; if (!flag && !HasDrivingSurface(grounded, _chargeDirection, out grounded)) { if (_state == DriveState.Charge) { NetworkBrakes(); } RecoverFromCharge("braked at floor edge"); return; } HitPlayerAlongCharge(num3); if (flag) { ((Component)this).transform.position = grounded; Collider collider = ((RaycastHit)(ref blocker)).collider; Vector3 val = ((((RaycastHit)(ref blocker)).distance > 0.001f) ? ((RaycastHit)(ref blocker)).point : (grounded + _chargeDirection * (_bodyCollider.size.z * 0.5f) + Vector3.up * _bodyCollider.center.y)); if (_networkReplica) { RecoverFromCharge("replica charge ignored"); return; } if ((Object)(object)CartBody(collider) != (Object)null) { PushCart(collider, _chargeDirection, 2.5f, 0.65f); NetworkImpact(val, heavy: false); RecoverFromCharge("charge stopped by C.A.R.T."); return; } NetworkImpact(val, heavy: true); _repairUntil = Time.time + 5f; if (_networkHost) { _log.LogInfo((object)("[NajMonsters] MP FX host wall repair=" + 5f.ToString("F1") + " point=" + MiniBusTemplate.Fmt(val))); } Stun(5f, "wall impact: " + ((Object)collider).name); } else { _rigidbody.MovePosition(grounded); _chargeRemaining -= num3; if (_chargeRemaining <= 0.01f) { RecoverFromCharge("reached charge distance limit"); } } } private void RecoverFromCharge(string reason) { EndAttack(); _recoveryUntil = Time.time + 1.6f; _nextAttack = _recoveryUntil + 3f; SetState(DriveState.Recovering, reason); } private void HitPlayerAlongCharge(float step) { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer()) { if (_chargeHits.Count > 0) { return; } PlayerAvatar val = LocalPlayer(); if ((Object)(object)val == (Object)null || PlayerDisabled.Invoke(val)) { return; } Vector3 val2 = _bodyCollider.size * 0.5f; Vector3 val3 = ((Component)this).transform.TransformPoint(_bodyCollider.center); Vector3 val4 = val3 + _chargeDirection * (val2.z + step); Vector3 center = val3 + _chargeDirection * (step * 0.5f); val2.z += step * 0.5f; if (!PlayerOverlapsCharge(val, center, val2)) { val2.z = 0.25f; if (!PlayerOverlapsCharge(val, val4 + _chargeDirection * val2.z, val2) || !ChargeReachClear(val, val4)) { return; } } _chargeHits.Add(val); val.playerHealth.Hurt(20, true, -1, false); TumblePlayer(val, _chargeDirection * 16f + Vector3.up * 3f, 1f); _log.LogInfo((object)$"[NajMonsters] HIT player damage={20}"); } else { if (!SemiFunc.IsMasterClient()) { return; } Vector3 val5 = _bodyCollider.size * 0.5f; Vector3 val6 = ((Component)this).transform.TransformPoint(_bodyCollider.center); Vector3 val7 = val6 + _chargeDirection * (val5.z + step); Vector3 center2 = val6 + _chargeDirection * (step * 0.5f); val5.z += step * 0.5f; Vector3 val8 = _bodyCollider.size * 0.5f; val8.z = 0.25f; List<PlayerAvatar> list = SemiFunc.PlayerGetList(); if (list == null) { return; } for (int i = 0; i < list.Count; i++) { PlayerAvatar val9 = list[i]; if (!IsActiveTarget(val9) || _chargeHits.Contains(val9)) { continue; } bool flag = PlayerOverlapsCharge(val9, center2, val5); if (!flag && !PlayerOverlapsCharge(val9, val7 + _chargeDirection * val8.z, val8)) { continue; } Vector3 point = NetworkPlayerPoint(val9); if (flag) { if (!HasBodyCover(val9)) { continue; } } else if (!HasLineOfSight(val7, point, ((Component)val9).transform, val9)) { continue; } _chargeHits.Add(val9); ApplyNetworkChargeHit(val9, point); } } } private void ApplyNetworkChargeHit(PlayerAvatar player, Vector3 point) { //IL_003a: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)player.photonView != (Object)null && player.photonView.IsMine; if (flag) { player.playerHealth.Hurt(20, true, -1, false); } else { player.playerHealth.HurtOther(20, point, true, -1, false); } TumblePlayer(player, _chargeDirection * 16f + Vector3.up * 3f, 1f); _log.LogInfo((object)("[NajMonsters] MP HIT player view=" + (((Object)(object)player.photonView != (Object)null) ? player.photonView.ViewID : 0) + " damage=" + 20 + " local=" + flag + " point=" + MiniBusTemplate.Fmt(point))); } private bool PlayerOverlapsCharge(PlayerAvatar player, Vector3 center, Vector3 half) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) int num = Physics.OverlapBoxNonAlloc(center, half, _overlaps, ((Component)this).transform.rotation, PlayerHitMask, (QueryTriggerInteraction)2); for (int i = 0; i < num; i++) { if ((Object)(object)PlayerForCollider(_overlaps[i]) == (Object)(object)player) { return true; } } return false; } private bool ChargeReachClear(PlayerAvatar player, Vector3 nose) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0046: Unknown result type (might be due to invalid IL or missing references) nose += Vector3.up * 0.24f - _chargeDirection * 0.04f; Vector3 position = ((Component)player).transform.position; position.y = nose.y; return !Physics.Linecast(nose, position, WallMask, (QueryTriggerInteraction)1); } private bool HasBodyCover(PlayerAvatar player) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_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_001e: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.TransformPoint(_bodyCollider.center); Vector3 val2 = NetworkPlayerPoint(player) - val; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 0.001f) { return true; } int num = Physics.RaycastNonAlloc(val, val2 / magnitude, _worldHits, magnitude, BodyCoverMask, (QueryTriggerInteraction)1); if (num == _worldHits.Length) { return false; } for (int i = 0; i < num; i++) { Collider collider = ((RaycastHit)(ref _worldHits[i])).collider; if (!((Object)(object)collider.attachedRigidbody == (Object)(object)_rigidbody) && !((Object)(object)PlayerForCollider(collider) != (Object)null)) { return false; } } return true; } private void TumblePlayer(PlayerAvatar player, Vector3 force, float duration) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) PlayerTumble val = PlayerTumbleBody.Invoke(player); if (!((Object)(object)val == (Object)null) && !PlayerDisabled.Invoke(player)) { _ownTumbleUntil[val] = Time.time + 1.5f; val.TumbleRequest(true, false); val.TumbleStunTime(duration); val.TumbleForce(force); } } internal bool IsOwnTumbleImpact(HurtCollider source) { if ((Object)(object)source == (Object)null) { return false; } List<PlayerTumble> list = null; bool result = false; foreach (KeyValuePair<PlayerTumble, float> item in _ownTumbleUntil) { PlayerTumble key = item.Key; if ((Object)(object)key == (Object)null || Time.time >= item.Value) { (list ?? (list = new List<PlayerTumble>())).Add(key); } else if ((Object)(object)source == (Object)(object)key.hurtCollider || ((Component)source).transform.IsChildOf(((Component)key).transform)) { result = true; } } if (list != null) { for (int i = 0; i < list.Count; i++) { _ownTumbleUntil.Remove(list[i]); } } return result; } private static PlayerAvatar PlayerForCollider(Collider collider) { PlayerTumble val = default(PlayerTumble); if (((Component)collider).TryGetComponent<PlayerTumble>(ref val)) { return val.playerAvatar; } val = ((Component)collider).GetComponentInParent<PlayerTumble>(); if ((Object)(object)val != (Object)null) { return val.playerAvatar; } PlayerAvatar componentInParent = ((Component)collider).GetComponentInParent<PlayerAvatar>(); if ((Object)(object)componentInParent != (Object)null) { return componentInParent; } PlayerController componentInParent2 = ((Component)collider).GetComponentInParent<PlayerController>(); if (!((Object)(object)componentInParent2 != (Object)null)) { return null; } return componentInParent2.playerAvatarScript; } private void CheckNavigationCartContact() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) if (!UsesPathHeading || !_agent.isOnNavMesh || !_agent.updatePosition) { return; } Vector3 position = ((Component)this).transform.position; Vector3 val = Flat(position - _lastPosition); float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.0001f || magnitude >= 1.5f) { return; } Vector3 direction = val / magnitude; RaycastHit blocker; float num = ClearDistance(_lastPosition, direction, magnitude, out blocker, cartsOnly: true); if (!(num >= magnitude)) { Vector3 val2 = Vector3.Lerp(_lastPosition, position, num / magnitude); _agent.nextPosition = val2; ((Component)this).transform.position = val2; if (_state != DriveState.ApproachCart || (Object)(object)CartBody(((RaycastHit)(ref blocker)).collider) != (Object)(object)_cart) { PushCart(((RaycastHit)(ref blocker)).collider, direction, 1.15f); } } } private bool TurnWithoutClippingCart(Quaternion rotation) { //IL_0006: 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_0015: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) Vector3 val = _bodyCollider.size * 0.5f; int num = Physics.OverlapBoxNonAlloc(((Component)this).transform.position + rotation * _bodyCollider.center, val, _overlaps, rotation, CartQueryMask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Collider other = _overlaps[i]; if (!((Object)(object)CartBody(other) == (Object)null) && CartPenetration(rotation, other, out var depth)) { CartPenetration(((Component)this).transform.rotation, other, out var depth2); if (depth > depth2 + 0.002f) { return false; } } } ((Component)this).transform.rotation = rotation; return true; } private bool CartPenetration(Quaternion rotation, Collider other, out float depth) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_0024: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); return Physics.ComputePenetration((Collider)(object)_bodyCollider, ((Component)this).transform.position, rotation, other, ((Component)other).transform.position, ((Component)other).transform.rotation, ref val, ref depth); } private static PhysGrabCart CartBody(Collider other) { PhysGrabCart result = default(PhysGrabCart); if (!((Object)(object)other.attachedRigidbody != (Object)null) || !((Component)other.attachedRigidbody).TryGetComponent<PhysGrabCart>(ref result)) { return null; } return result; } private void PushCart(Collider other, Vector3 direction, float speed, float lift = 0f) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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) PhysGrabCart val = CartBody(other); PhysGrabObject val2 = default(PhysGrabObject); if (!((Object)(object)val == (Object)null) && (!((Object)(object)_hitch != (Object)null) || !((Object)(object)val == (Object)(object)_cart)) && ((Component)val).TryGetComponent<PhysGrabObject>(ref val2) && CartAvailable(val, val2)) { float num = Mathf.Clamp(speed - Vector3.Dot(val2.rb.linearVelocity, direction), 0f, speed); val2.EnemyInteractTimeSet(); val2.rb.AddForce(direction * num + Vector3.up * lift, (ForceMode)2); } } private float ClearDistance(Vector3 position, Vector3 direction, float distance, out RaycastHit blocker, bool cartsOnly = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) blocker = default(RaycastHit); Vector3 val = _bodyCollider.size * 0.5f; val.x = Mathf.Max(0.1f, val.x - 0.04f); val.y = Mathf.Max(0.1f, val.y - 0.14f); Vector3 val2 = position + ((Component)this).transform.rotation * _bodyCollider.center; int num = (cartsOnly ? CartQueryMask : (WallMask | CartQueryMask)); int num2 = Physics.BoxCastNonAlloc(val2, val, direction, _worldHits, ((Component)this).transform.rotation, distance + 0.04f, num, (QueryTriggerInteraction)1); float num3 = distance; float num4 = default(float); for (int i = 0; i < num2; i++) { RaycastHit val3 = _worldHits[i]; if ((Object)(object)((RaycastHit)(ref val3)).collider.attachedRigidbody == (Object)(object)_rigidbody || (!cartsOnly && (Object)(object)RoomDoor(((RaycastHit)(ref val3)).collider) != (Object)null) || ((cartsOnly || (WallMask & (1 << ((Component)((RaycastHit)(ref val3)).collider).gameObject.layer)) == 0) && (Object)(object)CartBody(((RaycastHit)(ref val3)).collider) == (Object)null)) { continue; } Vector3 normal = ((RaycastHit)(ref val3)).normal; if ((!(((RaycastHit)(ref val3)).distance < 0.001f) || Physics.ComputePenetration((Collider)(object)_bodyCollider, position, ((Component)this).transform.rotation, ((RaycastHit)(ref val3)).collider, ((Component)((RaycastHit)(ref val3)).collider).transform.position, ((Component)((RaycastHit)(ref val3)).collider).transform.rotation, ref normal, ref num4)) && !(Mathf.Abs(normal.y) > 0.55f) && !(Vector3.Dot(normal, direction) > -0.12f)) { float num5 = Mathf.Max(0f, ((RaycastHit)(ref val3)).distance - 0.04f); if (!(num5 >= num3)) { num3 = num5; blocker = val3; } } } return num3; } private bool HasDrivingSurface(Vector3 next, Vector3 direction, out Vector3 grounded) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) grounded = next; if (!TryFloor(next + direction * (_bodyCollider.size.z * 0.5f), 0.65f, out var _) || !TryFloor(next, 0.65f, out var height2)) { return false; } grounded.y = height2; return true; } private static bool TryFloor(Vector3 position, float maxDrop, out float height) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); bool flag = Physics.Raycast(position + Vector3.up * 0.32f, Vector3.down, ref val, maxDrop + 0.32f, FloorMask, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val)).normal.y > 0.55f; height = (flag ? ((RaycastHit)(ref val)).point.y : position.y); return flag; } private void EndAttack() { _attackTarget = null; _effects.SetHeadlights(0f); if (_state == DriveState.Aim || _state == DriveState.Charge || _state == DriveState.Braking) { _effects.StopEngine(); } } private void SuspendNavigation(bool manualPosition) { if (_agent.isOnNavMesh) { _agent.ResetPath(); _agent.isStopped = true; } if (manualPosition) { _agent.updatePosition = false; } } private void ResumePatrol(string reason) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) if (!_agent.updatePosition) { NavMeshHit val = default(NavMeshHit); if ((NavMesh.SamplePosition(((Component)this).transform.position, ref val, 0.65f, -1) && Mathf.Abs(((Component)this).transform.position.y - ((NavMeshHit)(ref val)).position.y) <= 0.65f) || NavMesh.SamplePosition(_spawnPosition, ref val, 2f, -1)) { _agent.Warp(((NavMeshHit)(ref val)).position); } _agent.updatePosition = true; } _effects.SetHeadlights(0f); _agent.speed = 2.2f; _stuckTimer = 0f; _stuckAnchor = ((Component)this).transform.position; SetState(DriveState.Patrol, reason); if (_agent.isOnNavMesh) { _agent.isStopped = false; PickTarget(); } } private void SetState(DriveState state, string reason) { if (_state != state) { _log.LogInfo((object)$"[NajMonsters] STATE {_state} -> {state} ({reason})"); _state = state; } } private static Vector3 Flat(Vector3 vector) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) vector.y = 0f; return vector; } internal void DamageEngine(int damage, float stun, string reason, Vector3 source, bool lethal = false) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (_networkReplica || HostGenerationBlocked() || _deathStarted || !((Behaviour)this).isActiveAndEnabled || _state == DriveState.Dead) { return; } if (damage > 0 || lethal) { bool flag = _state == DriveState.Recovering || _state == DriveState.Stunned || (Time.time < _stunnedUntil && (_state == DriveState.Landing || _state == DriveState.Carried)); int num = (lethal ? _engineHealth : (flag ? damage : Mathf.Max(1, damage / 2))); _engineHealth = Mathf.Max(0, _engineHealth - num); _log.LogInfo((object)$"[NajMonsters] engine hit damage={num} hp={_engineHealth} ({reason})"); if (_engineHealth == 0) { DestroyEngine(); return; } } if (stun > 0f) { Stun(stun, reason, source); } } private void DestroyEngine() { //IL_0159: Unknown result type (might be due to invalid IL or missing references) if (_networkReplica || _deathStarted) { return; } _deathStarted = true; _deathGenerator = LevelGenerator.Instance; if (_networkHost && SemiFunc.IsMultiplayer()) { MiniBusMultiplayer.Current?.SuppressForLevel(_deathGenerator); } ReleaseCart(45f, allCollisions: true); RestoreDoorCollisions(all: true); if ((Object)(object)_grab != (Object)null) { if (SemiFunc.IsMultiplayer()) { int num = (((Object)(object)NetworkView != (Object)null) ? NetworkView.ViewID : 0); List<PhysGrabber> list = new List<PhysGrabber>(_grab.playerGrabbing); if (num != 0) { foreach (PhysGrabber item in list) { if ((Object)(object)item != (Object)null) { item.OverrideGrabRelease(num, 0.5f); } } } _grab.OverrideGrabDisable(1.8f); } else { _grab.dead = true; } } EndAttack(); SuspendNavigation(manualPosition: true); SetPhysicsDriven(dynamic: false); ((Collider)_bodyCollider).enabled = false; _repairUntil = Time.time + 1.3f + 0.35f; _effects.SetSmoke(active: true); _effects.StopDriveLoop(); NetworkImpact(_rigidbody.worldCenterOfMass, heavy: true, engineDestroyed: true); SetState(DriveState.Dead, "engine destroyed"); _log.LogInfo((object)("[NajMonsters] death view=" + (((Object)(object)NetworkView != (Object)null) ? NetworkView.ViewID : 0) + " level=" + (((Object)(object)_deathGenerator != (Object)null && (Object)(object)_deathGenerator.Level != (Object)null) ? ((Object)_deathGenerator.Level).name : "?") + " host=" + _networkHost + " mode=" + (SemiFunc.IsMultiplayer() ? "MP" : "SP"))); SpawnDeathOrb(); if (!SemiFunc.IsMultiplayer()) { Object.Destroy((Object)(object)((Component)this).gameObject, 1.3f); } else { ((MonoBehaviour)this).StartCoroutine(DeathDespawn()); } } private IEnumerator DeathDespawn() { yield return (object)new WaitForSeconds(1.3f); if (!Object.op_Implicit((Object)(object)this) || !((Behaviour)this).isActiveAndEnabled || _deathDespawned) { yield break; } _deathDespawned = true; if (SemiFunc.IsMultiplayer()) { if (!SemiFunc.IsMasterClient() || !PhotonNetwork.InRoom) { _log.LogWarning((object)"[NajMonsters] MP death destruction skipped: no master/room; the Photon room cleanup owns the object"); yield break; } if (!((Object)(object)_deathGenerator != (Object)null) || !((Object)(object)LevelGenerator.Instance != (Object)(object)_deathGenerator)) { int num = (((Object)(object)NetworkView != (Object)null) ? NetworkView.ViewID : 0); _log.LogInfo((object)("[NajMonsters] MP death destroy via PhotonNetwork.Destroy view=" + num)); try { PhotonNetwork.Destroy(((Component)this).gameObject); yield break; } catch (Exception ex) { _log.LogWarning((object)("[NajMonsters] MP death destroy threw " + ex.GetType().Name + ": " + ex.Message + "; the room cleanup remains authoritative")); yield break; } } _log.LogInfo((object)"[NajMonsters] MP death destruction skipped: level changed during death animation"); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void SpawnDeathOrb() { //IL_0069: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) if (_orbDropped) { return; } _orbDropped = true; if (!_networkHost && SemiFunc.IsMultiplayer()) { _log.LogWarning((object)"[NajMonsters] MP orb spawn skipped on a replica"); return; } AssetManager instance = AssetManager.instance; GameObject val = (((Object)(object)instance != (Object)null) ? instance.enemyValuableMedium : null); if ((Object)(object)val == (Object)null) { _log.LogWarning((object)"[NajMonsters] orb spawn skipped: AssetManager.enemyValuableMedium is unavailable"); return; } Vector3 val2 = ((Component)this).transform.position + Vector3.up * 0.65f; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(((Component)this).transform.position, ref val3, 1.6f, -1) || NavMesh.SamplePosition(_lastDrivenPosition, ref val3, 1.6f, -1) || NavMesh.SamplePosition(_spawnPosition, ref val3, 1.6f, -1)) { val2 = ((NavMeshHit)(ref val3)).position + Vector3.up * 0.65f; } else if (!SemiFunc.IsMultiplayer()) { _log.LogWarning((object)"[NajMonsters] orb spawn skipped in SP: no NavMesh fallback"); return; } if (SemiFunc.IsMultiplayer()) { if (!SemiFunc.IsMasterClient() || !PhotonNetwork.InRoom) { _log.LogWarning((object)"[NajMonsters] MP orb spawn skipped: no master/room"); return; } string text = "Valuables/" + ((Object)val).name; GameObject val4 = null; try { val4 = PhotonNetwork.InstantiateRoomObject(text, val2, Quaternion.identity, (byte)0, (object[])null); } catch (Exception ex) { _log.LogWarning((object)("[NajMonsters] MP orb spawn threw " + ex.GetType().Name + ": " + ex.Message + " id=" + text)); return; } if ((Object)(object)val4 == (Object)null) { _log.LogWarning((object)("[NajMonsters] MP orb spawn failed id=" + text)); return; } PhotonView component = val4.GetComponent<PhotonView>(); _log.LogInfo((object)("[NajMonsters] MP death orb id=" + text + " view=" + (((Object)(object)component != (Object)null) ? component.ViewID : 0) + " pos=" + MiniBusTemplate.Fmt(val2))); } else { Object.Instantiate<GameObject>(val, val2, Quaternion.identity); _log.LogInfo((object)("[NajMonsters] dropped medium soul orb pos=" + MiniBusTemplate.Fmt(val2))); } } internal void InvestigateNoise(Vector3 position, float radius) { //IL_0065: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00cf: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if (_networkReplica || HostGenerationBlocked() || !((Behaviour)this).isActiveAndEnabled || (Object)(object)_agent == (Object)null || !_agent.isOnNavMesh || (_state != DriveState.Patrol && _state != DriveState.Investigate) || Time.time < _nextNoise) { return; } float num = Mathf.Min(radius * 1.4f, 14f); float num2 = Vector3.Distance(position, ((Component)this).transform.position); if (radius < 3f || num2 < 1.6f || num2 > num) { return; } if (_state == DriveState.Investigate) { Vector3 val = position - _investigateTarget; if (((Vector3)(ref val)).sqrMagnitude < 4f) { return; } } NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val2, 2f, -1)) { NavMeshPath val3 = new NavMeshPath(); if (_agent.CalculatePath(((NavMeshHit)(ref val2)).position, val3) && (int)val3.status == 0 && !(PathLength(val3.corners) > num * 1.7f) && _agent.SetPath(val3)) { _agent.isStopped = false; _agent.speed = 2.2f; _investigateTarget = position; _investigateUntil = Time.time + 9f; _scanStarted = 0f; _nextNoise = Time.time + 0.8f; _effects.SetHeadlights(0.38f); SetState(DriveState.Investigate, "heard a loud noise"); } } } private void UpdateInvestigation() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (_scanStarted == 0f) { if (Time.time >= _investigateUntil) { ResumePatrol("noise search timed out"); return; } if (_agent.pathPending || (_agent.hasPath && _agent.remainingDistance > 0.7f)) { return; } _agent.isStopped = true; _scanStarted = Time.time; _scanFacing = ((Component)this).transform.rotation; } float num = Time.time - _scanStarted; if (num >= 2.4f) { ResumePatrol("finished scanning the noise"); return; } float num2 = Mathf.Sin(num * MathF.PI * 2f / 2.4f) * 48f; TurnWithoutClippingCart(_scanFacing * Quaternion.Euler(0f, num2, 0f)); } public static MiniBusMonster Spawn(MiniBusTemplate template, ManualLogSource log, (Vector3 Position, Quaternion Rotation)? selectedPose) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0331: 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_0358: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) if (template == null || (Object)(object)template.Visual == (Object)null) { return null; } List<Vector3> list = CollectPatrolPoints(); if (list.Count == 0) { log.LogWarning((object)"[NajMonsters] SPAWN ABORTED: LevelGenerator.LevelPathPoints is empty. Nothing spawned."); return null; } Vector3 val = (selectedPose.HasValue ? selectedPose.Value.Position : Vector3.zero); bool flag = selectedPose.HasValue; NavMeshHit val2 = default(NavMeshHit); for (int i = 0; i < list.Count; i++) { if (flag) { break; } if (NavMesh.SamplePosition(list[i], ref val2, 2f, -1)) { val = ((NavMeshHit)(ref val2)).position; flag = true; } } if (!flag) { log.LogWarning((object)("[NajMonsters] SPAWN ABORTED: none of " + list.Count + " path point(s) has navmesh within 2 m. Nothing spawned.")); return null; } GameObject val3 = new GameObject("NajMonsters.MiniBus"); val3.SetActive(false); val3.transform.SetPositionAndRotation(val, selectedPose?.Rotation ?? Quaternion.identity); NavMeshAgent val4 = val3.AddComponent<NavMeshAgent>(); val4.radius = 0.55f; val4.height = 1.6f; val4.speed = 2.2f; val4.acceleration = 12f; val4.angularSpeed = 0f; val4.stoppingDistance = 0.4f; val4.autoBraking = true; val4.autoRepath = true; val4.updateRotation = false; Transform transform = new GameObject("Body").transform; transform.SetParent(val3.transform, false); Transform val5 = Object.Instantiate<Transform>(template.Visual, transform, false); if ((Object)(object)val5 == (Object)null) { log.LogWarning((object)"[NajMonsters] SPAWN ABORTED: could not instantiate the captured visual template. Nothing spawned."); Object.Destroy((Object)(object)val3); return null; } ((Component)val5).gameObject.SetActive(true); ClearHideFlags(((Component)val5).gameObject); Vector3 finalSize = template.FinalSize; float num = Mathf.Max(0.6f, finalSize.y); BoxCollider val6 = val3.AddComponent<BoxCollider>(); val6.size = new Vector3(Mathf.Max(0.6f, finalSize.x), num, Mathf.Max(0.6f, finalSize.z)); val6.center = new Vector3(0f, num * 0.5f, 0f); Rigidbody val7 = val3.AddComponent<Rigidbody>(); val7.isKinematic = true; val7.useGravity = false; val7.interpolation = (RigidbodyInterpolation)0; val7.collisionDetectionMode = (CollisionDetectionMode)3; val7.mass = 3f; val7.constraints = (RigidbodyConstraints)80; int num2 = 0; num2 |= LayerBit("PhysGrabObject"); num2 |= LayerBit("PhysGrabObjectHinge"); if (num2 != 0) { ((Collider)val6).excludeLayers = LayerMask.op_Implicit(num2); } ((Collider)val6).includeLayers = LayerMask.op_Implicit(CartLayer); ((Collider)val6).layerOverridePriority = 1; val3.layer = LayerMask.NameToLayer("PhysGrabObject"); val3.tag = "Phys Grab Object"; val3.AddComponent<PhotonView>(); val3.AddComponent<PhotonTransformView>(); val3.AddComponent<PhysGrabObjectCollider>(); PhysGrabObject val8 = val3.AddComponent<PhysGrabObject>(); val8.massOriginal = 3f; PhysGrabObjectImpactDetector obj = val3.AddComponent<PhysGrabObjectImpactDetector>(); obj.destroyDisable = true; obj.playerHurtDisable = true; obj.particleDisable = true; obj.canHurtLogic = false; ((Behaviour)obj).enabled = false; MiniBusMonster miniBusMonster = val3.AddComponent<MiniBusMonster>(); val3.SetActive(true); if (!val4.Warp(val)) { log.LogWarning((object)("[NajMonsters] SPAWN: NavMeshAgent.Warp returned false at " + MiniBusTemplate.Fmt(val) + "; movement may stall.")); } miniBusMonster.