Decompiled source of SCP4666 v1.1.0
plugins/ProjectSCP.SCP4666.dll
Decompiled 2 weeks 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ProjectSCP.SCP4666.NetcodePatcher; using SCP4666.Doll; using SCP4666.YulemanKnife; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("ProjectSCP.SCP4666")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+9b787c31f0eb54668821720da5973dcf6be982f8")] [assembly: AssemblyProduct("SCP4666")] [assembly: AssemblyTitle("ProjectSCP.SCP4666")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SCP4666 { public class ChildSackBehavior : PhysicsProp { [CompilerGenerated] private sealed class <<Activate>g__ActivateCoroutine|12_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public ChildSackBehavior <>4__this; private int <playersRespawned>5__1; private PlayerControllerB[] <>s__2; private int <>s__3; private PlayerControllerB <player>5__4; private float <size>5__5; private float <size>5__6; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<Activate>g__ActivateCoroutine|12_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>s__2 = null; <player>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 2; return true; case 2: <>1__state = -1; <playersRespawned>5__1 = 0; <>s__2 = StartOfRound.Instance.allPlayerScripts; for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++) { <player>5__4 = <>s__2[<>s__3]; if (<player>5__4.isPlayerDead && !<player>5__4.isPlayerControlled) { if (<playersRespawned>5__1 == 0) { <size>5__5 = Random.Range(0.6f, 0.8f); <>4__this.DoALotOfShitToRevivePlayerClientRpc(<player>5__4.actualClientId, <size>5__5); <playersRespawned>5__1++; } else { if (Random.Range(0, 2) == 0) { <size>5__6 = Random.Range(0.6f, 0.8f); <>4__this.DoALotOfShitToRevivePlayerClientRpc(<player>5__4.actualClientId, <size>5__6); <playersRespawned>5__1++; } else { Utils.SpawnItem(ItemKeys.Gift, ((Component)<>4__this).transform.position); } <player>5__4 = null; } } } <>s__2 = null; ((NetworkBehaviour)<>4__this).NetworkObject.Despawn(true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static bool localPlayerSizeChangedFromSack; private const float minSize = 0.6f; private const float maxSize = 0.8f; private const bool allowManualActivation = true; public const bool activateOnTeamWipe = true; public static List<ChildSackBehavior> Instances { get; private set; } = new List<ChildSackBehavior>(); public override void Start() { ((GrabbableObject)this).Start(); Instances.Add(this); } public override void OnDestroy() { Instances.Remove(this); ((NetworkBehaviour)this).OnDestroy(); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_001f: 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) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { ((GrabbableObject)this).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); Activate(); } } public void Activate(float delay = 0f) { if (((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(ActivateCoroutine(delay)); } [IteratorStateMachine(typeof(<<Activate>g__ActivateCoroutine|12_0>d))] IEnumerator ActivateCoroutine(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<Activate>g__ActivateCoroutine|12_0>d(0) { <>4__this = this, delay = delay }; } } public static void OnPlayerDeath(PlayerControllerB player) { try { if (localPlayerSizeChangedFromSack) { Plugin.logger.LogDebug((object)"Changing player size back to default size"); localPlayerSizeChangedFromSack = false; NetworkHandlerSCP4666.Instance.ChangePlayerSizeServerRpc(player.actualClientId, 1f); } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } [ServerRpc(RequireOwnership = false)] public void ActivateServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: 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_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3212950885u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3212950885u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { Activate(); } } } [ClientRpc] private void DoALotOfShitToRevivePlayerClientRpc(ulong clientId, float playerSize = 1f) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_0071: 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_0090: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3148037036u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref playerSize, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3148037036u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = Plugin.PlayerFromId(clientId); DeadBodyInfo deadBody = val3.deadBody; val3.isInsideFactory = false; val3.isInElevator = true; val3.isInHangarShipRoom = true; val3.ResetPlayerBloodObjects(val3.isPlayerDead); val3.health = 5; val3.isClimbingLadder = false; val3.clampLooking = false; val3.inVehicleAnimation = false; val3.disableMoveInput = false; val3.disableLookInput = false; val3.disableInteract = false; val3.ResetZAndXRotation(); ((Collider)val3.thisController).enabled = true; if (val3.isPlayerDead) { Plugin.logger.LogDebug((object)"playerInital is dead, reviving them."); ((Collider)val3.thisController).enabled = true; val3.isPlayerDead = false; val3.isPlayerControlled = true; val3.health = 5; val3.hasBeenCriticallyInjured = false; val3.criticallyInjured = false; val3.playerBodyAnimator.SetBool("Limp", false); val3.TeleportPlayer(((Component)this).transform.position, false, 0f, false, true); val3.parentedToElevatorLastFrame = false; val3.overrideGameOverSpectatePivot = null; StartOfRound.Instance.SetPlayerObjectExtrapolate(false); val3.setPositionOfDeadPlayer = false; val3.DisablePlayerModel(((Component)val3).gameObject, true, true); ((Behaviour)val3.helmetLight).enabled = false; val3.Crouch(false); if ((Object)(object)val3.playerBodyAnimator != (Object)null) { val3.playerBodyAnimator.SetBool("Limp", false); } val3.bleedingHeavily = true; val3.deadBody = null; val3.activatingItem = false; val3.twoHanded = false; val3.inShockingMinigame = false; val3.inSpecialInteractAnimation = false; val3.freeRotationInInteractAnimation = false; val3.disableSyncInAnimation = false; val3.inAnimationWithEnemy = null; val3.holdingWalkieTalkie = false; val3.speakingToWalkieTalkie = false; val3.isSinking = false; val3.isUnderwater = false; val3.sinkingValue = 0f; val3.statusEffectAudio.Stop(); val3.DisableJetpackControlsLocally(); val3.mapRadarDotAnimator.SetBool("dead", false); val3.hasBegunSpectating = false; val3.externalForceAutoFade = Vector3.zero; val3.hinderedMultiplier = 1f; val3.isMovementHindered = 0; val3.sourcesCausingSinking = 0; val3.reverbPreset = StartOfRound.Instance.shipReverb; SoundManager.Instance.earsRingingTimer = 0f; val3.voiceMuffledByEnemy = false; SoundManager.Instance.playerVoicePitchTargets[Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val3)] = 1f; SoundManager.Instance.SetPlayerPitch(1f, Array.IndexOf(StartOfRound.Instance.allPlayerScripts, val3)); if ((Object)(object)val3.currentVoiceChatIngameSettings == (Object)null) { StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects(); } if ((Object)(object)val3.currentVoiceChatIngameSettings != (Object)null) { if ((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { val3.currentVoiceChatIngameSettings.InitializeComponents(); } if ((Object)(object)val3.currentVoiceChatIngameSettings.voiceAudio == (Object)null) { return; } ((Component)val3.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>().overridingLowPass = false; } } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val3) { val3.bleedingHeavily = false; val3.criticallyInjured = false; val3.health = 5; HUDManager.Instance.UpdateHealthUI(5, true); Animator playerBodyAnimator = val3.playerBodyAnimator; if (playerBodyAnimator != null) { playerBodyAnimator.SetBool("Limp", false); } val3.spectatedPlayerScript = null; StartOfRound.Instance.SetSpectateCameraToGameOverMode(false, val3); StartOfRound.Instance.SetPlayerObjectExtrapolate(false); ((Behaviour)HUDManager.Instance.audioListenerLowPass).enabled = false; HUDManager.Instance.gasHelmetAnimator.SetBool("gasEmitting", false); HUDManager.Instance.RemoveSpectateUI(); HUDManager.Instance.gameOverAnimator.SetTrigger("revive"); localPlayerSizeChangedFromSack = true; } StartOfRound.Instance.allPlayersDead = false; StartOfRound instance = StartOfRound.Instance; instance.livingPlayers++; StartOfRound.Instance.UpdatePlayerVoiceEffects(); deadBody.DeactivateBody(false); val3.thisPlayerBody.localScale = new Vector3(playerSize, playerSize, playerSize); Utils.RebuildRig(val3); } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3212950885u, new RpcReceiveHandler(__rpc_handler_3212950885), "ActivateServerRpc"); ((NetworkBehaviour)this).__registerRpc(3148037036u, new RpcReceiveHandler(__rpc_handler_3148037036), "DoALotOfShitToRevivePlayerClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_3212950885(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((ChildSackBehavior)(object)target).ActivateServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3148037036(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); float playerSize = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref playerSize, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((ChildSackBehavior)(object)target).DoALotOfShitToRevivePlayerClientRpc(clientId, playerSize); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "ChildSackBehavior"; } } public class FleshDollBehavior : PhysicsProp { public SmartAgentNavigator nav; public Transform holdItemPosition; public Collider collider; public Animator itemAnimator; public AnimationCurve grenadeFallCurve; public AnimationCurve grenadeVerticalFallCurveNoBounce; public AnimationCurve grenadeVerticalFallCurve; public static HashSet<FleshDollBehavior> Instances = new HashSet<FleshDollBehavior>(); public Vector3 destination; private const float AIIntervalTime = 0.2f; private float timeSinceIntervalUpdate; private GrabbableObject? heldObject; private bool isThrown; private bool landing; private List<EntranceTeleport> entrances = new List<EntranceTeleport>(); private Ray grenadeThrowRay; private RaycastHit grenadeHit; private const int stunGrenadeMask = 268437761; private Vector3 shipNode; private PlayerControllerB? previousPlayerHeldBy; private int hashSpeed; private int hashCarrying; private int hashSit; private float currentSpeed; private Vector3 lastPosition; private bool isOutside => nav.IsAgentOutside(); private bool isInsideFactory => !isOutside; public override void Start() { ((GrabbableObject)this).Start(); Instances.Add(this); hashSpeed = Animator.StringToHash("speed"); hashCarrying = Animator.StringToHash("carrying"); hashSit = Animator.StringToHash("sit"); } public override void OnDestroy() { Instances.Remove(this); ((NetworkBehaviour)this).OnDestroy(); } public override void Update() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)heldObject != (Object)null && (Object)(object)heldObject.playerHeldBy != (Object)null && ((NetworkBehaviour)this).IsServer) { nav.StopAgent(); DropItemClientRpc(((Component)this).transform.position); } if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; nav.SetAllValues(!((GrabbableObject)this).playerHeldBy.isInsideFactory); } if (((GrabbableObject)this).isHeld || ((GrabbableObject)this).isHeldByEnemy || !((GrabbableObject)this).reachedFloorTarget || ((GrabbableObject)this).fallTime < 1f || ((GrabbableObject)this).isInElevator) { ((GrabbableObject)this).Update(); } else if (((NetworkBehaviour)this).IsServer) { timeSinceIntervalUpdate += Time.deltaTime; if (timeSinceIntervalUpdate > 0.2f) { timeSinceIntervalUpdate = 0f; DoAIInterval(); } } } public void DoAIInterval() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ((Behaviour)nav.agent).enabled = (Object)(object)heldObject != (Object)null; if (!((Object)(object)heldObject == (Object)null)) { if (Vector3.Distance(((Component)this).transform.position, shipNode) < 1f) { nav.StopAgent(); DropItemClientRpc(((Component)this).transform.position); } else { nav.DoPathingToDestination(shipNode); } } } public void RepositionAgent() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(((Component)this).transform.position, RoundManager.Instance.navHit, 5f, -1); nav.agent.Warp(navMeshPosition); if (!((Object)(object)previousPlayerHeldBy == (Object)null)) { nav.SetAllValues(!previousPlayerHeldBy.isInsideFactory); } } public override void LateUpdate() { //IL_001e: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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_0082: 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_00d9: 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) //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) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((GrabbableObject)this).parentObject != (Object)null) { ((Component)this).transform.rotation = ((GrabbableObject)this).parentObject.rotation; ((Component)this).transform.Rotate(((GrabbableObject)this).itemProperties.rotationOffset); ((Component)this).transform.position = ((GrabbableObject)this).parentObject.position; Vector3 positionOffset = ((GrabbableObject)this).itemProperties.positionOffset; positionOffset = ((GrabbableObject)this).parentObject.rotation * positionOffset; Transform transform = ((Component)this).transform; transform.position += positionOffset; } if ((Object)(object)((GrabbableObject)this).radarIcon != (Object)null) { ((GrabbableObject)this).radarIcon.position = ((Component)this).transform.position; } if ((Object)(object)heldObject != (Object)null) { ((Component)heldObject).transform.position = holdItemPosition.position; } if (isThrown && (double)((GrabbableObject)this).fallTime > 0.75 && !landing) { landing = true; itemAnimator.SetTrigger("land"); } Vector3 val = ((Component)this).transform.position - lastPosition; currentSpeed = ((Vector3)(ref val)).magnitude / Time.deltaTime; lastPosition = ((Component)this).transform.position; itemAnimator.SetFloat(hashSpeed, currentSpeed); itemAnimator.SetBool(hashSit, ((GrabbableObject)this).isHeldByEnemy); itemAnimator.SetBool(hashCarrying, (Object)(object)heldObject != (Object)null); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) nav.SetAllValues(!((GrabbableObject)this).playerHeldBy.isInsideFactory); if (((NetworkBehaviour)this).IsOwner) { ((GrabbableObject)this).playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetGrenadeThrowDestination(), true); } itemAnimator.SetTrigger("fall"); isThrown = true; } public Vector3 GetGrenadeThrowDestination() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0089: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00f3: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; grenadeThrowRay = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward); position = ((!Physics.Raycast(grenadeThrowRay, ref grenadeHit, 12f, 268437761, (QueryTriggerInteraction)1)) ? ((Ray)(ref grenadeThrowRay)).GetPoint(10f) : ((Ray)(ref grenadeThrowRay)).GetPoint(((RaycastHit)(ref grenadeHit)).distance - 0.05f)); grenadeThrowRay = new Ray(position, Vector3.down); if (Physics.Raycast(grenadeThrowRay, ref grenadeHit, 30f, 268437761, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref grenadeHit)).point + Vector3.up * 0.05f; } return ((Ray)(ref grenadeThrowRay)).GetPoint(30f); } public override void FallWithCurve() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_010e: 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_012e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((GrabbableObject)this).startFallingPosition - ((GrabbableObject)this).targetFloorPosition; float magnitude = ((Vector3)(ref val)).magnitude; ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(((GrabbableObject)this).itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, ((GrabbableObject)this).itemProperties.restingRotation.z), 14f * Time.deltaTime / magnitude); ((Component)this).transform.localPosition = Vector3.Lerp(((GrabbableObject)this).startFallingPosition, ((GrabbableObject)this).targetFloorPosition, grenadeFallCurve.Evaluate(((GrabbableObject)this).fallTime)); if (magnitude > 5f) { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurveNoBounce.Evaluate(((GrabbableObject)this).fallTime)); } else { ((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, ((GrabbableObject)this).targetFloorPosition.y, ((Component)this).transform.localPosition.z), grenadeVerticalFallCurve.Evaluate(((GrabbableObject)this).fallTime)); } ((GrabbableObject)this).fallTime = ((GrabbableObject)this).fallTime + Mathf.Abs(Time.deltaTime * 12f / magnitude); } public override void OnHitGround() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_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_0092: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"OnHitGround"); if (((NetworkBehaviour)this).IsServer && isThrown && StartOfRound.Instance.shipHasLanded) { heldObject = GetClosestItem(1f); if ((Object)(object)heldObject != (Object)null) { shipNode = RoundManager.Instance.GetNavMeshPosition(StartOfRound.Instance.insideShipPositions[5].position, RoundManager.Instance.navHit, 5f, -1); GrabItemClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)heldObject).NetworkObject)); } } landing = false; isThrown = false; } private GrabbableObject? GetClosestItem(float maxDistance) { //IL_005c: 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_00e3: 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) float num = maxDistance; GrabbableObject val = null; GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)this) && val2.grabbable && val2.grabbableToEnemies && !((GrabbableObject)this).isHeld && !((GrabbableObject)this).isHeldByEnemy) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } if ((Object)(object)val == (Object)null) { foreach (FleshDollBehavior instance in Instances) { if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance == (Object)(object)this)) { float num3 = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position); if (num3 < num) { num = num3; val = (GrabbableObject)(object)instance; } } } } return val; } [ServerRpc(RequireOwnership = false)] public void DoAnimationServerRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_0088: 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_00ff: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(447137741u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 447137741u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { DoAnimationClientRpc(animationName); } } } [ClientRpc] public void DoAnimationClientRpc(string animationName) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: 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_0088: 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_00ff: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4177460471u, val, (RpcDelivery)0); bool flag = animationName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4177460471u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; itemAnimator.SetTrigger(animationName); } } [ClientRpc] public void GrabItemClientRpc(NetworkObjectReference netRef) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: 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_007d: 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_0097: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2472264094u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2472264094u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)heldObject != (Object)null)) { NetworkObject val3 = default(NetworkObject); if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null)) { Plugin.logger.LogError((object)"Couldnt get netObj from NetworkObjectReference in GrabItemClientRpc"); return; } GrabbableObject val4 = default(GrabbableObject); if (!((Component)val3).TryGetComponent<GrabbableObject>(ref val4)) { Plugin.logger.LogError((object)"Couldnt get GrabbableObject from NetworkObject in GrabItemClientRpc"); return; } heldObject = val4; heldObject.parentObject = holdItemPosition; heldObject.hasHitGround = false; heldObject.isHeldByEnemy = true; HoarderBugAI.grabbableObjectsInMap.Remove(((Component)heldObject).gameObject); HoarderBugAI.grabbableObjectsInMap.Remove(((Component)this).gameObject); ((GrabbableObject)this).grabbable = false; heldObject.grabbable = true; ((GrabbableObject)this).grabbableToEnemies = false; heldObject.grabbableToEnemies = false; collider.enabled = false; } } [ClientRpc] public void DropItemClientRpc(Vector3 targetFloorPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: 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_0089: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(646901999u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetFloorPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 646901999u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)heldObject == (Object)null)) { GrabbableObject val3 = heldObject; val3.parentObject = null; ((Component)val3).transform.SetParent(StartOfRound.Instance.propsContainer, true); val3.fallTime = 0f; val3.startFallingPosition = ((Component)val3).transform.parent.InverseTransformPoint(((Component)val3).transform.position); val3.targetFloorPosition = ((Component)val3).transform.parent.InverseTransformPoint(targetFloorPosition); val3.floorYRot = -1; val3.DiscardItemFromEnemy(); val3.isHeldByEnemy = false; val3.grabbable = true; val3.grabbableToEnemies = true; HoarderBugAI.grabbableObjectsInMap.Add(((Component)val3).gameObject); HoarderBugAI.grabbableObjectsInMap.Add(((Component)this).gameObject); heldObject = null; ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; collider.enabled = true; } } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(447137741u, new RpcReceiveHandler(__rpc_handler_447137741), "DoAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(4177460471u, new RpcReceiveHandler(__rpc_handler_4177460471), "DoAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(2472264094u, new RpcReceiveHandler(__rpc_handler_2472264094), "GrabItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(646901999u, new RpcReceiveHandler(__rpc_handler_646901999), "DropItemClientRpc"); ((PhysicsProp)this).__initializeRpcs(); } private static void __rpc_handler_447137741(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((FleshDollBehavior)(object)target).DoAnimationServerRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4177460471(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0061: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string animationName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((FleshDollBehavior)(object)target).DoAnimationClientRpc(animationName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2472264094(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: 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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference netRef = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((FleshDollBehavior)(object)target).GrabItemClientRpc(netRef); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_646901999(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { Vector3 targetFloorPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)1; ((FleshDollBehavior)(object)target).DropItemClientRpc(targetFloorPosition); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "FleshDollBehavior"; } } public class NetworkHandlerSCP4666 : NetworkBehaviour { public static NetworkHandlerSCP4666 Instance { get; private set; } public override void OnNetworkSpawn() { if (((NetworkBehaviour)this).IsServer && (Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { ((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } ((Object)this).hideFlags = (HideFlags)61; Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } public void Update() { } [ClientRpc] private void ChangePlayerSizeClientRpc(ulong clientId, float size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_0071: 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_0090: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1820857783u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1820857783u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = Plugin.PlayerFromId(clientId); val3.thisPlayerBody.localScale = new Vector3(size, size, size); Utils.RebuildRig(val3); } } } [ServerRpc(RequireOwnership = false)] public void ChangePlayerSizeServerRpc(ulong clientId, float size) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: 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_0071: 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_0090: 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_00e9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2312655225u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientId); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref size, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2312655225u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { ChangePlayerSizeClientRpc(clientId, size); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1820857783u, new RpcReceiveHandler(__rpc_handler_1820857783), "ChangePlayerSizeClientRpc"); ((NetworkBehaviour)this).__registerRpc(2312655225u, new RpcReceiveHandler(__rpc_handler_2312655225), "ChangePlayerSizeServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1820857783(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); float size = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandlerSCP4666)(object)target).ChangePlayerSizeClientRpc(clientId, size); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2312655225(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0042: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong clientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientId); float size = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref size, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((NetworkHandlerSCP4666)(object)target).ChangePlayerSizeServerRpc(clientId, size); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "NetworkHandlerSCP4666"; } } [HarmonyPatch] public class NetworkObjectManager { private static GameObject? networkPrefab; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] public static void Init() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown if (!((Object)(object)networkPrefab != (Object)null)) { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location), "scp4666_networkhandler")); if ((Object)(object)val == (Object)null) { Plugin.logger.LogError((object)"Couldnt get assets to create network handler"); return; } networkPrefab = (GameObject)val.LoadAsset("Assets/ModAssets/NetworkHandlerSCP4666.prefab"); NetworkManager.Singleton.AddNetworkPrefab(networkPrefab); } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnNetworkHandler() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (Plugin.IsServerOrHost && !((Object)(object)networkPrefab == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); Plugin.logger.LogDebug((object)"Spawned NetworkHandlerSCP4666"); } } } [HarmonyPatch] internal class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] public static void KillPlayerPostfix(PlayerControllerB __instance) { ChildSackBehavior.OnPlayerDeath(__instance); } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "ShipLeaveAutomatically")] public static bool ShipLeaveAutomaticallyPrefix(bool leavingOnMidnight) { try { if (leavingOnMidnight) { return true; } Plugin.logger.LogDebug((object)"Ship trying to leave automatically."); ChildSackBehavior childSackBehavior = (from x in Object.FindObjectsOfType<ChildSackBehavior>() where ((GrabbableObject)x).isInShipRoom select x).FirstOrDefault(); if ((Object)(object)childSackBehavior == (Object)null) { return true; } Plugin.logger.LogDebug((object)"Sack found, attempting to stop ship leave and revive players"); StartOfRound.Instance.allPlayersDead = false; if (!Plugin.IsServerOrHost) { return false; } childSackBehavior.Activate(); return false; } catch (Exception ex) { Plugin.logger.LogError((object)ex); return true; } } } [BepInPlugin("ProjectSCP.SCP4666", "SCP4666", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class <<AllowPlayerDeathAfterDelay>g__AllowPlayerDeathAfterDelay|9_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<AllowPlayerDeathAfterDelay>g__AllowPlayerDeathAfterDelay|9_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; StartOfRound.Instance.allowLocalPlayerDeath = false; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; StartOfRound.Instance.allowLocalPlayerDeath = true; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static Plugin Instance; public static ManualLogSource logger; private readonly Harmony harmony = new Harmony("ProjectSCP.SCP4666"); public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController; public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost; public static PlayerControllerB PlayerFromId(ulong id) { return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).First(); } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = ((BaseUnityPlugin)Instance).Logger; harmony.PatchAll(); InitializeNetworkBehaviours(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP4666 v1.1.0 has loaded!"); } public void AllowPlayerDeathAfterDelay(float delay) { ((MonoBehaviour)Instance).StartCoroutine(AllowPlayerDeathAfterDelay(delay)); [IteratorStateMachine(typeof(<<AllowPlayerDeathAfterDelay>g__AllowPlayerDeathAfterDelay|9_0>d))] static IEnumerator AllowPlayerDeathAfterDelay(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<AllowPlayerDeathAfterDelay>g__AllowPlayerDeathAfterDelay|9_0>d(0) { delay = delay }; } } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } logger.LogDebug((object)"Finished initializing network behaviours"); } } public class SCP4666AI : EnemyAI { public enum State { Spawning, Chasing, Abducting } [CompilerGenerated] private sealed class <<FinishGroundSlamAnimation>g__InjureLocalPlayerCoroutine|139_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<FinishGroundSlamAnimation>g__InjureLocalPlayerCoroutine|139_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)(() => Plugin.localPlayer.thisController.isGrounded || Plugin.localPlayer.isInHangarShipRoom)); <>1__state = 1; return true; case 1: { <>1__state = -1; if (Plugin.localPlayer.isPlayerDead) { return false; } EvilFleshDollAI.onThisDamagingLocalPlayer.Invoke(); Plugin.localPlayer.DamagePlayer(30, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); PlayerControllerB localPlayer = Plugin.localPlayer; localPlayer.sprintMeter /= 2f; Plugin.localPlayer.JumpToFearLevel(0.7f, true); Plugin.localPlayer.drunkness = 0.2f; return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <<LongTeleport>g__TeleportCoroutine|112_0>d : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public Vector3 position; public bool outside; public SCP4666AI <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <<LongTeleport>g__TeleportCoroutine|112_0>d(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.PlayTeleportSFXClientRpc(); <>2__current = (object)new WaitForSeconds(2f); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.Teleport(position, outside); <>4__this.PlayLaughSFXClientRpc(); <>4__this.teleporting = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool DEBUG_allowSpawnDolls = true; private bool DEBUG_allowGroundSlam = true; private bool DEBUG_allowThrowKnife = true; private bool DEBUG_allowTeleporting = true; private bool DEBUG_allowTargettingHost = true; private bool DEBUG_allowAbducting = true; public Transform RightHandTransform; public Transform ChildSackTransform; public AudioSource MusicSource; public AudioClip FootstepSFX; public AudioClip TeleportSFX; public AudioClip LaughSFX; public AudioClip RoarSFX; public AudioClip GroundSlamSFX; public GameObject YulemanMesh; public Transform turnCompass; public GameObject evilDollPrefab; public GameObject ThrowingKnifePrefab; public Collider collider; public GameObject KnifeMesh; public ParticleSystem GroundSlamParticles; public ThrownKnifeScript thrownKnifeScript; public SmartAgentNavigator nav; public GameObject DEBUG_hudOverlay; public Camera cameraSack; public static List<EvilFleshDollAI> DollInstances = new List<EvilFleshDollAI>(); public static UnityEvent<PlayerControllerB> onPlayerGrabbed = new UnityEvent<PlayerControllerB>(); private Vector3 mainEntranceOutsidePosition; private List<EntranceTeleport> entrances = new List<EntranceTeleport>(); private List<PlayerControllerB> targetPlayers = new List<PlayerControllerB>(); private bool localPlayerHasSeenYuleman; private bool spawnedAndVisible; private bool isGrabbingPlayer; private bool isPlayerInSack; private float timeSinceDamagePlayer; private float timeSinceTeleport; private float timeSinceKnifeThrown; private float timeSinceGrabPlayer; private float timeSinceGroundSlam; private float timeSinceDollSpawning; private bool teleporting; private bool isThrowingKnife; private bool isCallingKnife; private int timesHitWhileAbducting; private int damageTakenWithoutDamaging; private int dollsToSpawn; private bool useBombDolls; private float timeSinceSwitchBehavior; private Vector3 lastPosition; private float currentSpeed; private float idleTime; private readonly Vector3 insideScale = new Vector3(1.5f, 1.5f, 1.5f); private readonly Vector3 outsideScale = new Vector3(2f, 2f, 2f); private const float attackRange = 5f; private const float attackAngle = 45f; private const float teleportCooldown = 15f; private const float teleportDistance = 10f; private const float knifeReturnCooldown = 5f; private const float knifeThrowCooldown = 10f; private const float knifeThrowMinDistance = 5f; private const float knifeThrowMaxDistance = 10f; private const float hitAmountToDropPlayer = 5f; private const int slapDamage = 10; private const int minPresentsToSpawn = 3; private const int maxPresentsToSpawn = 6; private const int minDollsToDrop = 1; private const int maxDollsToDrop = 3; private const int minDollsToSpawn = 2; private const int maxDollsToSpawn = 5; private const float dollCountMultiplier = 0.2f; private const float dollSpawningCooldown = 30f; private const float groundSlamCooldown = 15f; private const int maxDamageTakenToGroundSlam = 3; private const float groundSlamDistance = 5f; private const float groundSlamForce = 50f; private const int groundSlamDamage = 30; private const int maxHp = 30; private const float spawnTurnCompassSpeed = 20f; private const float LOSOffset = 2f; private const float grabPlayerCooldown = 10f; private const float damagePlayerCooldown = 2f; private const int playerKidnapChanceOffset = 100; private bool playBossMusic = true; private float bossMusicVolume = 0.3f; private bool canTeleport = true; private bool canSpawnDolls = true; private bool canThrowKnife = true; private bool canKidnap = true; private bool canGroundSlam = true; public static List<SCP4666AI> Instances { get; private set; } = new List<SCP4666AI>(); public bool isOutside => nav.IsAgentOutside(); public bool isInsideFactory => !isOutside; public void DEBUG_DoGroundSlam() { Plugin.logger.LogDebug((object)"Performing ground slam"); base.inSpecialAnimation = true; DoAnimationClientRpc("groundSlam"); } public override void Start() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00c5: 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) ((EnemyAI)this).Start(); Instances.Add(this); base.enemyHP = 30; base.currentBehaviourStateIndex = 0; nav.SetAllValues(true); mainEntranceOutsidePosition = RoundManager.FindMainEntrancePosition(false, true); entrances = Object.FindObjectsOfType<EntranceTeleport>(false).ToList(); thrownKnifeScript = Object.Instantiate<GameObject>(ThrowingKnifePrefab, Vector3.zero, Quaternion.identity).GetComponent<ThrownKnifeScript>(); ((UnityEvent)thrownKnifeScript.KnifeReturnedEvent).AddListener(new UnityAction(KnifeReturned)); cameraSack.cullingMask = Plugin.localPlayer.gameplayCamera.cullingMask; if (((NetworkBehaviour)this).IsServer) { if (Utils.isBeta) { Object.Instantiate<GameObject>(DEBUG_hudOverlay, Vector3.zero, Quaternion.identity); } int amount = Random.Range(3, 6); SpawnPresents(amount); Plugin.logger.LogDebug((object)"SCP-4666 Spawned"); } } private void SetConfigs() { try { SCP4666ContentHandler.SCP4666Assets sCP = ContentHandler<SCP4666ContentHandler>.Instance.SCP4666; if (sCP != null) { playBossMusic = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Play Boss Music").Value; bossMusicVolume = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<float>("Boss Music Volume").Value; canTeleport = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Can Teleport").Value; canSpawnDolls = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Can Spawn Dolls").Value; canThrowKnife = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Can Throw Knife").Value; canKidnap = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Can Kidnap").Value; canGroundSlam = ((AssetBundleLoader<SCP4666ContentHandler.SCP4666Assets>)(object)sCP).GetConfig<bool>("Can Ground Slam").Value; } } catch { Plugin.logger.LogError((object)"Couldnt load configs"); } } public override void OnDestroy() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB inSpecialAnimationWithPlayer = base.inSpecialAnimationWithPlayer; ((EnemyAI)this).CancelSpecialAnimationWithPlayer(); if ((Object)(object)inSpecialAnimationWithPlayer != (Object)null && (Object)(object)Plugin.localPlayer == (Object)(object)inSpecialAnimationWithPlayer) { StartOfRound.Instance.allowLocalPlayerDeath = true; inSpecialAnimationWithPlayer.KillPlayer(Vector3.zero, false, (CauseOfDeath)0, 0, default(Vector3)); } foreach (EvilFleshDollAI dollInstance in DollInstances) { if (!((Object)(object)dollInstance == (Object)null)) { ((NetworkBehaviour)dollInstance).NetworkObject.Despawn(true); } } DollInstances.Clear(); ThrownKnifeScript obj = thrownKnifeScript; Object.Destroy((Object)(object)((obj != null) ? ((Component)obj).gameObject : null)); MusicSource.Stop(); Instances.Remove(this); ((EnemyAI)this).OnDestroy(); } public void SpawnPresents(int amount) { //IL_003d: 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_0052: 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_005a: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); for (int i = 0; i < amount; i++) { Item item = ((Registry<DawnItemInfo>)(object)LethalContent.Items)[ItemKeys.Gift].Item; Vector3 randomPositionInRadius = RoundManager.Instance.GetRandomPositionInRadius(((Component)this).transform.position, 1f, 1.5f, random); GiftBoxItem componentInChildren = Object.Instantiate<GameObject>(item.spawnPrefab, randomPositionInRadius, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform).GetComponentInChildren<GiftBoxItem>(); ((NetworkBehaviour)componentInChildren).NetworkObject.Spawn(true); } } public void CustomEnemyAIUpdate() { if (((NetworkBehaviour)this).IsServer) { if (base.inSpecialAnimation) { nav.StopAgent(); return; } if (base.updateDestinationInterval >= 0f) { base.updateDestinationInterval -= Time.deltaTime; return; } ((EnemyAI)this).DoAIInterval(); base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f); } } public override void Update() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead) { return; } CustomEnemyAIUpdate(); if (!spawnedAndVisible) { return; } timeSinceDamagePlayer += Time.deltaTime; timeSinceTeleport += Time.deltaTime; timeSinceKnifeThrown += Time.deltaTime; timeSinceGrabPlayer += Time.deltaTime; timeSinceGroundSlam += Time.deltaTime; timeSinceDollSpawning += Time.deltaTime; timeSinceSwitchBehavior += Time.deltaTime; if (base.currentBehaviourStateIndex == 0) { turnCompass.LookAt(((Component)Plugin.localPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y - 90f, 0f)), 20f * Time.deltaTime); } if ((Object)(object)Plugin.localPlayer != (Object)(object)base.inSpecialAnimationWithPlayer && Plugin.localPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 2f, 45f, 60, -1f)) { Plugin.localPlayer.IncreaseFearLevelOverTime(0.1f, 0.5f); if (!localPlayerHasSeenYuleman) { localPlayerHasSeenYuleman = true; AddTargetPlayerServerRpc(Plugin.localPlayer.actualClientId); } } if (targetPlayers.Contains(Plugin.localPlayer) && playBossMusic) { if (!MusicSource.isPlaying) { MusicSource.volume = bossMusicVolume; MusicSource.Play(); } } else if (MusicSource.isPlaying) { MusicSource.Stop(); } } public void LateUpdate() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null) { if (isGrabbingPlayer) { ((Component)base.inSpecialAnimationWithPlayer).transform.position = RightHandTransform.position; base.inSpecialAnimationWithPlayer.takingFallDamage = false; } if (isPlayerInSack) { ((Component)base.inSpecialAnimationWithPlayer).transform.position = ChildSackTransform.position; base.inSpecialAnimationWithPlayer.takingFallDamage = false; } } Vector3 val = ((Component)this).transform.position - lastPosition; currentSpeed = ((Vector3)(ref val)).magnitude / Time.deltaTime / 2f; lastPosition = ((Component)this).transform.position; idleTime = ((currentSpeed <= 0f) ? (idleTime + Time.deltaTime) : 0f); } public override void DoAIInterval() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: 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) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) if (base.moveTowardsDestination) { base.agent.SetDestination(base.destination); } UpdateTestingHUD(); switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 0f; if (!spawnedAndVisible && !InLineOfSight()) { spawnedAndVisible = true; BecomeVisibleClientRpc(); } break; case 1: base.agent.speed = 5f; if (!TargetClosestPlayer()) { SwitchToBehaviourClientRpc(2); break; } if (canTeleport && CanDoSpecialAction() && timeSinceTeleport > 15f && Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) > 10f && (!Utils.isBeta || DEBUG_allowTeleporting)) { GameObject closestNodeBehindPlayer = GetClosestNodeBehindPlayer(base.targetPlayer, 1f); if ((Object)(object)closestNodeBehindPlayer != (Object)null) { LongTeleport(closestNodeBehindPlayer.transform.position, base.targetPlayer.isInsideFactory); break; } } if (canSpawnDolls && CanDoSpecialAction() && timeSinceDollSpawning > 30f && (!Utils.isBeta || DEBUG_allowSpawnDolls)) { Plugin.logger.LogDebug((object)"Spawning dolls"); timeSinceDollSpawning = 0f; dollsToSpawn = (int)((float)Random.Range(2, 6) * ((float)targetPlayers.Count * 0.2f + 1f)); base.inSpecialAnimation = true; DoAnimationClientRpc("spawnDoll"); break; } if (isThrowingKnife && !isCallingKnife && timeSinceKnifeThrown > 5f) { Plugin.logger.LogDebug((object)("KnifeThrown: " + isThrowingKnife)); isCallingKnife = true; DoAnimationClientRpc("call"); break; } if (canThrowKnife && CanDoSpecialAction() && timeSinceKnifeThrown > 10f && (!Utils.isBeta || DEBUG_allowThrowKnife)) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position); if (num > 5f && num < 10f) { timeSinceKnifeThrown = 0f; base.inSpecialAnimation = true; ((Component)this).transform.LookAt(((Component)base.targetPlayer).transform.position); ThrowKnifeClientRpc(base.targetPlayer.actualClientId); break; } } if (!((Object)(object)base.targetPlayer == (Object)null)) { ((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false); } break; case 2: base.agent.speed = 4f; if (!isPlayerInSack && TargetClosestPlayer()) { SwitchToBehaviourClientRpc(1); } else if (Vector3.Distance(((Component)this).transform.position, base.targetNode.position) < 1f) { RoundManager.Instance.SpawnedEnemies.Remove((EnemyAI)(object)this); ((NetworkBehaviour)this).NetworkObject.Despawn(true); } else if (idleTime > 2f) { GameObject closestToPosition = Utils.outsideAINodes.GetClosestToPosition(((Component)this).transform.position, (GameObject x) => x.transform.position); if (!((Object)(object)closestToPosition == (Object)null)) { LongTeleport(closestToPosition.transform.position, outside: true); } } break; default: Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex)); break; } } public void SpectateYuleman(bool value) { ((Component)cameraSack).gameObject.SetActive(value); StartOfRound.Instance.SwitchCamera((Camera)(value ? ((object)cameraSack) : ((object)Plugin.localPlayer.gameplayCamera))); Plugin.logger.LogDebug((object)("Spectate Yuleman: " + value)); } private bool CanKidnapPlayer(PlayerControllerB player) { if (timeSinceGrabPlayer < 10f) { return false; } if (!CanDoSpecialAction()) { return false; } if (isPlayerInSack) { return false; } if (Utils.IsPlayerChild(player)) { return true; } if (Random.Range(0, base.enemyHP + 100) == 0) { return true; } return false; } private void UpdateTestingHUD() { if (Utils.isBeta && (Object)(object)TestingHUDOverlay.Instance != (Object)null) { Text label = TestingHUDOverlay.Instance.label1; State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex; label.text = currentBehaviourStateIndex.ToString(); TestingHUDOverlay.Instance.label2.text = "TargetPlayer: " + base.targetPlayer?.playerUsername; TestingHUDOverlay.Instance.label3.text = ""; TestingHUDOverlay.Instance.toggle1.isOn = isOutside; TestingHUDOverlay.Instance.toggle1Label.text = "isOutside"; TestingHUDOverlay.Instance.toggle2.isOn = base.inSpecialAnimation; TestingHUDOverlay.Instance.toggle2Label.text = "inSpecialAnimation"; } } private bool CanDoSpecialAction() { return !isThrowingKnife && !isCallingKnife && !base.inSpecialAnimation && !teleporting && !isGrabbingPlayer; } public void Teleport(Vector3 position, bool outside) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 5f, -1); base.agent.Warp(position); ((Component)this).transform.position = position; nav.SetAllValues(outside); teleporting = false; } public void LongTeleport(Vector3 position, bool outside) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"Teleporting..."); teleporting = true; timeSinceTeleport = 0f; ((MonoBehaviour)this).StartCoroutine(TeleportCoroutine(position, outside)); [IteratorStateMachine(typeof(<<LongTeleport>g__TeleportCoroutine|112_0>d))] IEnumerator TeleportCoroutine(Vector3 position, bool outside) { //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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <<LongTeleport>g__TeleportCoroutine|112_0>d(0) { <>4__this = this, position = position, outside = outside }; } } private GameObject? GetClosestNodeBehindPlayer(PlayerControllerB player, float minDistance) { //IL_001e: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008d: 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_0096: 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_009a: 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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) GameObject result = null; GameObject[] array = (player.isInsideFactory ? Utils.insideAINodes : Utils.outsideAINodes); float num = Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position); GameObject[] array2 = array; foreach (GameObject val in array2) { if ((Object)(object)val == (Object)null) { continue; } Vector3 forward = ((Component)player.gameplayCamera).transform.forward; Vector3 val2 = val.transform.position - ((Component)player.gameplayCamera).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (!(Vector3.Dot(forward, normalized) > 0.6f)) { float num2 = Vector3.Distance(val.transform.position, ((Component)player).transform.position); if (!(num2 < minDistance) && num2 < num) { num = num2; result = val; } } } return result; } private bool InLineOfSight() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (PlayerIsTargetable(val) && val.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 2f, 45f, 60, -1f)) { return true; } } return false; } public bool TargetClosestPlayer(float bufferDistance = 1.5f, bool requireLineOfSight = false, float viewWidth = 70f) { //IL_006e: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = float.PositiveInfinity; PlayerControllerB targetPlayer = base.targetPlayer; base.targetPlayer = null; foreach (PlayerControllerB item in targetPlayers.ToList()) { if ((!Utils.isBeta || DEBUG_allowTargettingHost || !item.isHostPlayerObject) && PlayerIsTargetable(item)) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = item; } } } if ((Object)(object)base.targetPlayer != (Object)null && bufferDistance > 0f && (Object)(object)targetPlayer != (Object)null && Mathf.Abs(base.mostOptimalDistance - Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position)) < bufferDistance) { base.targetPlayer = targetPlayer; } return (Object)(object)base.targetPlayer != (Object)null; } public bool PlayerIsTargetable(PlayerControllerB playerScript) { return playerScript.isPlayerControlled && !playerScript.isPlayerDead && (Object)(object)playerScript.inAnimationWithEnemy == (Object)null && playerScript.sinkingValue < 0.73f; } private void LaunchPlayer(PlayerControllerB player, Vector3 direction) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) player.playerRigidbody.isKinematic = false; player.playerRigidbody.velocity = Vector3.zero; player.externalForceAutoFade += direction; player.playerRigidbody.isKinematic = true; } public void KnifeReturned() { isCallingKnife = false; isThrowingKnife = false; timeSinceKnifeThrown = 0f; MakeKnifeVisible(); } public override void KillEnemy(bool destroy = false) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0088: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Plugin.logger.LogDebug((object)"KillEnemy()"); ((EnemyAI)this).CancelSpecialAnimationWithPlayer(); ((Behaviour)thrownKnifeScript).enabled = false; MakeKnifeInvisible(); targetPlayers.Clear(); MusicSource.Stop(); if (((NetworkBehaviour)this).IsServer) { Utils.SpawnItem(SCP4666Keys.YulemanKnife, ((Component)this).transform.position); Utils.SpawnItem(SCP4666Keys.ChildSack, ((Component)this).transform.position); int num = Random.Range(1, 4); for (int i = 0; i < num; i++) { Utils.SpawnItem(SCP4666Keys.FleshDoll, ((Component)this).transform.position); } } ((EnemyAI)this).KillEnemy(destroy); } public override void HitEnemy(int force = 0, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1) { Plugin.logger.LogDebug((object)"HitEnemy()"); if (base.isEnemyDead) { return; } base.enemyHP -= force; Plugin.logger.LogDebug((object)("hp: " + base.enemyHP)); if (base.enemyHP <= 0) { Plugin.logger.LogDebug((object)"Attempt killing yuleman on server"); ((EnemyAI)this).KillEnemyOnOwne