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 Jelly v1.0.0
JellyMod.dll
Decompiled 10 hours 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib; using REPOLib.Modules; using REPOLib.Objects.Sdk; using Unity.Collections; using Unity.Jobs; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JellyMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("JellyMod")] [assembly: AssemblyTitle("JellyMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 JellyMod { [RequireComponent(typeof(PhotonView))] public class JellyController : MonoBehaviour { public enum Variant { Jelly, Jammy, MiniJammy } internal enum CartPhase { None, Calm, Warn, Flee } public enum State { Spawn, Idle, Roam, Investigate, Stun, Leave, Chase, Pounce } private class Passenger { public PlayerAvatar player; public float damageTimer; public float overrideTimer; public float escape; public float pukeTime; public float snagTimer; } private enum ItemSize { None, Tiny, Small, Medium, Big, Head } private class HeldItem { public PhysGrabObject item; public int cost; public int slot; public float radius; public float snagTimer; public float phase; public Vector3 lastTarget; public bool hasLastTarget; public PlayerDeathHead head; } [Header("Variant")] [Tooltip("Set by JellyVariants on the runtime Jammy / Mini-Jammy prefabs. The bundle's prefab is Jelly.")] public Variant variant; [Tooltip("Tint of the hazy outer layer (JellyMeld).")] public Color hazeColor = new Color(0.43f, 0.7f, 0.4f); [Tooltip("Jammy: how many Mini-Jammys it splits into. Config [Jammy] SplitCount overrides.")] public int splitCount = 2; [Tooltip("Jammy: how far from the centre the Mini-Jammys appear (metres).")] public float splitSpread = 0.7f; [Tooltip("Mini-Jammy: after popping out of a split it ignores players (no chasing) and can't absorb anything for this long (seconds).")] public float spawnGrace = 3f; private bool _hasSplitSpawn; private Vector3 _splitSpawnPos; private Vector3 _splitPopDir; private bool _pendingPop; private float _graceUntil; private bool _everSpawned; private const int CartCalmMin = 10; private const int CartCalmMax = 30; private const float CartWarnSeconds = 3f; private const float CartFleeMax = 4f; private const float CartLeapDistance = 9f; private const float CartAbandonRadius = 10f; private const float CartAbandonSeconds = 8f; private CartPhase _cartPhase; private PhysGrabCart _cartIn; private PhysGrabCart _cartRemembered; private float _cartTimerLeft; private float _cartWarnLeft; private float _cartFleeTime; private float _cartUnseenTime; private float _cartCheckTimer; private float _cartBumpTimer; private float _cartAloneTime; private static readonly List<PhysGrabCart> Carts = new List<PhysGrabCart>(); private static float _cartsRefreshAt; [Header("Movement (design: patrols slowly but persistently)")] [Tooltip("NavMesh speed while roaming.")] public float roamSpeed = 1.5f; public float roamAcceleration = 4f; [Tooltip("NavMesh speed while walking to a noise.")] public float investigateSpeed = 2.5f; public float investigateAcceleration = 6f; [Tooltip("NavMesh speed while leaving the area.")] public float leaveSpeed = 3f; public float leaveAcceleration = 8f; [Tooltip("NavMesh speed while chasing a player it can see.")] public float chaseSpeed = 2.6f; public float chaseAcceleration = 6f; [Tooltip("Speed multiplier when fully squeezed through a gap (design: squeezing slows it).")] public float squeezedSpeedFactor = 0.45f; [Header("Timing")] public float idleTimeMin = 2f; public float idleTimeMax = 5f; [Tooltip("Give up on a roam/investigate target after being stuck this long.")] public float stuckGiveUpTime = 5f; [Tooltip("After finishing an investigation, ignore noises for this long.")] public float visionCooldown = 4f; [Tooltip("Stop chasing after not seeing the target for this long, then go to where it was last seen.")] public float chaseLoseTime = 6f; [Header("Pounce")] [Tooltip("Pounce when the target is closer than this (metres, horizontal) and in clear view.")] public float pounceRange = 4f; [Tooltip("Don't pounce if the target is more than this far above or below.")] public float pounceMaxHeightDifference = 1.5f; [Tooltip("How long the leap takes to reach the target (seconds).")] public float pounceFlightTime = 0.55f; [Tooltip("Extra height added to the top of the arc (metres).")] public float pounceArcHeight = 0.6f; [Tooltip("Total time in the Pounce state before going back to chasing.")] public float pounceDuration = 1.4f; [Tooltip("Wait this long after a pounce before pouncing again.")] public float pounceCooldown = 2f; private float _pounceWindupLeft; private bool _pounceLaunched; [Header("Absorb (design: 2 live players, 2 dmg/s, released on death)")] [Tooltip("A player this close to Jelly's centre during a pounce gets absorbed.")] public float absorbRadius = 1.8f; public int maxAbsorbedPlayers = 2; public int damagePerTick = 2; public float damageInterval = 1f; [Tooltip("How hard the absorbed player is pulled to the centre of the cube.")] public float holdForce = 12f; [Tooltip("Where inside the cube players float, relative to the body's centre (metres up).")] public float holdHeightOffset; [Tooltip("Push given to released players when Jelly dies.")] public float releaseForce = 6f; [Header("Escape (mash Jump, or teammates grab Jelly)")] [Tooltip("Escape meter needed to get out.")] public float escapeRequired = 100f; [Tooltip("Meter added per Jump press, times the trapped player's grab strength (1 + 0.2 per strength upgrade).")] public float escapePerMash = 2.6f; [Tooltip("Meter added per second for each teammate grabbing Jelly, times their grab strength.")] public float escapePerGrabberPerSecond = 15f; [Tooltip("Meter lost per second, so slow mashing doesn't work.")] public float escapeDecayPerSecond = 3f; [Tooltip("After escaping, Jelly can't re-absorb that player for this long.")] public float escapeImmunityTime = 8f; [Header("Stuck hop (stairs, ledges)")] [Tooltip("Hop when the body is stuck behind where the pathfinding wants it (stairs, steps, clutter).")] public bool stuckHopEnabled = true; [Tooltip("How long it has to be stuck before hopping (seconds).")] public float stuckHopDelay = 0.35f; [Tooltip("Upward speed of the hop (m/s); more when the path goes up.")] public float stuckHopUp = 4.5f; [Tooltip("Forward speed of the hop (m/s).")] public float stuckHopForward = 2.5f; public float stuckHopCooldown = 0.7f; [Header("Ooze through")] [Tooltip("When Jelly's body is snagged (a bench, a prop, a door frame, a step) while it wants to move, it oozes along its path through the obstacle instead of grinding against it. Replaces the stuck hop.")] public bool oozeEnabled = true; [Tooltip("How long it has to be snagged before oozing (seconds).")] public float oozeDelay = 0.4f; [Tooltip("Ooze speed as a fraction of the current state's speed.")] public float oozeSpeedFactor = 0.85f; [Tooltip("Ooze at least this long before checking whether the body is clear (seconds).")] public float oozeMinTime = 0.35f; [Tooltip("Normally stop oozing after this long (seconds); keeps going up to twice this while still inside something.")] public float oozeMaxTime = 3f; public float oozeCooldown = 0.5f; [Header("Protecting players inside")] [Tooltip("Players inside are invisible to other monsters and only take damage from this Jelly.")] public bool shieldPassengers = true; [Tooltip("Damage per second Jelly takes while a Spewer attached to a player inside is puking (acid from the inside).")] public float spewerAcidDamagePerSecond = 10f; [Tooltip("A full Spewer acid stream inside Jelly kills it when the stream ends.")] public bool spewerStreamKills = true; [Tooltip("A stream at least this long (seconds) counts as full.")] public float spewerKillMinStream = 1f; private const float SpewerCheckInterval = 0.1f; [Header("Gelatinous body")] [Tooltip("Only explosions inside it, the extraction point and pits can hurt Jelly. Untick to make it killable by anything (testing).")] public bool damageImmunity = true; [Tooltip("An explosion counts as inside if its centre is within the visible cube, shrunk by this much (metres) so a blast just touching the outside doesn't count.")] public float explosionInsideMargin = 0.15f; [Tooltip("An explosion inside the body (a swallowed grenade or mine) kills Jelly outright.")] public bool explosionInsideKills = true; [NonSerialized] public bool logStateChanges; public State currentState; private Enemy _enemy; private PhotonView _photonView; private float _stateTimer; private bool _stateImpulse = true; private Vector3 _agentDestination; private float _visionCooldownTimer; private PlayerAvatar _target; private float _targetLastSeenTime; private Vector3 _targetLastSeenPosition; private float _destinationRefreshTimer; private float _losTimer; private bool _losClear; private float _pounceCooldownTimer; private readonly Dictionary<int, float> _absorbImmunityUntil = new Dictionary<int, float>(); private bool _localWasInside; private float _localMashCooldown; private bool _localShowHint; private readonly List<Passenger> _passengers = new List<Passenger>(); private readonly List<int> _absorbedViewIds = new List<int>(); private Collider[] _bodyColliders; internal static readonly Dictionary<int, JellyController> Holding = new Dictionary<int, JellyController>(); private readonly HashSet<string> _hiddenFromVision = new HashSet<string>(); private Vector3 _lastGoodPos; private bool _hasGoodPos; private float _voidCheckTimer; private float _recoverCooldown; private bool _oozing; private float _oozeTimer; private float _oozeCooldownTimer; private float _oozeSpeed; private float _oozeGroundOffset; private float _oozeCheckTimer; private bool _oozeHadGravity; private readonly List<Collider> _oozeColliders = new List<Collider>(); private int _oozeMask = -1; private readonly Collider[] _oozeHits = (Collider[])(object)new Collider[16]; private Vector3 _pendingItemDestination; private bool _hasPendingItemDestination; private bool _seekingItem; private float _stuckTimer; private float _stuckHopCooldownTimer; private float _spewerCheckTimer; private JellyAnimationController _anim; private float _grabLogTimer; private float _lastBlockedEffect; private const float SplitProtectSeconds = 1.5f; private float _lastAllowedHitTime = -100f; private bool _lastHitExtraction; private bool _lastHitPit; private float _splitProtectUntil; private float _wedgeTimer; private float _wedgeCheckTimer; private const float WedgeOffFloor = 0.6f; private const float WedgeSeconds = 4f; private const float FloorCheckInterval = 0.2f; private const float FloorSinkTolerance = 0.04f; private float _floorCheckTimer; private int _floorSunkChecks; private readonly RaycastHit[] _floorHits = (RaycastHit[])(object)new RaycastHit[8]; private readonly List<Collider> _floorColliders = new List<Collider>(); private static int _floorMask = -1; private float _heldVisionTimer; private PlayerAvatar _heldVisionPlayer; private int _heldVisionCount; [Header("Items (point system)")] [Tooltip("Jelly absorbs loose items it moves over.")] public bool itemAbsorbEnabled = true; [Tooltip("Total points Jelly can hold. Items and players each cost points.")] public int capacityPoints = 16; public int tinyPoints = 1; public int smallPoints = 2; public int mediumPoints = 4; public int bigPoints = 8; [Tooltip("Points each absorbed player takes up.")] public int playerPoints = 4; [Tooltip("Points a dead player's head (Semibot head) takes up. Friends have to get it out to revive them.")] public int headPoints = 2; [Tooltip("Most things (players + items) it can hold at once, whatever their points. 0 = no limit (Jelly, Jammy). Mini-Jammy = 1: one tiny item, one small item or one player.")] public int maxContents; [Tooltip("Once it holds maxContents things it goes inert: patrols only, never chases, pounces, knocks or investigates. Mini-Jammy only. Lit explosives are still swallowed.")] public bool inertWhenFull; [Tooltip("A lit grenade or armed mine is always swallowed, even when full, and costs nothing.")] public bool alwaysAcceptLitExplosives = true; [Tooltip("How often the host checks for items inside the body (seconds).")] public float itemCheckInterval = 0.05f; [Tooltip("An item counts as inside if its centre is within the visible cube, shrunk by this much (metres).")] public float itemInsideMargin = 0.1f; [Tooltip("How hard held items are pulled to their spot inside the cube.")] public float itemHoldForce = 22f; [Tooltip("How far held items bob up and down while floating (metres).")] public float itemBob = 0.06f; [Tooltip("A held item stuck this far from its spot (snagged on a door frame during an ooze) is moved back inside (metres).")] public float itemSnagDistance = 0.8f; [Tooltip("Push given to items when they fall out of a dead Jelly (m/s).")] public float itemReleaseForce = 3f; [Tooltip("Items that fall out of a dead Jelly can't break for this long (seconds). Grabbing one ends it early.")] public float itemDropProtectMax = 6f; [Header("Full Jelly")] [Tooltip("When Jelly has no room for a player, touching one knocks them away instead (m/s). No damage.")] public float fullKnockForce = 7f; [Tooltip("Safety limit: the same player can't be knocked twice within this long (seconds). After a knock Jelly also ignores that player for escapeImmunityTime, the same as after an escape.")] public float fullKnockCooldown = 5f; [Header("Item seeking (design: prefers areas with more items)")] [Tooltip("Loot patrol: roam toward and around areas with lots of valuables (v0.4.8, see JellyPatrol).")] public bool roamTowardItems = true; [Tooltip("Unused since v0.4.8 (the loot patrol scores the whole level). Kept so the prefab still loads cleanly.")] public int roamCandidates = 8; [Tooltip("Valuables within this distance of a level point count toward its score (metres).")] public float roamItemRadius = 8f; [Tooltip("While idle or roaming, head straight for a loose item it fits that is this close (metres).")] public float itemSeekRange = 6f; public float itemSeekInterval = 0.5f; private const int SlotCount = 16; private readonly List<HeldItem> _heldItems = new List<HeldItem>(); internal static readonly Dictionary<PhysGrabObject, JellyController> HeldItemOwners = new Dictionary<PhysGrabObject, JellyController>(); internal static readonly HashSet<Rigidbody> HeldBodies = new HashSet<Rigidbody>(); private static readonly Dictionary<int, ItemSize> SizeCache = new Dictionary<int, ItemSize>(); private float _itemCheckTimer; private float _itemSeekTimer; private readonly Collider[] _itemHits = (Collider[])(object)new Collider[48]; private readonly HashSet<PhysGrabObject> _itemSeen = new HashSet<PhysGrabObject>(); private int _physGrabMask = -1; private PhysGrabObject _seekTarget; private readonly Dictionary<PhysGrabObject, float> _seekIgnoreUntil = new Dictionary<PhysGrabObject, float>(); private const int SlotsPerLayer = 4; private const float ItemBoxShrink = 0.85f; private readonly Dictionary<PlayerAvatar, float> _knockReadyAt = new Dictionary<PlayerAvatar, float>(); private bool _miniWeightApplied; private const float DeathGraceSeconds = 2f; private readonly HashSet<long> _ignoredPairs = new HashSet<long>(); private readonly Dictionary<long, KeyValuePair<Collider, Collider>> _ignoredPairColliders = new Dictionary<long, KeyValuePair<Collider, Collider>>(); private readonly HashSet<long> _wantedPairs = new HashSet<long>(); private float _pairCheckTimer; [Header("Loot patrol")] [Tooltip("How often the host rescores the whole level for loot (seconds).")] public float lootScanInterval = 3f; [Tooltip("Once at a loot zone, patrol around it this long before picking the next (seconds). Config [Patrol] ZoneStay overrides.")] public float lootZoneStay = 40f; [Tooltip("While at a zone, roam to level points within this distance of it (metres).")] public float lootZoneRadius = 12f; [Tooltip("Counts as arrived at the zone within this distance (metres).")] public float lootZoneArriveDistance = 6f; [Tooltip("A zone visited this recently is much less likely to be picked again (seconds).")] public float lootZoneMemory = 90f; [Tooltip("Give up on reaching a zone after this many roams that didn't get there.")] public int lootZoneMaxTries = 3; [Tooltip("Leave a zone early once its loot score falls below this.")] public float lootZoneMinScore = 0.5f; [Tooltip("Distance falloff when choosing a zone: score is divided by (1 + distance / this) (metres).")] public float lootZoneDistanceFalloff = 35f; [Tooltip("Items Jelly takes from an area before its loot cooldown. Config [Patrol] ItemsPerZone overrides.")] public int lootItemsPerZone = 1; [Tooltip("After taking its share, Jelly ignores loose loot and wanders away for this long (seconds). Config [Patrol] ItemCooldown overrides.")] public float lootCooldown = 45f; private readonly Dictionary<LevelPoint, float> _lootScores = new Dictionary<LevelPoint, float>(); private readonly Dictionary<LevelPoint, float> _lootVisitedAt = new Dictionary<LevelPoint, float>(); private readonly List<LevelPoint> _lootPointBuffer = new List<LevelPoint>(); private float _lootScanTimer; private LevelPoint _lootZone; private bool _lootZoneArrived; private float _lootZoneLeaveTime; private int _lootZoneTries; private float _lootZoneBestDistance = float.MaxValue; private int _lootTakenHere; private float _lootCooldownUntil; private Vector3 _lootTakenAt; private bool _pounceGrabLogged; [Header("Sticky extraction pad")] [Tooltip("Speed multiplier while Jelly is on a switched-on extraction pad. Config [Extraction] StickySpeed overrides.")] public float stickyPadSpeed = 0.1f; private bool _onStickyPad; private float _stickyCheckTimer; internal string Name { get { if (!((Object)(object)_enemy != (Object)null) || !((Object)(object)_enemy.EnemyParent != (Object)null) || string.IsNullOrEmpty(_enemy.EnemyParent.enemyName)) { return "Jelly"; } return _enemy.EnemyParent.enemyName; } } internal bool IsMini => variant == Variant.MiniJammy; private bool InSpawnGrace => _graceUntil > Time.time; internal CartPhase CurrentCartPhase => _cartPhase; internal float CartWarnProgress { get { if (_cartPhase != CartPhase.Warn) { return 0f; } return Mathf.Clamp01(1f - _cartWarnLeft / 3f); } } private static float CartEscapeSpeed { get { if (Plugin.MiniCartEscapeSpeed == null) { return 1.8f; } return Mathf.Clamp(Plugin.MiniCartEscapeSpeed.Value, 0.5f, 4f); } } private bool CartEscaping { get { if (_cartPhase != CartPhase.Warn) { return _cartPhase == CartPhase.Flee; } return true; } } internal static float PounceWindup => JellyHostSync.PounceWindup; internal bool Oozing => _oozing; public int AbsorbedCount => _absorbedViewIds.Count; internal int EnemyIndex => SemiFunc.EnemyGetIndex(_enemy); private float SpeedMultiplier { get { ConfigEntry<float> val = ((variant == Variant.MiniJammy) ? Plugin.SpeedMiniJammy : ((variant == Variant.Jammy) ? Plugin.SpeedJammy : Plugin.SpeedJelly)); if (val == null) { return 1f; } return Mathf.Clamp(val.Value, 0.1f, 3f); } } private int DamagePerTick { get { ConfigEntry<int> val = ((variant == Variant.MiniJammy) ? Plugin.DamageMiniJammy : ((variant == Variant.Jammy) ? Plugin.DamageJammy : Plugin.DamageJelly)); if (val == null) { return damagePerTick; } return Mathf.Clamp(val.Value, 0, 100); } } private bool BeingGrabbed { get { if ((Object)(object)_enemy != (Object)null && (Object)(object)_enemy.Rigidbody != (Object)null && (Object)(object)_enemy.Rigidbody.physGrabObject != (Object)null) { return _enemy.Rigidbody.physGrabObject.playerGrabbing.Count > 0; } return false; } } private bool RecentHit => Time.time - _lastAllowedHitTime < 1f; private bool KilledByExtraction { get { if (RecentHit) { return _lastHitExtraction; } return false; } } private bool KilledByPit { get { if (RecentHit) { return _lastHitPit; } return false; } } internal bool SplitProtected { get { if (IsMini) { return Time.time < _splitProtectUntil; } return false; } } public int HeldItemCount => _heldItems.Count; private int PointsUsed { get { int num = AbsorbedCount * playerPoints; foreach (HeldItem heldItem in _heldItems) { num += heldItem.cost; } return num; } } private int PointsFree => capacityPoints - PointsUsed; private bool ContentsFull { get { if (maxContents > 0) { return AbsorbedCount + _heldItems.Count >= maxContents; } return false; } } private bool ItemSlotsFull { get { if (PointsFree >= Mathf.Min(tinyPoints, smallPoints)) { return ContentsFull; } return true; } } private bool CanTakePlayer { get { if (AbsorbedCount < maxAbsorbedPlayers && PointsFree >= playerPoints) { return !ContentsFull; } return false; } } private bool CanHunt { get { if (AbsorbedCount < maxAbsorbedPlayers && !Inert) { return _cartPhase == CartPhase.None; } return false; } } private bool Inert { get { if (inertWhenFull) { return ContentsFull; } return false; } } private static bool HeadsEnabled { get { if (Plugin.AbsorbHeads != null) { return Plugin.AbsorbHeads.Value; } return true; } } private int LootItemsPerZone { get { if (Plugin.PatrolItemsPerZone == null) { return Mathf.Max(1, lootItemsPerZone); } return Mathf.Max(1, Plugin.PatrolItemsPerZone.Value); } } private float LootCooldown { get { if (Plugin.PatrolItemCooldown == null) { return lootCooldown; } return Mathf.Max(0f, Plugin.PatrolItemCooldown.Value); } } private bool LootOnCooldown => Time.time < _lootCooldownUntil; private float LootPull { get { if (Plugin.PatrolLootPull == null) { return 1f; } return Mathf.Max(0f, Plugin.PatrolLootPull.Value); } } private float LootZoneStay { get { if (Plugin.PatrolZoneStay == null) { return lootZoneStay; } return Mathf.Max(0f, Plugin.PatrolZoneStay.Value); } } private static float PadInnerFraction { get { if (Plugin.ExtractionStickyArea == null) { return 0.6f; } return Mathf.Clamp(Plugin.ExtractionStickyArea.Value, 0.1f, 1f); } } private float StickySpeed { get { if (Plugin.ExtractionStickySpeed == null) { return 0.1f; } return Mathf.Clamp01(Plugin.ExtractionStickySpeed.Value); } } private float PadStickFactor { get { if (!_onStickyPad) { return 1f; } return StickySpeed; } } private void SplitOnDeath() { //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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: 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_00c1: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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_0115: Unknown result type (might be due to invalid IL or missing references) if (variant != Variant.Jammy || !JellyVariants.MiniReady) { return; } int num = ((Plugin.JammySplitCount != null) ? Plugin.JammySplitCount.Value : splitCount); num = Mathf.Clamp(num, 0, 6); if (num != 0) { Vector3 val = SplitCentre(); Vector3 val2 = Vector3.ProjectOnPlane(((Component)_enemy.Rigidbody).transform.right, Vector3.up); if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.right; } ((Vector3)(ref val2)).Normalize(); ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"Jammy splits into {num} Mini-Jammys at {val}."); } NavMeshHit val5 = default(NavMeshHit); for (int i = 0; i < num; i++) { Vector3 val3 = Quaternion.Euler(0f, 360f * (float)i / (float)num, 0f) * val2; Vector3 val4 = val + val3 * splitSpread; val4 = ((!NavMesh.SamplePosition(val4, ref val5, 1.5f, -1) || !(Mathf.Abs(((NavMeshHit)(ref val5)).position.y - val.y) < 1f)) ? val : ((NavMeshHit)(ref val5)).position); JellySplitter.SpawnMini(val4, val3); } } } private Vector3 SplitCentre() { //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_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) //IL_002e: 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_0050: 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) Vector3 position = ((Component)_enemy.Rigidbody).transform.position; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, 2f, -1) && position.y - ((NavMeshHit)(ref val)).position.y > -0.5f) { return ((NavMeshHit)(ref val)).position; } if (!_hasGoodPos) { return position; } return _lastGoodPos; } internal void PrepareSplitSpawn(Vector3 position, Vector3 popDirection) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _hasSplitSpawn = true; _splitSpawnPos = position; _splitPopDir = popDirection; StartSplitProtection(); } private bool SplitSpawnHere() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) _everSpawned = true; if (!_hasSplitSpawn) { return false; } _hasSplitSpawn = false; _enemy.EnemyTeleported(_splitSpawnPos); _enemy.EnemyParent.firstSpawnPointUsed = true; _graceUntil = Time.time + spawnGrace; StartSplitProtection(); _pendingPop = true; return true; } private void SplitPop() { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (_pendingPop && !((Object)(object)_enemy.Rigidbody == (Object)null) && !((Object)(object)_enemy.Rigidbody.rb == (Object)null)) { _pendingPop = false; _enemy.NavMeshAgent.Disable(0.6f); _enemy.Rigidbody.DisableFollowPosition(0.6f, 10f); if (_enemy.HasJump) { _enemy.Jump.JumpingSet(true, (Type)2); } _enemy.Rigidbody.rb.linearVelocity = _splitPopDir * 2f + Vector3.up * 3.5f; if ((Object)(object)_anim != (Object)null) { _anim.Jiggle(); } } } private void MiniDisabled() { if (IsMini && _everSpawned && SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)_enemy == (Object)null) && !((Object)(object)_enemy.EnemyParent == (Object)null)) { _everSpawned = false; JellySplitter.RemoveLater(_enemy.EnemyParent); } } private bool CartTick() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) if (!IsMini || (Object)(object)_enemy.Rigidbody == (Object)null || (Object)(object)_enemy.Rigidbody.rb == (Object)null || (Object)(object)_enemy.Health == (Object)null || _enemy.Health.healthCurrent <= 0 || currentState == State.Spawn) { if (_cartPhase != CartPhase.None) { SetCartPhase(CartPhase.None); } return false; } float deltaTime = Time.deltaTime; if (_cartPhase == CartPhase.Flee) { return FleeTick(deltaTime); } _cartCheckTimer -= deltaTime; if (_cartCheckTimer <= 0f) { _cartCheckTimer = 0.25f; _cartIn = FindCartContaining(_enemy.Rigidbody.rb.worldCenterOfMass); } if ((Object)(object)_cartIn == (Object)null) { if (_cartPhase != CartPhase.None) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"{Name} is out of the cart ({_cartTimerLeft:0} s left on its calm timer)."); } SetCartPhase(CartPhase.None); } return false; } if (_cartPhase == CartPhase.None) { if ((Object)(object)_cartIn != (Object)(object)_cartRemembered) { _cartRemembered = _cartIn; _cartTimerLeft = Random.Range(10, 31); ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)$"{Name} settled in a cart: calm for {_cartTimerLeft:0} s."); } } else { ManualLogSource log3 = Plugin.Log; if (log3 != null) { log3.LogDebug((object)$"{Name} is back in the same cart: {_cartTimerLeft:0} s of calm left."); } } SetCartPhase(CartPhase.Calm); UpdateState(State.Idle); _target = null; } HoldStillInCart(); NearestPlayer(_enemy.Rigidbody.rb.position, out var distance); _cartAloneTime = ((distance > 10f) ? (_cartAloneTime + deltaTime) : 0f); if (_cartAloneTime >= 8f) { ManualLogSource log4 = Plugin.Log; if (log4 != null) { log4.LogDebug((object)$"{Name} was left alone in the cart for {8f:0} s: escaping now."); } _cartRemembered = null; StartCartEscape(); return true; } if (_cartPhase == CartPhase.Calm) { if (_cartTimerLeft > 0f) { _cartTimerLeft -= deltaTime; } if (_cartTimerLeft <= 0f) { _cartRemembered = null; _cartWarnLeft = 3f; _cartBumpTimer = 0f; SetCartPhase(CartPhase.Warn); ManualLogSource log5 = Plugin.Log; if (log5 != null) { log5.LogDebug((object)(Name + " is getting restless in the cart...")); } } return true; } if (BeingGrabbed) { ManualLogSource log6 = Plugin.Log; if (log6 != null) { log6.LogDebug((object)(Name + "'s escape was stopped by a grab.")); } SetCartPhase(CartPhase.None); return false; } _cartWarnLeft -= deltaTime; _cartBumpTimer -= deltaTime; if (_cartBumpTimer <= 0f) { _cartBumpTimer = Mathf.Lerp(0.45f, 0.15f, CartWarnProgress); Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; float num = Mathf.Lerp(0.6f, 1.6f, CartWarnProgress); _enemy.Rigidbody.rb.AddForce(new Vector3(normalized.x, 0.35f, normalized.y) * num, (ForceMode)2); } if (_cartWarnLeft <= 0f) { StartCartEscape(); } return true; } private void HoldStillInCart() { _enemy.NavMeshAgent.Disable(0.2f); _enemy.Rigidbody.DisableFollowPosition(0.2f, 10f); _enemy.Rigidbody.DisableFollowRotation(0.2f, 10f); } private void StartCartEscape() { //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_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_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_0075: 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_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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_012c: 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_0138: 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) PhysGrabCart cartIn = _cartIn; StealOneFromCart(cartIn); Vector3 position = _enemy.Rigidbody.rb.position; Vector3 val = Random.insideUnitSphere; float distance; PlayerAvatar val2 = NearestPlayer(position, out distance); if ((Object)(object)val2 != (Object)null) { val = position - ((Component)val2).transform.position; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val3 = position + val * 9f; NavMeshHit val4 = default(NavMeshHit); for (float num = 9f; num >= 2f; num -= 1.5f) { if (NavMesh.SamplePosition(position + val * num, ref val4, 2f, -1)) { val3 = ((NavMeshHit)(ref val4)).position; break; } } ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + " leaps out of the cart and flees!" + (_onStickyPad ? " (ignoring the sticky pad)" : ""))); } SetCartPhase(CartPhase.Flee); _onStickyPad = false; _cartFleeTime = 0f; _cartUnseenTime = 0f; _cartIn = null; LaunchAt(val3 + Vector3.up * 0.3f, 0.8f, 1.6f); } private void StealOneFromCart(PhysGrabCart cart) { //IL_0026: 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_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cart == (Object)null || (Object)(object)cart.inCart == (Object)null || ContentsFull) { return; } Collider[] array = Physics.OverlapBox(cart.inCart.position, cart.inCart.localScale / 2f, cart.inCart.rotation, LayerMask.GetMask(new string[1] { "PhysGrabObject" }), (QueryTriggerInteraction)1); List<KeyValuePair<PhysGrabObject, ItemSize>> list = new List<KeyValuePair<PhysGrabObject, ItemSize>>(); HashSet<PhysGrabObject> hashSet = new HashSet<PhysGrabObject>(); Collider[] array2 = array; foreach (Collider val in array2) { PhysGrabObject val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInParent<PhysGrabObject>() : null); if (!((Object)(object)val2 == (Object)null) && hashSet.Add(val2) && !((Object)(object)val2 == (Object)(object)_enemy.Rigidbody.physGrabObject) && !((Object)(object)((Component)val2).GetComponentInParent<EnemyRigidbody>() != (Object)null) && !((Object)(object)((Component)val2).GetComponentInParent<PlayerTumble>() != (Object)null)) { ItemSize itemSize = AbsorbableSize(val2); if (itemSize != ItemSize.None && HasRoomFor(itemSize)) { list.Add(new KeyValuePair<PhysGrabObject, ItemSize>(val2, itemSize)); } } } if (list.Count != 0) { KeyValuePair<PhysGrabObject, ItemSize> keyValuePair = list[Random.Range(0, list.Count)]; ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + " grabs something from the cart on its way out.")); } AbsorbItem(keyValuePair.Key, keyValuePair.Value, lit: false); } } private bool FleeTick(float dt) { //IL_00c8: 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) //IL_00f8: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) _cartFleeTime += dt; if (BeingGrabbed && _cartFleeTime > 0.3f) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + "'s escape was stopped by a grab.")); } EndFlee(); return false; } float num = 1.05f; if (_cartFleeTime < num) { _enemy.NavMeshAgent.Disable(0.1f); _enemy.Rigidbody.DisableFollowPosition(0.1f, 10f); return true; } if (Mathf.Approximately(_cartFleeTime - dt, 0f) || _cartFleeTime - dt < num) { _enemy.NavMeshAgent.Warp(((Component)_enemy.Rigidbody).transform.position, false); LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 15f, 40f, false) ?? SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f); _agentDestination = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : ((Component)this).transform.position); } _enemy.NavMeshAgent.SetDestination(_agentDestination); _enemy.NavMeshAgent.OverrideAgent(chaseSpeed * CartEscapeSpeed * SqueezeSpeedFactor(), chaseAcceleration * 2f, 0.25f); bool flag = AnyPlayerSees(); _cartUnseenTime = (flag ? 0f : (_cartUnseenTime + dt)); if (_cartFleeTime >= 4f + num || _cartUnseenTime >= 0.5f) { EndFlee(); return false; } return true; } private void EndFlee() { SetCartPhase(CartPhase.None); _visionCooldownTimer = Mathf.Max(_visionCooldownTimer, 1f); UpdateState(State.Idle); } private bool AnyPlayerSees() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_00c8: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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) Vector3 val = (((Object)(object)_enemy.Vision != (Object)null && (Object)(object)_enemy.Vision.VisionTransform != (Object)null) ? _enemy.Vision.VisionTransform.position : _enemy.Rigidbody.rb.position); int mask = LayerMask.GetMask(new string[1] { "Default" }); foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !player.isDisabled && !((Object)(object)player.PlayerVisionTarget == (Object)null) && !((Object)(object)player.PlayerVisionTarget.VisionTransform == (Object)null)) { Vector3 val2 = player.PlayerVisionTarget.VisionTransform.position - val; if (!(((Vector3)(ref val2)).magnitude > 20f) && !Physics.Raycast(val, val2, ((Vector3)(ref val2)).magnitude, mask, (QueryTriggerInteraction)1)) { return true; } } } return false; } private static PlayerAvatar NearestPlayer(Vector3 from, out float distance) { //IL_0034: 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) PlayerAvatar result = null; distance = float.MaxValue; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (!((Object)(object)player == (Object)null) && !player.isDisabled) { float num = Vector3.Distance(from, ((Component)player).transform.position); if (num < distance) { distance = num; result = player; } } } return result; } private static PhysGrabCart FindCartContaining(Vector3 point) { //IL_007e: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a5: 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_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_00c5: 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_00d9: 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_00ed: 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) if (Time.time >= _cartsRefreshAt) { _cartsRefreshAt = Time.time + 2f; Carts.Clear(); Carts.AddRange(Object.FindObjectsByType<PhysGrabCart>((FindObjectsSortMode)0)); } foreach (PhysGrabCart cart in Carts) { if (!((Object)(object)cart == (Object)null) && !((Object)(object)cart.inCart == (Object)null) && ((Behaviour)cart).isActiveAndEnabled) { Transform inCart = cart.inCart; Vector3 val = Quaternion.Inverse(inCart.rotation) * (point - inCart.position); Vector3 val2 = inCart.localScale * 0.5f + new Vector3(0.05f, 0.25f, 0.05f); if (Mathf.Abs(val.x) <= val2.x && Mathf.Abs(val.y) <= val2.y && Mathf.Abs(val.z) <= val2.z) { return cart; } } } return null; } private void SetCartPhase(CartPhase phase) { if (_cartPhase != phase) { _cartPhase = phase; if (phase == CartPhase.None || phase == CartPhase.Flee) { _cartAloneTime = 0f; } if (GameManager.Multiplayer()) { _photonView.RPC("CartPhaseRPC", (RpcTarget)1, new object[1] { (int)phase }); } } } [PunRPC] private void CartPhaseRPC(int phase, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { _cartPhase = (CartPhase)phase; if (_cartPhase == CartPhase.Warn) { _cartWarnLeft = 3f; } } } private void CartClientTick() { if (_cartPhase == CartPhase.Warn && _cartWarnLeft > 0f) { _cartWarnLeft -= Time.deltaTime; } } private void Awake() { _enemy = ((Component)this).GetComponent<Enemy>(); _photonView = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)_enemy == (Object)null) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogError((object)"JellyController must sit on the same GameObject as the Enemy component."); } ((Behaviour)this).enabled = false; } else { EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); _anim = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren<JellyAnimationController>(true) : null); HookGameEvents(); } } private float SqueezeSpeedFactor() { return (((Object)(object)_anim != (Object)null) ? Mathf.Lerp(1f, squeezedSpeedFactor, _anim.SqueezeAmount) : 1f) * PadStickFactor * SpeedMultiplier; } private void HookGameEvents() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); if ((Object)(object)component != (Object)null) { component.OnSpawn.AddListener(new UnityAction(OnSpawn)); } EnemyVision component2 = ((Component)this).GetComponent<EnemyVision>(); if ((Object)(object)component2 != (Object)null) { component2.onVisionTriggered.AddListener(new UnityAction(OnVision)); } EnemyStateInvestigate component3 = ((Component)this).GetComponent<EnemyStateInvestigate>(); if ((Object)(object)component3 != (Object)null) { component3.onInvestigateTriggered.AddListener(new UnityAction(OnInvestigate)); } EnemyHealth component4 = ((Component)this).GetComponent<EnemyHealth>(); if ((Object)(object)component4 != (Object)null) { component4.onHurt.AddListener(new UnityAction(OnHurt)); component4.onDeath.AddListener(new UnityAction(OnDeath)); return; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogWarning((object)"JellyController: no EnemyHealth found, Jelly can't be killed."); } } private void OnDisable() { EndOoze("disabled"); MiniDisabled(); if (_absorbedViewIds.Count > 0 && SemiFunc.IsMasterClientOrSingleplayer()) { ReleaseAll("Jelly disabled"); } if (_heldItems.Count > 0 && SemiFunc.IsMasterClientOrSingleplayer()) { ReleaseAllItems("Jelly disabled"); } ClearHeldItemsLocal(); ClearPassengersLocal(); RestorePassengerItemCollisions(); } private void Update() { long t = JellyPerf.Start(); UpdateCore(); JellyPerf.Add(JellyPerf.Slot.Ai, t); } private void UpdateCore() { LocalPassengerUpdate(); HeldItemLocalTick(); MiniWeightTick(); PassengerGuardTick(); JellyVoiceMuffle.Ensure(); if (!SemiFunc.IsMasterClientOrSingleplayer()) { CartClientTick(); return; } JellyHostSync.HostTick(); if (_visionCooldownTimer > 0f) { _visionCooldownTimer -= Time.deltaTime; } if (_pounceCooldownTimer > 0f) { _pounceCooldownTimer -= Time.deltaTime; } bool flag = CartTick(); if (!flag && _enemy.IsStunned()) { UpdateState(State.Stun); } if (!flag) { switch (currentState) { case State.Spawn: StateSpawn(); break; case State.Idle: StateIdle(); break; case State.Roam: StateRoam(); break; case State.Investigate: StateInvestigate(); break; case State.Stun: StateStun(); break; case State.Leave: StateLeave(); break; case State.Chase: StateChase(); break; case State.Pounce: StatePounce(); break; } } StickyPadTick(); PassengerDamageTick(); if (!flag) { ItemAbsorbTick(); } if (!flag) { FullKnockTick(); } VoidSafetyTick(); if (!flag) { WedgeWatchdogTick(); } if (!flag) { FloorGuardTick(); } GrabLogTick(); HeldItemVisionTick(); } private void VoidSafetyTick() { //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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if (_recoverCooldown > 0f) { _recoverCooldown -= Time.deltaTime; } _voidCheckTimer -= Time.deltaTime; if (_voidCheckTimer > 0f || (Object)(object)_enemy.Rigidbody == (Object)null) { return; } _voidCheckTimer = 0.25f; Vector3 position = ((Component)_enemy.Rigidbody).transform.position; bool flag = !_enemy.HasGrounded || _enemy.Grounded.grounded; NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val, 1.5f, -1)) { Vector3 val2 = ((NavMeshHit)(ref val)).position - position; float y = val2.y; val2.y = 0f; if (y > 0.5f && ((Vector3)(ref val2)).magnitude < 0.6f && !_oozing && currentState != State.Pounce) { RecoverFromVoid("under the floor"); } else if (flag && !_oozing && Mathf.Abs(y) < 0.6f && ((Vector3)(ref val2)).magnitude < 0.4f) { _lastGoodPos = ((NavMeshHit)(ref val)).position; _hasGoodPos = true; } } } internal bool RecoverFromVoid(string why) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_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_0079: 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_00ba: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer() || (Object)(object)_enemy == (Object)null) { return false; } if (_recoverCooldown > 0f) { return true; } Vector3 val; if (_hasGoodPos) { val = _lastGoodPos; } else { NavMeshHit val2 = default(NavMeshHit); if (!NavMesh.SamplePosition(((Component)this).transform.position, ref val2, 3f, -1)) { return false; } val = ((NavMeshHit)(ref val2)).position; } EndOoze("recovering"); _recoverCooldown = 1f; _enemy.EnemyTeleported(val); if ((Object)(object)_enemy.Rigidbody != (Object)null && (Object)(object)_enemy.Rigidbody.rb != (Object)null) { _enemy.Rigidbody.rb.linearVelocity = Vector3.zero; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"Jelly fell through the level ({why}); put back at {val}."); } return true; } private void FixedUpdate() { if (SemiFunc.IsMasterClientOrSingleplayer()) { if (_oozing) { OozeTick(Time.fixedDeltaTime); } if (_passengers.Count > 0) { PassengerHoldPhysics(); } if (_heldItems.Count > 0) { ItemHoldPhysics(); } } } private void StateSpawn() { if (_stateImpulse) { _stateImpulse = false; _stateTimer = 1f; SplitPop(); } _stateTimer -= Time.deltaTime; if (_stateTimer <= 0f) { UpdateState(State.Idle); } } private void StateIdle() { //IL_003f: 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) if (_stateImpulse) { _stateImpulse = false; StopMoving(); _stateTimer = Random.Range(idleTimeMin, idleTimeMax); } if (SemiFunc.EnemySpawnIdlePause()) { return; } if (TryFindItemToSeek(out var destination)) { _pendingItemDestination = destination; _hasPendingItemDestination = true; UpdateState(State.Roam); return; } _stateTimer -= Time.deltaTime; if (_stateTimer <= 0f) { UpdateState(State.Roam); } CheckForceLeave(); } private void StateRoam() { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) //IL_013a: 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) if (_stateImpulse) { _stateImpulse = false; StopMoving(); _stateTimer = stuckGiveUpTime; if (_hasPendingItemDestination) { _agentDestination = _pendingItemDestination; _hasPendingItemDestination = false; _seekingItem = true; } else if (TryPickLootPatrolDestination(out _agentDestination)) { _seekingItem = false; } else { if (!TryPickRoamDestination(out _agentDestination)) { UpdateState(State.Idle); return; } _seekingItem = false; } } if (TryFindItemToSeek(out var destination) && (!_seekingItem || Vector3.Distance(destination, _agentDestination) > 0.5f)) { _agentDestination = destination; _seekingItem = true; _stateTimer = stuckGiveUpTime; } _enemy.NavMeshAgent.SetDestination(_agentDestination); _enemy.NavMeshAgent.OverrideAgent(roamSpeed * SqueezeSpeedFactor(), roamAcceleration, 0.25f); StuckCheck(); if (_enemy.Rigidbody.notMovingTimer > 2f) { _stateTimer -= Time.deltaTime; } if (_stateTimer <= 0f || Vector3.Distance(((Component)this).transform.position, _agentDestination) < 1f) { EndItemSeek(); UpdateState(State.Idle); } CheckForceLeave(); } private void StateInvestigate() { //IL_003d: 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_00b7: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _stateTimer = stuckGiveUpTime; _enemy.Rigidbody.notMovingTimer = 0f; return; } _enemy.NavMeshAgent.SetDestination(_agentDestination); _enemy.NavMeshAgent.OverrideAgent(investigateSpeed * SqueezeSpeedFactor(), investigateAcceleration, 0.25f); StuckCheck(); if (_enemy.Rigidbody.notMovingTimer > 2f) { _stateTimer -= Time.deltaTime; } if (_stateTimer <= 0f || Vector3.Distance(((Component)this).transform.position, _agentDestination) < 2f) { _visionCooldownTimer = visionCooldown; UpdateState(State.Idle); } CheckForceLeave(); } private void StateChase() { //IL_005a: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0160: 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_0166: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _destinationRefreshTimer = 0f; _enemy.Rigidbody.notMovingTimer = 0f; } if (!TargetValid(_target) || !CanHunt) { _target = null; UpdateState(State.Idle); return; } Vector3 val = PlayerCenter(_target); bool flag = TargetInClearView(); if (flag) { _targetLastSeenTime = Time.time; _targetLastSeenPosition = ((Component)_target).transform.position; } if (Time.time - _targetLastSeenTime > chaseLoseTime) { _agentDestination = _targetLastSeenPosition; _target = null; UpdateState(State.Investigate); return; } _destinationRefreshTimer -= Time.deltaTime; if (_destinationRefreshTimer <= 0f) { _destinationRefreshTimer = 0.2f; _agentDestination = (flag ? ((Component)_target).transform.position : _targetLastSeenPosition); } _enemy.NavMeshAgent.SetDestination(_agentDestination); _enemy.NavMeshAgent.OverrideAgent(chaseSpeed * SqueezeSpeedFactor(), chaseAcceleration, 0.25f); StuckCheck(); Vector3 centerPoint = _enemy.Rigidbody.physGrabObject.centerPoint; Vector3 val2 = val - centerPoint; float y = val2.y; val2.y = 0f; if (flag && CanTakePlayer && !InSpawnGrace && !_onStickyPad && _pounceCooldownTimer <= 0f && ((Vector3)(ref val2)).magnitude < pounceRange && Mathf.Abs(y) < pounceMaxHeightDifference && (!_enemy.HasGrounded || _enemy.Grounded.grounded)) { UpdateState(State.Pounce); } } private void StatePounce() { //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _stateTimer = pounceDuration; _pounceLaunched = false; _pounceWindupLeft = PounceWindup; _pounceGrabLogged = false; } PounceGrabTick(); if (!_pounceLaunched) { if (!TargetValid(_target) || _enemy.IsStunned()) { UpdateState((!TargetValid(_target)) ? State.Idle : State.Chase); return; } _pounceWindupLeft -= Time.deltaTime; if (_pounceWindupLeft > 0f) { _enemy.NavMeshAgent.Stop(0.1f); return; } _pounceLaunched = true; _stateTimer = pounceDuration; LaunchAt(PlayerCenter(_target)); } _stateTimer -= Time.deltaTime; if (_stateTimer - (pounceDuration - pounceFlightTime - 0.25f) > 0f) { _enemy.NavMeshAgent.Disable(0.1f); _enemy.Rigidbody.DisableFollowPosition(0.1f, 10f); } if (CanTakePlayer && !InSpawnGrace) { PlayerAvatar val = FindPlayerInside(); if ((Object)(object)val != (Object)null) { Absorb(val); } } if (_stateTimer <= 0f) { _pounceCooldownTimer = pounceCooldown; _enemy.NavMeshAgent.Warp(((Component)_enemy.Rigidbody).transform.position, false); if (TargetValid(_target) && CanHunt) { _targetLastSeenTime = Time.time; UpdateState(State.Chase); } else { _target = null; _visionCooldownTimer = 1f; UpdateState(State.Idle); } } } private void StateStun() { if (_stateImpulse) { _stateImpulse = false; StopMoving(); } if (!_enemy.IsStunned()) { UpdateState((!TargetValid(_target) || !CanHunt) ? State.Idle : State.Chase); } } private void StateLeave() { //IL_00a1: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (_stateImpulse) { _stateImpulse = false; _stateTimer = 10f; LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 25f, 50f, false); if ((Object)(object)val == (Object)null) { val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f); } if ((Object)(object)val != (Object)null) { _agentDestination = ((Component)val).transform.position; } else { _enemy.EnemyParent.SpawnedTimerSet(0f); } SemiFunc.EnemyLeaveStart(_enemy); } else { _enemy.NavMeshAgent.SetDestination(_agentDestination); _enemy.NavMeshAgent.OverrideAgent(Mathf.Min(leaveSpeed, chaseSpeed) * SqueezeSpeedFactor(), leaveAcceleration, 0.25f); StuckCheck(); if (_enemy.Rigidbody.notMovingTimer > 2f) { _stateTimer -= Time.deltaTime; } if (_stateTimer <= 0f || Vector3.Distance(((Component)this).transform.position, _agentDestination) < 1f) { UpdateState(State.Idle); } } } private void CheckForceLeave() { if (AbsorbedCount == 0 && SemiFunc.EnemyForceLeave(_enemy)) { UpdateState(State.Leave); } } private bool TargetValid(PlayerAvatar player) { if ((Object)(object)player != (Object)null && !player.isDisabled && !player.deadSet && !IsAbsorbed(player) && !InsideOtherCube(player)) { if ((Object)(object)player.photonView != (Object)null && _absorbImmunityUntil.TryGetValue(player.photonView.ViewID, out var value)) { return !(Time.time < value); } return true; } return false; } private bool TargetInClearView() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_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_008f: 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_00b6: Unknown result type (might be due to invalid IL or missing references) _losTimer -= Time.deltaTime; if (_losTimer > 0f) { return _losClear; } _losTimer = 0.1f; Vector3 position = _enemy.Vision.VisionTransform.position; Vector3 val = (((Object)(object)_target.PlayerVisionTarget != (Object)null && (Object)(object)_target.PlayerVisionTarget.VisionTransform != (Object)null) ? _target.PlayerVisionTarget.VisionTransform.position : PlayerCenter(_target)) - position; _losClear = ((Vector3)(ref val)).magnitude < _enemy.Vision.VisionDistance && !Physics.Raycast(position, val, ((Vector3)(ref val)).magnitude, LayerMask.GetMask(new string[1] { "Default" }), (QueryTriggerInteraction)1); return _losClear; } private void LaunchAt(Vector3 targetPoint, float flightTime = -1f, float arcHeight = -1f) { //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_0055: 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_0085: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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) Rigidbody rb = _enemy.Rigidbody.rb; Vector3 centerPoint = _enemy.Rigidbody.physGrabObject.centerPoint; float num = Mathf.Max(0.2f, (flightTime > 0f) ? flightTime : pounceFlightTime); float num2 = ((arcHeight >= 0f) ? arcHeight : pounceArcHeight); float num3 = 0f - Physics.gravity.y + _enemy.Rigidbody.customGravity / Mathf.Max(0.01f, rb.mass); Vector3 val = targetPoint - centerPoint; Vector3 val2 = new Vector3(val.x, 0f, val.z) / num; float num4 = (val.y + num2 + 0.5f * num3 * num * num) / num; _enemy.NavMeshAgent.Disable(num + 0.25f); _enemy.Rigidbody.DisableFollowPosition(num + 0.25f, 10f); _enemy.Rigidbody.WarpDisable(num + 0.5f); if (_enemy.HasGrounded) { _enemy.Grounded.GroundedDisable(0.25f); } if (_enemy.HasJump) { _enemy.Jump.JumpingSet(true, (Type)2); } rb.linearVelocity = val2 + Vector3.up * num4; } private static bool IsMoveState(State state) { if (state != State.Roam && state != State.Investigate && state != State.Chase) { return state == State.Leave; } return true; } private void StuckCheck() { //IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) if (!oozeEnabled) { StuckHopCheck(); return; } float deltaTime = Time.deltaTime; if (_oozing) { return; } if (BeingGrabbed) { _stuckTimer = 0f; return; } if (_oozeCooldownTimer > 0f) { _oozeCooldownTimer -= deltaTime; _stuckTimer = 0f; return; } if (!_enemy.NavMeshAgent.HasPath() || _enemy.IsStunned() || _onStickyPad) { _stuckTimer = 0f; return; } Rigidbody rb = _enemy.Rigidbody.rb; Vector3 position = ((Component)_enemy.Rigidbody).transform.position; Vector3 val = ((Component)this).transform.position - position; Vector3 val2 = new Vector3(val.x, 0f, val.z); float magnitude = ((Vector3)(ref val2)).magnitude; Vector3 linearVelocity = rb.linearVelocity; val2 = new Vector3(linearVelocity.x, 0f, linearVelocity.z); float magnitude2 = ((Vector3)(ref val2)).magnitude; bool num = Vector3.Distance(position, _enemy.NavMeshAgent.GetDestination()) > 1.5f; float num2 = 0f; if ((Object)(object)_enemy.NavMeshAgent.Agent != (Object)null) { num2 = _enemy.NavMeshAgent.Agent.steeringTarget.y - _enemy.NavMeshAgent.Agent.nextPosition.y; } bool flag = magnitude2 < 0.4f && (magnitude > 0.4f || _enemy.Rigidbody.notMovingTimer > 0.6f); bool flag2 = num2 > 0.12f && magnitude2 < 0.9f && magnitude > 0.5f; bool flag3 = num && (flag || flag2); _stuckTimer = (flag3 ? (_stuckTimer + deltaTime) : Mathf.Max(0f, _stuckTimer - deltaTime * 2f)); if (_stuckTimer >= oozeDelay) { _stuckTimer = 0f; StartOoze((flag2 && !flag) ? "a climb" : DescribeObstacle()); } } private float CurrentMoveSpeed() { return currentState switch { State.Chase => chaseSpeed, State.Investigate => investigateSpeed, State.Leave => Mathf.Min(leaveSpeed, chaseSpeed), _ => roamSpeed, }; } private void StartOoze(string reason) { //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if (_oozing || (Object)(object)_enemy.Rigidbody == (Object)null) { return; } Rigidbody rb = _enemy.Rigidbody.rb; _oozeColliders.Clear(); Collider[] componentsInChildren = ((Component)_enemy.Rigidbody).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if ((Object)(object)val != (Object)null && !val.isTrigger) { _oozeColliders.Add(val); } } if (_oozeColliders.Count == 0) { return; } if (_oozeMask == -1) { int layer = ((Component)_oozeColliders[0]).gameObject.layer; _oozeMask = 0; for (int j = 0; j < 32; j++) { if (!Physics.GetIgnoreLayerCollision(layer, j)) { _oozeMask |= 1 << j; } } } float num = rb.position.y - 0.5f; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(rb.position, ref val2, 2f, -1)) { num = ((NavMeshHit)(ref val2)).position.y; } float num2 = 0.2f; foreach (Collider oozeCollider in _oozeColliders) { if ((Object)(object)oozeCollider != (Object)null) { float num3 = num2; float y = rb.position.y; Bounds bounds = oozeCollider.bounds; num2 = Mathf.Max(num3, y - ((Bounds)(ref bounds)).min.y); } } _oozeGroundOffset = Mathf.Clamp(Mathf.Max(rb.position.y - num, num2), 0.2f, 1.5f); _oozeSpeed = Mathf.Max(0.8f, CurrentMoveSpeed() * SpeedMultiplier * oozeSpeedFactor); _oozeHadGravity = rb.useGravity; _oozeTimer = 0f; _oozeCheckTimer = 0f; _oozing = true; foreach (Collider oozeCollider2 in _oozeColliders) { oozeCollider2.isTrigger = true; } rb.useGravity = false; OozeHoldOverrides(); if (logStateChanges) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + " oozing through " + reason + ".")); } } } private void OozeHoldOverrides() { _enemy.Rigidbody.DisableFollowPosition(0.2f, 10f); _enemy.Rigidbody.DeactivateCustomGravity(0.2f); _enemy.Rigidbody.WarpDisable(0.3f); _enemy.Rigidbody.notMovingTimer = 0f; } private void OozeTick(float dt) { //IL_0072: 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_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_018f: 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_0198: 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_015b: Unknown result type (might be due to invalid IL or missing references) Rigidbody rb = _enemy.Rigidbody.rb; if (BeingGrabbed) { EndOoze("grabbed"); return; } _oozeTimer += dt; OozeHoldOverrides(); NavMeshAgent agent = _enemy.NavMeshAgent.Agent; if ((Object)(object)agent == (Object)null || !_enemy.NavMeshAgent.HasPath()) { EndOoze("no path"); return; } Vector3 position = rb.position; Vector3 position2 = ((Component)this).transform.position; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(position2.x - position.x, 0f, position2.z - position.z); if (((Vector3)(ref val)).magnitude < 0.3f) { position2 = agent.steeringTarget; ((Vector3)(ref val))..ctor(position2.x - position.x, 0f, position2.z - position.z); } Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? (((Vector3)(ref val)).normalized * Mathf.Min(_oozeSpeed * PadStickFactor, ((Vector3)(ref val)).magnitude / Mathf.Max(dt, 0.001f))) : Vector3.zero); float num = position.y - _oozeGroundOffset; NavMeshHit val3 = default(NavMeshHit); if (NavMesh.SamplePosition(position + val2 * dt, ref val3, 1.5f, -1)) { num = ((NavMeshHit)(ref val3)).position.y; } float num2 = Mathf.Clamp((num + _oozeGroundOffset - position.y) * 10f, -4f, 4f); rb.linearVelocity = val2 + Vector3.up * num2; _oozeCheckTimer -= dt; if (!(_oozeTimer < oozeMinTime) && !(_oozeCheckTimer > 0f)) { _oozeCheckTimer = 0.1f; if (!BodyInsideLevel(out var _)) { EndOoze("clear"); } else if (_oozeTimer >= oozeMaxTime * 2f) { EndOoze("gave up, still inside something"); } else if (_oozeTimer >= oozeMaxTime && ((Vector3)(ref val)).magnitude < 0.05f) { EndOoze("time"); } } } private bool BodyInsideLevel(out Collider blocker) { //IL_0014: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bb: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_0105: Unknown result type (might be due to invalid IL or missing references) blocker = null; if (_oozeColliders.Count == 0) { return false; } Bounds val = default(Bounds); bool flag = true; foreach (Collider oozeCollider in _oozeColliders) { if (!((Object)(object)oozeCollider == (Object)null)) { if (flag) { val = oozeCollider.bounds; flag = false; } else { ((Bounds)(ref val)).Encapsulate(oozeCollider.bounds); } } } if (flag) { return false; } Vector3 val2 = ((Bounds)(ref val)).min + new Vector3(0.02f, 0.2f, 0.02f); Vector3 val3 = ((Bounds)(ref val)).max - new Vector3(0.02f, 0.02f, 0.02f); if (val3.y <= val2.y) { return false; } Rigidbody rb = _enemy.Rigidbody.rb; int num = Physics.OverlapBoxNonAlloc((val2 + val3) * 0.5f, (val3 - val2) * 0.5f, _oozeHits, Quaternion.identity, _oozeMask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Collider val4 = _oozeHits[i]; if (!((Object)(object)val4 == (Object)null) && !val4.isTrigger) { Rigidbody attachedRigidbody = val4.attachedRigidbody; if (!((Object)(object)attachedRigidbody == (Object)(object)rb) && (!((Object)(object)attachedRigidbody != (Object)null) || attachedRigidbody.isKinematic) && !((Object)(object)((Component)val4).GetComponentInParent<PlayerAvatar>() != (Object)null) && !((Object)(object)((Component)val4).GetComponentInParent<PlayerController>() != (Object)null) && !((Object)(object)((Component)val4).GetComponentInParent<EnemyParent>() != (Object)null)) { blocker = val4; return true; } } } return false; } private string DescribeObstacle() { if (_oozeColliders.Count == 0) { Collider[] componentsInChildren = ((Component)_enemy.Rigidbody).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if ((Object)(object)val != (Object)null && !val.isTrigger) { _oozeColliders.Add(val); } } } if (_oozeMask == -1 && _oozeColliders.Count > 0) { int layer = ((Component)_oozeColliders[0]).gameObject.layer; _oozeMask = 0; for (int j = 0; j < 32; j++) { if (!Physics.GetIgnoreLayerCollision(layer, j)) { _oozeMask |= 1 << j; } } } if (!BodyInsideLevel(out var blocker) || !((Object)(object)blocker != (Object)null)) { return "something"; } return "'" + ((Object)blocker).name + "'"; } private void EndOoze(string why) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!_oozing) { return; } Collider blocker; bool flag = why != "clear" && why != "disabled" && BodyInsideLevel(out blocker); _oozing = false; _oozeCooldownTimer = oozeCooldown; foreach (Collider oozeCollider in _oozeColliders) { if ((Object)(object)oozeCollider != (Object)null) { oozeCollider.isTrigger = false; } } NavMeshHit val = default(NavMeshHit); if (flag && NavMesh.SamplePosition(((Component)this).transform.position, ref val, 2f, -1)) { _enemy.EnemyTeleported(((NavMeshHit)(ref val)).position); ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + " ooze ended inside something (" + why + "); moved onto its path.")); } } if ((Object)(object)_enemy != (Object)null && (Object)(object)_enemy.Rigidbody != (Object)null && (Object)(object)_enemy.Rigidbody.rb != (Object)null) { _enemy.Rigidbody.rb.useGravity = _oozeHadGravity; _enemy.Rigidbody.notMovingTimer = 0f; _enemy.Rigidbody.StuckReset(); } if (!flag) { FloorGuardAfterOoze(); } if (logStateChanges) { ManualLogSource log2 = Plugin.Log; if (log2 != null) { log2.LogDebug((object)$"{Name} ooze ended ({why}, {_oozeTimer:0.0} s)."); } } } private void StuckHopCheck() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d4: 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) //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_0130: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: 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) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) if (!stuckHopEnabled) { return; } float deltaTime = Time.deltaTime; if (_stuckHopCooldownTimer > 0f) { _stuckHopCooldownTimer -= deltaTime; return; } if (!_enemy.NavMeshAgent.HasPath() || (_enemy.HasGrounded && !_enemy.Grounded.grounded)) { _stuckTimer = 0f; return; } Rigidbody rb = _enemy.Rigidbody.rb; Vector3 position = ((Component)_enemy.Rigidbody).transform.position; Vector3 val = ((Component)this).transform.position - position; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, 0f, val.z); Vector3 linearVelocity = rb.linearVelocity; Vector3 val3 = new Vector3(linearVelocity.x, 0f, linearVelocity.z); float magnitude = ((Vector3)(ref val3)).magnitude; bool num = Vector3.Distance(position, _enemy.NavMeshAgent.GetDestination()) > 1.5f; float num2 = 0f; if ((Object)(object)_enemy.NavMeshAgent.Agent != (Object)null) { num2 = _enemy.NavMeshAgent.Agent.steeringTarget.y - _enemy.NavMeshAgent.Agent.nextPosition.y; } bool flag = (Object)(object)_anim != (Object)null && _anim.SqueezeAmount > 0.3f; bool flag2 = num2 > 0.12f && magnitude < 0.9f && ((Vector3)(ref val2)).magnitude > 0.5f; bool flag3 = magnitude < 0.35f && _enemy.Rigidbody.notMovingTimer > 0.6f; bool flag4 = num && !flag && (flag2 || flag3); _stuckTimer = (flag4 ? (_stuckTimer + deltaTime) : Mathf.Max(0f, _stuckTimer - deltaTime * 2f)); if (_stuckTimer < stuckHopDelay) { return; } _stuckTimer = 0f; _stuckHopCooldownTimer = stuckHopCooldown; Vector3 val4 = (((Object)(object)_enemy.NavMeshAgent.Agent != (Object)null) ? (_enemy.NavMeshAgent.Agent.steeringTarget - position) : val2); float num3 = Mathf.Clamp(num2, 0f, 1.5f); val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = val2; } if (((Vector3)(ref val4)).sqrMagnitude < 0.01f) { val4 = ((Component)this).transform.forward; } _enemy.Rigidbody.DisableFollowPosition(0.35f, 10f); if (_enemy.HasGrounded) { _enemy.Grounded.GroundedDisable(0.15f); } if (_enemy.HasJump) { _enemy.Jump.JumpingSet(true, (Type)2); } rb.linearVelocity = ((Vector3)(ref val4)).normalized * stuckHopForward + Vector3.up * (stuckHopUp + num3 * 1.5f); if (logStateChanges) { ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"Jelly stuck-hop (path rises {num3:0.00} m)."); } } } private PlayerAvatar FindPlayerInside() { //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_0035: 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 = HoldPoint(); PlayerAvatar result = null; float num = absorbRadius; foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if (TargetValid(player)) { float num2 = Vector3.Distance(val, PlayerCenter(player)); if ((Object)(object)player == (Object)(object)_target) { num2 -= 0.2f; } if (num2 < num) { num = num2; result = player; } } } return result; } private static Vector3 PlayerCenter(PlayerAvatar player) { //IL_0039: 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_008c: 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_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) if ((Object)(object)player.tumble != (Object)null && player.tumble.isTumbling && (Object)(object)player.tumble.physGrabObject != (Object)null) { return player.tumble.physGrabObject.centerPoint; } CapsuleCollider val = (((Object)(object)player.playerAvatarCollision != (Object)null) ? player.playerAvatarCollision.Collider : null); if ((Object)(object)val != (Object)null) { return ((Component)val).transform.TransformPoint(val.center); } return ((Component)player).transform.position + Vector3.up * 0.8f; } private Vector3 HoldPoint() { //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_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) return _enemy.Rigidbody.physGrabObject.centerPoint + Vector3.up * holdHeightOffset; } internal bool IsAbsorbed(PlayerAvatar player) { if ((Object)(object)player != (Object)null && (Object)(object)player.photonView != (Object)null) { return _absorbedViewIds.Contains(player.photonView.ViewID); } return false; } private bool InsideOtherCube(PlayerAvatar player) { if ((Object)(object)player != (Object)null && (Object)(object)player.photonView != (Object)null && Holding.TryGetValue(player.photonView.ViewID, out var value) && (Object)(object)value != (Object)null && (Object)(object)value != (Object)(object)this) { return ((Behaviour)value).isActiveAndEnabled; } return false; } private void Absorb(PlayerAvatar player) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && !((Object)(object)player.tumble == (Object)null) && !IsAbsorbed(player) && !InsideOtherCube(player)) { _passengers.Add(new Passenger { player = player, damageTimer = damageInterval }); player.tumble.TumbleSet(true, false, false); player.tumble.TumbleOverrideTime(1f); ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)$"{Name} absorbed {player.playerName} ({_passengers.Count}/{maxAbsorbedPlayers} players, {PointsUsed + playerPoints}/{capacityPoints} points used)."); } if ((Object)(object)player == (Object)(object)_target) { _target = null; } int viewID = player.photonView.ViewID; if (GameManager.Multiplayer()) { _photonView.RPC("AbsorbRPC", (RpcTarget)0, new object[1] { viewID }); } else { AbsorbRPC(viewID); } } } [PunRPC] private void AbsorbRPC(int playerViewId, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info) && !_absorbedViewIds.Contains(playerViewId)) { _absorbedViewIds.Add(playerViewId); Holding[playerViewId] = this; PlayerAvatar player = SemiFunc.PlayerAvatarGetFromPhotonID(playerViewId); SetPlayerCollision(player, ignore: true); SetHiddenFromMonsters(player, hidden: true); } } private void Release(Passenger passenger, string reason, bool push) { //IL_014b: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_00d5: Unknown result type (might be due to invalid IL or missing references) _passengers.Remove(passenger); PlayerAvatar player = passenger.player; if ((Object)(object)player == (Object)null || (Object)(object)player.photonView == (Object)null) { return; } ManualLogSource log = Plugin.Log; if (log != null) { log.LogDebug((object)(Name + " released " + player.playerName + ": " + reason + ".")); } if ((Object)(object)player.tumble != (Object)null && !player.deadSet) { player.tumble.TumbleOverrideTime(0.5f); if (push) { Vector3 val = PlayerCenter(player) - HoldPoint(); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Random.insideUnitSphere; } val.y = 0f; player.tumble.TumbleForce((((Vector3)(ref val)).normalized + Vector3.up * 0.5f) * releaseForce); } } int viewID = player.photonView.ViewID; if (GameManager.Multiplayer()) { _photonView.RPC("ReleaseRPC", (RpcTarget)0, new object[1] { viewID }); } else { ReleaseRPC(viewID); } } private void ReleaseAll(string reason) { //IL_005b: 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) for (int num = _passengers.Count - 1; num >= 0; num--) { Release(_passengers[num], reason, push: true); } if (_absorbedViewIds.Count > 0) { if (GameManager.Multiplayer()) { _photonView.RPC("ReleaseAllRPC", (RpcTarget)0, Array.Empty<object>()); } else { ReleaseAllRPC(); } } } [PunRPC] private void ReleaseRPC(int playerViewId, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) i