Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SCP3166 v1.1.1
plugins/ProjectSCP.SCP3166.dll
Decompiled a month agousing 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.Logging; using Dawn; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using PSCPLibrary; using PSCPLibrary.Interfaces; using ProjectSCP.SCP3166.NetcodePatcher; using SnowyLib; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; 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: AssemblyCompany("ProjectSCP.SCP3166")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+576fe6dae8d5d17213eb46912f50d0c9a1de3724")] [assembly: AssemblyProduct("SCP3166")] [assembly: AssemblyTitle("ProjectSCP.SCP3166")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 SCP3166 { internal class GarfieldPhoneBehavior : PhysicsProp { public enum State { Off, Main, Orbit } public AudioSource audioSource = null; public AudioClip welcomeSFX = null; public AudioClip pingSFX = null; public TextMeshProUGUI gorefieldDistanceText = null; public TextMeshProUGUI closestLasagnaText = null; public TextMeshProUGUI locatingLasagnaText = null; public GameObject flashlightIcon = null; public Slider batterySlider = null; public SpriteRenderer gorefieldStatusRenderer = null; public GameObject mainPanel = null; public GameObject orbitPanel = null; [HideInInspector] public SCP3166AI? trackingInstance; private PlayerControllerB? previousPlayerHeldBy; [HideInInspector] public State CurrentState = State.Off; private bool flashlightToggle; private const int flashlightID = 1; private bool scanningForLasagna; private const float lasagnaDetectorTime = 5f; private const float lasagnaLocatorScanTime = 3f; public void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).itemProperties.positionOffset = new Vector3(0.15f, 0.1f, -0.1f); ((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(180f, 0f, 0f); } public override void Start() { ((GrabbableObject)this).Start(); SwitchState(State.Off); ((GrabbableObject)this).insertedBattery.charge = 1f; } public override void Update() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); batterySlider.value = ((GrabbableObject)this).insertedBattery.charge; if (StartOfRound.Instance.inShipPhase && CurrentState != State.Orbit && CurrentState != State.Off) { SwitchState(State.Orbit); } if (CurrentState == State.Main) { trackingInstance = IEnumerableExtensions.GetClosestToPosition<SCP3166AI>((IEnumerable<SCP3166AI>)SCP3166AI.Instances, ((Component)this).transform.position, (Func<SCP3166AI, Vector3>)((SCP3166AI x) => ((Component)x).transform.position), false, (IEnumerable<SCP3166AI>)null); float closestLasagnaDistance = GetClosestLasagnaDistance(2000f); if (closestLasagnaDistance == -1f) { ((TMP_Text)closestLasagnaText).text = "Closest Lasagna: N/A"; } else { ((TMP_Text)closestLasagnaText).text = "Closest Lasagna: " + closestLasagnaDistance.ToString("F1"); } if ((Object)(object)trackingInstance != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && ((GrabbableObject)this).isInFactory) { ((TMP_Text)gorefieldDistanceText).text = "Distance To Gorefield: " + Vector3.Distance(((Component)((GrabbableObject)this).playerHeldBy).transform.position, ((Component)trackingInstance).gameObject.transform.position).ToString("F1"); } else { ((TMP_Text)gorefieldDistanceText).text = "Distance To Gorefield: N/A"; } } } public override void ItemActivate(bool used, bool buttonDown = true) { if (buttonDown && CurrentState == State.Main && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { flashlightToggle = !flashlightToggle; flashlightIcon.SetActive(flashlightToggle); ((GrabbableObject)this).playerHeldBy.ChangeHelmetLight(1, flashlightToggle); ((GrabbableObject)this).UseItemBatteries(false, true); } } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; if (!((Object)(object)Plugin.localPlayer != (Object)(object)((GrabbableObject)this).playerHeldBy)) { HUDManager.Instance.DisplayTip("Phone Tip", "Press 'E' to show lasagna through walls. Read tooltips at top right for more.", false, true, "GP_Phone_Tip1"); } } } public override void PocketItem() { SwitchState(State.Off); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; ((GrabbableObject)this).PocketItem(); } public override void DiscardItem() { flashlightToggle = false; flashlightIcon.SetActive(flashlightToggle); previousPlayerHeldBy.ChangeHelmetLight(1, flashlightToggle); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; ((GrabbableObject)this).DiscardItem(); } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); SwitchState(State.Off); } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || scanningForLasagna || ((GrabbableObject)this).insertedBattery.empty) { return; } if (!right) { Plugin.logger.LogDebug((object)"Toggle power"); if (CurrentState == State.Off) { if (StartOfRound.Instance.inShipPhase) { SwitchState(State.Orbit); } else { SwitchState(State.Main); } } else { SwitchState(State.Off); } } else { Plugin.logger.LogDebug((object)"Locate lasagna"); if (!StartOfRound.Instance.inShipPhase && ((GrabbableObject)this).playerHeldBy.isInsideFactory && CurrentState != State.Off) { scanningForLasagna = true; ((MonoBehaviour)this).StartCoroutine(LocateLasagnaCoroutine()); } } } private IEnumerator LocateLasagnaCoroutine() { float waitTimeIntervals = 1f; ((TMP_Text)locatingLasagnaText).text = "Locating Lasagna"; yield return (object)new WaitForSeconds(waitTimeIntervals); ((TMP_Text)locatingLasagnaText).text = "Locating Lasagna."; yield return (object)new WaitForSeconds(waitTimeIntervals); ((TMP_Text)locatingLasagnaText).text = "Locating Lasagna.."; yield return (object)new WaitForSeconds(waitTimeIntervals); ((TMP_Text)locatingLasagnaText).text = "Locating Lasagna..."; yield return (object)new WaitForSeconds(1f); if ((Object)(object)Plugin.localPlayer == (Object)(object)previousPlayerHeldBy) { foreach (LasagnaBehavior lasagna in LasagnaBehavior.Instances) { lasagna.ShowLocation(5f); } } ((TMP_Text)locatingLasagnaText).text = $"Found {LasagnaBehavior.Instances.Count} lasagna"; yield return (object)new WaitForSeconds(5f); ((TMP_Text)locatingLasagnaText).text = ""; scanningForLasagna = false; } public void SwitchState(State state) { Plugin.logger.LogDebug((object)("Switching state to " + state)); State currentState = CurrentState; CurrentState = state; mainPanel.SetActive(false); orbitPanel.SetActive(false); switch (CurrentState) { case State.Off: ((GrabbableObject)this).UseItemBatteries(false, false); flashlightToggle = false; flashlightIcon.SetActive(flashlightToggle); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { ((GrabbableObject)this).playerHeldBy.ChangeHelmetLight(1, flashlightToggle); } break; case State.Main: mainPanel.SetActive(true); ((GrabbableObject)this).UseItemBatteries(false, true); if (currentState != State.Off) { } break; case State.Orbit: orbitPanel.SetActive(true); ((GrabbableObject)this).UseItemBatteries(false, true); break; } } private float GetClosestLasagnaDistance(float maxDistance) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) float num = maxDistance; foreach (LasagnaBehavior instance in LasagnaBehavior.Instances) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)instance).transform.position); if (!(num2 > num)) { num = num2; } } if (num == maxDistance) { return -1f; } return num; } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GarfieldPhoneBehavior"; } } internal class GarfieldPhoneStatusAnimator : MonoBehaviour { public GarfieldPhoneBehavior mainScript = null; public Animator animator = null; public void Update() { if ((Object)(object)mainScript.trackingInstance != (Object)null) { animator.SetInteger("state", ((EnemyAI)mainScript.trackingInstance).currentBehaviourStateIndex); } else { animator.SetInteger("state", -1); } } } public class LasagnaBehavior : PhysicsProp { public Material mainMaterial = null; public Material overlayMaterial = null; private float showLasagnaTimer; private bool showingLasagna; public static List<LasagnaBehavior> Instances { get; private set; } = new List<LasagnaBehavior>(); public override void Start() { ((GrabbableObject)this).Start(); Instances.Add(this); } public override void Update() { ((GrabbableObject)this).Update(); if (((GrabbableObject)this).isHeld) { if (showingLasagna) { showLasagnaTimer = 0f; ShowLocation(value: false); } } else if (showLasagnaTimer > 0f) { showLasagnaTimer -= Time.deltaTime; } else if (showingLasagna) { ShowLocation(value: false); } } public override void OnDestroy() { ((GrabbableObject)this).OnDestroy(); Instances.Remove(this); } public void ShowLocation(float time) { showLasagnaTimer = time; ShowLocation(value: true); } public void ShowLocation(bool value) { if (((GrabbableObject)this).isHeld) { value = false; } if (value != showingLasagna) { ((Renderer)((GrabbableObject)this).mainObjectRenderer).material = (value ? overlayMaterial : mainMaterial); showingLasagna = value; } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } protected override void __initializeRpcs() { ((PhysicsProp)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LasagnaBehavior"; } } [BepInPlugin("ProjectSCP.SCP3166", "SCP3166", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("ProjectSCP.SCP3166"); public static Plugin PluginInstance { get; private set; } public static ManualLogSource logger { get; private set; } public static DuskMod Mod { get; private set; } public static SCPDatabase SCPDatabase { get; private set; } public static PlayerControllerB localPlayer => StartOfRound.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).FirstOrDefault(); } private void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } logger = ((BaseUnityPlugin)PluginInstance).Logger; harmony.PatchAll(); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp3166_mainassets")); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); if (ContentHandler<SCP3166ContentHandler>.Instance.SCP3166 != null) { SCPAPI.Register(ContentHandler<SCP3166ContentHandler>.Instance.SCP3166.SCPInfo); } InitializeNetworkBehaviours(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP3166 v1.1.1 has loaded!"); } 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"); } } internal class SCP3166AI : EnemyAI, ISCP { public enum State { Roaming, Following, Hunger, Rage } public SCPInfo scpInfo = null; public MeshRenderer lasagnaRenderer = null; public Transform turnCompass = null; public InteractTrigger lasagnaTrigger = null; public Transform eatingPlayerTransform = null; public AudioClip eatingPlayerSFX = null; public AudioClip eatingLasagnaSFX = null; public AudioClip[] footstepSFX = null; public AudioClip[] foundPlayerSFX = null; public AudioClip[] demandLasagnaSFX = null; public AudioClip[] halfHungerSFX = null; public AudioClip[] smellsLasagnaSFX = null; public AudioClip[] followingChatterSFX = null; public AudioClip[] rageChatterSFX = null; public AudioClip[] startRageSFX = null; public AudioClip[] postEatingLasagnaSFX = null; public AudioClip[] postEatingPlayerSFX = null; public AudioClip[] hurtByPlayerSFX = null; public AudioClip[] shotByPlayerSFX = null; private SmartAgentNavigator nav = null; private Random random = null; private NetworkVariable<ulong> targetPlayerId = new NetworkVariable<ulong>(0uL, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0); public Dictionary<string, AudioClip[]> voiceLines = new Dictionary<string, AudioClip[]>(); private float timeSinceSwitchBehavior; private float timeSinceEatingLasagna; private float timeSinceDemandLasagna; private float timeSinceDamagePlayer; private float timeSinceFollowPlayer; private float timeSinceChatter; private float nextChatterTime = 10f; private float hungerMultiplier = 1f; private bool playedHalfHungerSFX; private bool targetPlayerHasLasagna; private bool reachedPlayerWithLasagna; private float idleTime; private float currentSpeed; private Vector3 lastPosition; private int gorefieldDamage; private float currentSearchRadius; private bool searching; private int hashSpeed; private const float followDistance = 5f; private const int demandLasagnaVLAmount = 5; private readonly BoundedRange followChatterCooldown = new BoundedRange(30f, 60f); private readonly BoundedRange chaseChatterCooldown = new BoundedRange(10f, 20f); private const float lasagnaHeldHungerMultiplierIncrease = 0.5f; private const float followPlayerCooldown = 10f; SCPInfo ISCP.SCPInfo => scpInfo; public static List<SCP3166AI> Instances { get; private set; } = new List<SCP3166AI>(); private PlayerControllerB? targetPlayer { get { return Plugin.PlayerFromId(targetPlayerId.Value); } set { targetPlayerId.Value = (((Object)(object)value != (Object)null) ? value.actualClientId : 0); } } public float Size { get { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.localScale.y; } private set { //IL_000a: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localScale = new Vector3(value, value, value); } } private float halfwayToRageTime => HungerPhaseCooldown + RagePhaseCooldown / 2f; private float demandLasagnaCooldown => RagePhaseCooldown / 5f; public bool isOutside => nav.IsAgentOutside(); public bool isInsideFactory => !isOutside; private float sniffDistance => 6f; private static bool SpawnLasagnaWhenSpawned => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<bool>("SCP-3166 Options", "Spawn Lasagna When Spawned", true, "If enabled, Gorefield will spawn lasagna around the dungeon when he spawns").Value; private static bool ShowLasagnaInHungerPhase => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<bool>("SCP-3166 Options", "Show Lasagna In Hunger Phase", true, "Show lasagna through walls when gorefield enters his hunger or rage phase for the player whos targetted/followed").Value; private static int SpawnLasagnaAmount => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<int>("SCP-3166 Options", "Spawn Lasagna Amount", 5, "Amount of lasagna Gorefield spawns when he spawns").Value; private static int StartDamage => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<int>("SCP-3166 Options", "Start Damage", 20, "Base damage Gorefield deals").Value; private static int DamageIncreasePerLasagna => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<int>("SCP-3166 Options", "Damage Increase Per Lasagna", 8, "Damage increase per lasagna eaten").Value; private static float HungerPhaseCooldown => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Hunger Phase Cooldown", 60f, "Cooldown before Gorefield enters hunger phase (seconds)").Value; private static float RagePhaseCooldown => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Rage Phase Cooldown", 60f, "Cooldown before Gorefield enters hunger rage phase after the hunger phase (seconds)").Value; private static float DistanceToLoseGorefield => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Distance To Lose Gorefield", 20f, "Distance required to lose Gorefield").Value; private static float StartingSize => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Starting Size", 1f, "Initial size of Gorefield").Value; private static float MaxSize => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Max Size", 2f, "Maximum size Gorefield can reach").Value; private static float SizeIncreasePerLasagna => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Size Increase Per Lasagna", 0.1f, "Size increase per lasagna eaten").Value; private static float TimeToEat => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Time To Eat", 10f, "Time it takes Gorefield to eat a lasagna or player (seconds)").Value; private static float HungerMultiplierIncreasePerLasagna => ((BaseUnityPlugin)Plugin.PluginInstance).Config.Bind<float>("SCP-3166 Options", "Hunger Multiplier Increase Per Lasagna", 0.05f, "Hunger multiplier increase per lasagna eaten").Value; [StaticInit] public static void InitConfigs() { _ = SpawnLasagnaWhenSpawned; _ = ShowLasagnaInHungerPhase; _ = SpawnLasagnaAmount; _ = StartDamage; _ = DamageIncreasePerLasagna; _ = HungerPhaseCooldown; _ = RagePhaseCooldown; _ = DistanceToLoseGorefield; _ = StartingSize; _ = MaxSize; _ = SizeIncreasePerLasagna; _ = TimeToEat; _ = HungerMultiplierIncreasePerLasagna; } public override void Awake() { nav = ((Component)this).GetComponent<SmartAgentNavigator>(); ((EnemyAI)this).Awake(); } public override void Start() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Instances.Add(this); nav.SetAllValues(false); base.allAINodes = Utils.allAINodes; base.overlapColliders = (Collider[])(object)new Collider[1]; base.thisNetworkObject = ((NetworkBehaviour)this).NetworkObject; base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene; random = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex); RoundManager instance = RoundManager.Instance; instance.numberOfEnemiesInScene++; if (!((NetworkBehaviour)this).IsServer) { RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this); } base.path1 = new NavMeshPath(); base.enemyType.doorSpeedMultiplier = 1f; base.openDoorSpeedMultiplier = 1f; base.serverPosition = ((Component)this).transform.position; base.ventAnimationFinished = true; base.currentBehaviourStateIndex = 0; hashSpeed = Animator.StringToHash("speed"); Size = StartingSize; gorefieldDamage = StartDamage; voiceLines.Add("FoundPlayerSFX", foundPlayerSFX); voiceLines.Add("DemandLasagnaSFX", demandLasagnaSFX); voiceLines.Add("HalfHungerSFX", halfHungerSFX); voiceLines.Add("SmellsLasagnaSFX", smellsLasagnaSFX); voiceLines.Add("FollowingChatterSFX", followingChatterSFX); voiceLines.Add("RageChatterSFX", rageChatterSFX); voiceLines.Add("StartRageSFX", startRageSFX); voiceLines.Add("PostEatingLasagnaSFX", postEatingLasagnaSFX); voiceLines.Add("PostEatingPlayerSFX", postEatingPlayerSFX); voiceLines.Add("HurtByPlayerSFX", hurtByPlayerSFX); voiceLines.Add("ShotByPlayerSFX", shotByPlayerSFX); if (((NetworkBehaviour)this).IsServer && SpawnLasagnaWhenSpawned) { SpawnLasagna(SpawnLasagnaAmount); } } public override void OnDestroy() { Instances.Remove(this); ((EnemyAI)this).OnDestroy(); } public override void Update() { if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation) { return; } timeSinceSwitchBehavior += Time.deltaTime; timeSinceDamagePlayer += Time.deltaTime; timeSinceFollowPlayer += Time.deltaTime; timeSinceChatter += Time.deltaTime; lasagnaTrigger.interactable = PlayerHasLasagna(Plugin.localPlayer, checkIfHolding: true); ShowLasagnaIfPlayerTargetted(); if (((NetworkBehaviour)this).IsServer) { float num = (targetPlayerHasLasagna ? (hungerMultiplier + 0.5f) : hungerMultiplier); timeSinceEatingLasagna += Time.deltaTime * num; timeSinceDemandLasagna += Time.deltaTime * num; if (base.updateDestinationInterval >= 0f) { base.updateDestinationInterval -= Time.deltaTime; return; } ((EnemyAI)this).DoAIInterval(); base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f); } } public void LateUpdate() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = ((Component)this).transform.position - lastPosition; currentSpeed = ((Vector3)(ref val)).magnitude / Time.deltaTime / 2f; lastPosition = ((Component)this).transform.position; base.creatureAnimator.SetFloat(hashSpeed, currentSpeed); idleTime = ((currentSpeed <= 0f) ? (idleTime + Time.deltaTime) : 0f); } public override void DoAIInterval() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_02b2: Unknown result type (might be due to invalid IL or missing references) switch (base.currentBehaviourStateIndex) { case 0: base.agent.speed = 5f; base.agent.stoppingDistance = 0f; if (timeSinceFollowPlayer > 10f && TargetClosestPlayer(DistanceToLoseGorefield, requireLineOfSight: true)) { SwitchToBehaviourClientRpc(1); } else if (timeSinceEatingLasagna > HungerPhaseCooldown) { SwitchToBehaviourClientRpc(2); } break; case 1: base.agent.speed = 5f; base.agent.stoppingDistance = 5f; if (timeSinceEatingLasagna > HungerPhaseCooldown) { SwitchToBehaviourClientRpc(2); } else if (!TargetClosestPlayer(DistanceToLoseGorefield) || !SetDestinationToPosition(((Component)targetPlayer).transform.position)) { Plugin.logger.LogDebug((object)"Following: Lost target player..."); targetPlayer = null; timeSinceFollowPlayer = 0f; SwitchToBehaviourClientRpc(0); } else if (targetPlayerHasLasagna && !reachedPlayerWithLasagna && Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position) < sniffDistance) { reachedPlayerWithLasagna = true; DoAnimationClientRpc("smell"); PlayClip("SmellsLasagnaSFX"); } else if (timeSinceChatter > nextChatterTime) { timeSinceChatter = 0f; nextChatterTime = followChatterCooldown.GetRandomInRange(random); PlayClip("FollowingChatterSFX"); } break; case 2: base.agent.speed = 6f; base.agent.stoppingDistance = 5f; if (timeSinceEatingLasagna > RagePhaseCooldown + HungerPhaseCooldown) { SwitchToBehaviourClientRpc(3); } else if (TargetClosestPlayer(float.PositiveInfinity) && (Object)(object)targetPlayer != (Object)null && SetDestinationToPosition(((Component)targetPlayer).transform.position)) { StopSearch(); if (targetPlayerHasLasagna && !reachedPlayerWithLasagna && Vector3.Distance(((Component)this).transform.position, ((Component)targetPlayer).transform.position) < sniffDistance) { reachedPlayerWithLasagna = true; DoAnimationClientRpc("smell"); PlayClip("SmellsLasagnaSFX"); break; } if (timeSinceEatingLasagna > halfwayToRageTime && !playedHalfHungerSFX) { playedHalfHungerSFX = true; timeSinceDemandLasagna = 0f; PlayClip("HalfHungerSFX"); } if (timeSinceDemandLasagna > demandLasagnaCooldown) { timeSinceDemandLasagna = 0f; PlayClip("DemandLasagnaSFX"); } } else { StartSearch(500f); } break; case 3: base.agent.speed = 10f; base.agent.stoppingDistance = 0f; if (CheckForDeadBodies(3f)) { base.inSpecialAnimation = true; EatPlayerClientRpc(targetPlayer.actualClientId); } else if (TargetClosestPlayer(float.PositiveInfinity) && SetDestinationToPosition(((Component)targetPlayer).transform.position)) { StopSearch(); if (timeSinceChatter > nextChatterTime) { timeSinceChatter = 0f; nextChatterTime = chaseChatterCooldown.GetRandomInRange(random); PlayClip("RageChatterSFX"); } } else { StartSearch(500f); } break; default: Plugin.logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex)); break; } } public void StartSearch(float radius) { if (!searching || radius != currentSearchRadius) { Plugin.logger.LogDebug((object)"Start search"); nav.StopSearchRoutine(); nav.StartSearchRoutine(radius); currentSearchRadius = radius; searching = true; } } public void StopSearch() { if (searching) { Plugin.logger.LogDebug((object)"Stop search"); nav.StopSearchRoutine(); searching = false; } } public bool SetDestinationToPosition(Vector3 position, bool checkForPath = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 if (checkForPath && !Utils.SmartCanPathToPoint(((Component)this).transform.position, position, nav.IsAgentOutside())) { return false; } GoToDestinationResult val = default(GoToDestinationResult); nav.TryDoPathingToDestination(position, ref val); return (int)val == 0 || (int)val == 1; } public bool CheckForDeadBodies(float range) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.isPlayerDead && !((Object)(object)val.deadBody == (Object)null) && !(Vector3.Distance(((Component)this).transform.position, ((Component)val.deadBody).transform.position) > range)) { targetPlayer = val; return true; } } return false; } public void SpawnLasagna(int amount = 1) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < amount; i++) { Vector3 position = IEnumerableExtensions.GetRandom<GameObject>((IEnumerable<GameObject>)Utils.allAINodes).transform.position; Utils.SpawnItem(SCP3166Keys.Lasagna, position, default(Quaternion), (Transform)null, false, (Action<GrabbableObject>)null); } } public bool TargetClosestPlayer(float mostOptimalDistance, bool requireLineOfSight = false, float viewWidth = 70f) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) targetPlayer = null; targetPlayerHasLasagna = false; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (((EnemyAI)this).PlayerIsTargetable(val, false, false, true) && PlayerHasLasagna(val)) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position); if (base.tempDist < mostOptimalDistance) { mostOptimalDistance = base.tempDist; targetPlayer = val; targetPlayerHasLasagna = true; } } } if ((Object)(object)targetPlayer == (Object)null) { PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts2) { if (((EnemyAI)this).PlayerIsTargetable(val2, false, false, true) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)val2.gameplayCamera).transform.position, viewWidth, 40, -1f, (Transform)null))) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position); if (base.tempDist < mostOptimalDistance) { mostOptimalDistance = base.tempDist; targetPlayer = val2; } } } } return (Object)(object)targetPlayer != (Object)null; } private void ShowLasagnaIfPlayerTargetted() { if (!ShowLasagnaInHungerPhase || !((Object)(object)targetPlayer != (Object)null) || !((Object)(object)targetPlayer == (Object)(object)Plugin.localPlayer) || (base.currentBehaviourStateIndex != 2 && base.currentBehaviourStateIndex != 3)) { return; } foreach (LasagnaBehavior item in LasagnaBehavior.Instances.ToList()) { item.ShowLocation(10f); } } private bool PlayerHasLasagna(PlayerControllerB player, bool checkIfHolding = false) { if ((Object)(object)player.currentlyHeldObjectServer != (Object)null && ((Object)player.currentlyHeldObjectServer.itemProperties).name == ((Object)((Registry<DawnItemInfo>)(object)LethalContent.Items)[SCP3166Keys.Lasagna].Item).name) { return true; } if (checkIfHolding) { return false; } foreach (GrabbableObject item in player.ItemSlots.ToList()) { if ((Object)(object)item != (Object)null && ((Object)item.itemProperties).name == ((Object)((Registry<DawnItemInfo>)(object)LethalContent.Items)[SCP3166Keys.Lasagna].Item).name) { return true; } } return false; } private 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_002d: 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); base.agent.Warp(navMeshPosition); } public override void OnCollideWithPlayer(Collider other) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).OnCollideWithPlayer(other); PlayerControllerB val = default(PlayerControllerB); if (!base.inSpecialAnimation && base.currentBehaviourStateIndex == 3 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !(timeSinceDamagePlayer <= 1f) && !((Object)(object)Plugin.localPlayer != (Object)(object)val)) { timeSinceDamagePlayer = 0f; DoAnimationServerRpc("attack"); val.DamagePlayer(gorefieldDamage, true, true, (CauseOfDeath)6, 0, false, default(Vector3)); } } public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { timeSinceChatter = 0f; Plugin.logger.LogDebug((object)"HitEnemy()"); if (hitID == -1) { Plugin.logger.LogDebug((object)"Attempting to play clip: ShotByPlayerSFX"); PlayClip("ShotByPlayerSFX"); } else { Plugin.logger.LogDebug((object)"Attempting to play clip: HurtByPlayerSFX"); PlayClip("HurtByPlayerSFX"); } } public void FeedLasagna() { if (!base.inSpecialAnimation) { Plugin.logger.LogDebug((object)"Feeding Lasagna"); Plugin.localPlayer.DespawnHeldObject(); base.inSpecialAnimation = true; FeedLasagnaServerRpc(); } } public void PlayFootstepSFX() { RoundManager.PlayRandomClip(base.creatureSFX, footstepSFX, true, 1f, 0, 1000); } public void UnsetInSpecialAnimation() { Plugin.logger.LogDebug((object)"UnsetInSpecialAnimation"); base.inSpecialAnimation = false; } public void BehaviorSwitchCleanup() { timeSinceChatter = 0f; timeSinceDemandLasagna = 0f; playedHalfHungerSFX = false; reachedPlayerWithLasagna = false; StopSearch(); } public void SwitchToBehaviourStateOnLocalClient(int stateIndex) { if (base.currentBehaviourStateIndex != stateIndex) { ManualLogSource logger = Plugin.logger; State state = (State)stateIndex; logger.LogDebug((object)("Switching behavior to: " + state)); base.previousBehaviourStateIndex = base.currentBehaviourStateIndex; base.currentBehaviourStateIndex = stateIndex; base.currentBehaviourState = base.enemyBehaviourStates[stateIndex]; timeSinceSwitchBehavior = 0f; BehaviorSwitchCleanup(); switch (stateIndex) { case 0: timeSinceFollowPlayer = 0f; base.creatureAnimator.SetBool("rage", false); StartSearch(500f); break; case 1: PlayClip("FoundPlayerSFX"); break; case 2: PlayClip("DemandLasagnaSFX"); break; case 3: PlayClip("StartRageSFX"); base.creatureAnimator.SetBool("rage", true); break; } } } public void PlayClip(string clipName) { Plugin.logger.LogDebug((object)"In PlayClip()"); AudioClip[] array = voiceLines[clipName]; float num = Random.Range(0.9f, 1.1f); int num2 = Random.Range(0, array.Length); Plugin.logger.LogDebug((object)$"Running PlayClipClientRpc({clipName}, {num2}, {num})"); PlayClipServerRpc(clipName, num2, num); } [ServerRpc(RequireOwnership = false)] public void DoAnimationServerRpc(string animName) { //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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1901319177u, val2, (RpcDelivery)0); bool flag = animName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(animName, false); } ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1901319177u, val2, (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(animName); } } } [ClientRpc] public void DoAnimationClientRpc(string animName) { //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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1598392935u, val2, (RpcDelivery)0); bool flag = animName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(animName, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1598392935u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; base.creatureAnimator.SetTrigger(animName); } } [ServerRpc(RequireOwnership = false)] public void PlayClipServerRpc(string clipName, int index, float pitch) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e2: 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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1529781u, val2, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(clipName, false); } BytePacker.WriteValueBitPacked(val, index); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1529781u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (Plugin.IsServerOrHost) { PlayClipClientRpc(clipName, index, pitch); } } } [ClientRpc] public void PlayClipClientRpc(string clipName, int index, float pitch) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00e2: 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 val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(764069451u, val2, (RpcDelivery)0); bool flag = clipName != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(clipName, false); } BytePacker.WriteValueBitPacked(val, index); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 764069451u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Plugin.logger.LogDebug((object)"In PlayClipClientRpc()"); Plugin.logger.LogDebug((object)("Playing clip " + clipName)); base.creatureVoice.Stop(); AudioClip[] array = voiceLines[clipName]; base.creatureVoice.pitch = pitch; base.creatureVoice.clip = array[index]; base.creatureVoice.Play(); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, array[index], 0.85f); } } [ClientRpc] public void SwitchToBehaviourClientRpc(int stateIndex) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2579341352u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, stateIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2579341352u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SwitchToBehaviourStateOnLocalClient(stateIndex); } } } [ServerRpc(RequireOwnership = false)] public void FeedLasagnaServerRpc() { //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 val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3528172920u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3528172920u, val2, (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) { hungerMultiplier += HungerMultiplierIncreasePerLasagna; FeedLasagnaClientRpc(); } } } [ClientRpc] public void FeedLasagnaClientRpc() { //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) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3200112956u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3200112956u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ((MonoBehaviour)this).StartCoroutine(EatLasagnaCoroutine(TimeToEat)); } } IEnumerator EatLasagnaCoroutine(float eatTime) { Plugin.logger.LogDebug((object)$"Eating lasagna for {eatTime} seconds"); yield return null; base.inSpecialAnimation = true; base.creatureVoice.Stop(); base.creatureVoice.clip = eatingLasagnaSFX; base.creatureVoice.loop = true; base.creatureVoice.Play(); base.creatureAnimator.SetBool("eating", true); ((Renderer)lasagnaRenderer).enabled = true; yield return (object)new WaitForSeconds(eatTime); ((Renderer)lasagnaRenderer).enabled = false; base.creatureAnimator.SetBool("eating", false); base.creatureVoice.Stop(); base.creatureVoice.loop = false; base.inSpecialAnimation = false; targetPlayer = null; timeSinceEatingLasagna = 0f; playedHalfHungerSFX = false; if (Size + SizeIncreasePerLasagna <= MaxSize) { Size += SizeIncreasePerLasagna; gorefieldDamage += DamageIncreasePerLasagna; } timeSinceChatter = 0f; if (((NetworkBehaviour)this).IsServer) { PlayClip("PostEatingLasagnaSFX"); } SwitchToBehaviourStateOnLocalClient(0); if (((NetworkBehaviour)this).IsServer && SpawnLasagnaWhenSpawned) { SpawnLasagna(); } } } [ClientRpc] public void EatPlayerClientRpc(ulong clientId) { //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_0071: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(646144598u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, clientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 646144598u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB player = Plugin.PlayerFromId(clientId); ((MonoBehaviour)this).StartCoroutine(EatPlayerCoroutine(player, TimeToEat)); } } IEnumerator EatPlayerCoroutine(PlayerControllerB val3, float eatTime) { Plugin.logger.LogDebug((object)$"Eating player for {eatTime} seconds"); yield return null; base.inSpecialAnimation = true; DeadBodyInfo body = val3.deadBody; body.attachedTo = eatingPlayerTransform; body.attachedLimb = body.bodyParts[5]; body.matchPositionExactly = true; base.creatureVoice.Stop(); base.creatureVoice.clip = eatingPlayerSFX; base.creatureVoice.loop = true; base.creatureVoice.Play(); base.creatureAnimator.SetBool("eating", true); yield return (object)new WaitForSeconds(eatTime); body.attachedTo = null; body.attachedLimb = null; body.matchPositionExactly = false; body.DeactivateBody(false); base.creatureAnimator.SetBool("eating", false); base.creatureVoice.Stop(); base.creatureVoice.loop = false; base.inSpecialAnimation = false; targetPlayer = null; timeSinceEatingLasagna = 0f; playedHalfHungerSFX = false; if (Size + SizeIncreasePerLasagna <= MaxSize) { Size += SizeIncreasePerLasagna; gorefieldDamage += DamageIncreasePerLasagna; } timeSinceChatter = 0f; if (Plugin.IsServerOrHost) { PlayClip("PostEatingPlayerSFX"); } SwitchToBehaviourStateOnLocalClient(0); } } protected override void __initializeVariables() { if (targetPlayerId == null) { throw new Exception("SCP3166AI.targetPlayerId cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)targetPlayerId).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)targetPlayerId, "targetPlayerId"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)targetPlayerId); ((EnemyAI)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 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1901319177u, new RpcReceiveHandler(__rpc_handler_1901319177), "DoAnimationServerRpc"); ((NetworkBehaviour)this).__registerRpc(1598392935u, new RpcReceiveHandler(__rpc_handler_1598392935), "DoAnimationClientRpc"); ((NetworkBehaviour)this).__registerRpc(1529781u, new RpcReceiveHandler(__rpc_handler_1529781), "PlayClipServerRpc"); ((NetworkBehaviour)this).__registerRpc(764069451u, new RpcReceiveHandler(__rpc_handler_764069451), "PlayClipClientRpc"); ((NetworkBehaviour)this).__registerRpc(2579341352u, new RpcReceiveHandler(__rpc_handler_2579341352), "SwitchToBehaviourClientRpc"); ((NetworkBehaviour)this).__registerRpc(3528172920u, new RpcReceiveHandler(__rpc_handler_3528172920), "FeedLasagnaServerRpc"); ((NetworkBehaviour)this).__registerRpc(3200112956u, new RpcReceiveHandler(__rpc_handler_3200112956), "FeedLasagnaClientRpc"); ((NetworkBehaviour)this).__registerRpc(646144598u, new RpcReceiveHandler(__rpc_handler_646144598), "EatPlayerClientRpc"); ((EnemyAI)this).__initializeRpcs(); } private static void __rpc_handler_1901319177(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 animName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).DoAnimationServerRpc(animName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1598392935(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 animName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animName, false); } target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).DoAnimationClientRpc(animName); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1529781(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_005b: 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_007a: 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_00ab: 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 clipName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false); } int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).PlayClipServerRpc(clipName, index, pitch); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_764069451(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_005b: 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_007a: 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_00ab: 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 clipName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false); } int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); float pitch = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).PlayClipClientRpc(clipName, index, pitch); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2579341352(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int stateIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref stateIndex); target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).SwitchToBehaviourClientRpc(stateIndex); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3528172920(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; ((SCP3166AI)(object)target).FeedLasagnaServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3200112956(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; ((SCP3166AI)(object)target).FeedLasagnaClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_646144598(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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); target.__rpc_exec_stage = (__RpcExecStage)1; ((SCP3166AI)(object)target).EatPlayerClientRpc(clientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "SCP3166AI"; } } public class SCP3166ContentHandler : ContentHandler<SCP3166ContentHandler> { public class SCP3166Assets : AssetBundleLoader<SCP3166Assets> { [LoadFromBundle("SCP3166Info.asset")] public SCPInfo SCPInfo { get; private set; } = null; public SCP3166Assets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class LasagnaAssets : AssetBundleLoader<LasagnaAssets> { public LasagnaAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public class GarfieldPhoneAssets : AssetBundleLoader<GarfieldPhoneAssets> { public GarfieldPhoneAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } public SCP3166Assets? SCP3166; public LasagnaAssets? Lasagna; public GarfieldPhoneAssets? GarfieldPhone; public SCP3166ContentHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent<SCP3166Assets>("scp3166", ref SCP3166, false); ((ContentHandler)this).RegisterContent<LasagnaAssets>("lasagna", ref Lasagna, false); ((ContentHandler)this).RegisterContent<GarfieldPhoneAssets>("garfield_phone", ref GarfieldPhone, false); } } public static class SCP3166Keys { public const string Namespace = "scpthreeonesixsix"; internal static NamespacedKey LastVersion = NamespacedKey.From("scpthreeonesixsix", "last_version"); public static readonly NamespacedKey<DawnEnemyInfo> SCP3166 = NamespacedKey<DawnEnemyInfo>.From("scpthreeonesixsix", "scpthreeonesixsix"); public static readonly NamespacedKey<DawnItemInfo> GarfieldPhone = NamespacedKey<DawnItemInfo>.From("scpthreeonesixsix", "garfield_phone"); public static readonly NamespacedKey<DawnItemInfo> Lasagna = NamespacedKey<DawnItemInfo>.From("scpthreeonesixsix", "lasagna"); } [HarmonyPatch] public static class TESTING { [HarmonyPostfix] [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] public static void PingScan_performedPostFix() { if (Utils.testing) { } } [StaticUpdate] public static void Update() { if (Utils.testing) { } } [HarmonyPrefix] [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] public static void SubmitChat_performedPrefix(HUDManager __instance) { try { if (Utils.testing) { string text = __instance.chatTextField.text; string[] array = text.Split(" "); string text2 = array[0]; string text3 = text2; } } catch (Exception ex) { Plugin.logger.LogError((object)ex); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ProjectSCP.SCP3166"; public const string PLUGIN_NAME = "SCP3166"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace ProjectSCP.SCP3166.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }