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 PinkFlamingos v1.0.0
plugins/SCP1507.dll
Decompiled 37 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.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 HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using REPOLib.Objects.Sdk; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SCP1507")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SCP1507")] [assembly: AssemblyTitle("SCP1507")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SCP1507 { public class AI1507 : MonoBehaviour { public enum State { Spawn, Move, Stun, Despawn } public Transform pivot; public Transform body; public MeshRenderer bodyRenderer; public GameObject glasses; public AudioSource voice; public Sound soundHurt; public Sound soundDeath; public Sound soundPeck; private Enemy enemy; private PhotonView photonView; private EnemyHealth health; private Pack pack; private readonly SpringQuaternion rotationSpring = new SpringQuaternion { damping = 0.5f, speed = 14f }; private Quaternion rotationTarget = Quaternion.identity; public State state; private bool impulse = true; private bool alert; private float timer; private float peckCooldown; private float sightTimer; private float honkTimer; private int look; private const float PeckReach = 1f; private float jumpCooldown; private float airborne; private static float playerJump = -1f; private float coverCheck; private float sidestep; private float stuckFor; private float side = 1f; private bool targetOffMesh; private static readonly RaycastHit[] hits = (RaycastHit[])(object)new RaycastHit[16]; private Vector3 pivotHome; private Vector3 lastPos; private float speedSmoothed; private float walkPhase; private float peckT; private float grazeT; private float grazeWait = 3f; private float shake; private float hopSize = 1f; private float hopSide = 1f; private float idleHopT; private float idleHopWait; private float lastY; private float duck; private float ceilingAt = 99f; private float ceilingTimer; private static readonly RaycastHit[] ceilingHits = (RaycastHit[])(object)new RaycastHit[8]; private static readonly float[] CeilingProbes = new float[3] { 0f, 0.15f, 0.3f }; private const float PeckTime = 0.2f; private const float GrazeTime = 1.1f; public bool Active { get { if (Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)enemy) && Object.op_Implicit((Object)(object)enemy.EnemyParent) && enemy.EnemyParent.Spawned) { return state != State.Despawn; } return false; } } public Vector3 RealFeet { get { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pivot) || !Object.op_Implicit((Object)(object)pivot.parent)) { return Feet; } return pivot.parent.TransformPoint(pivotHome); } } public Vector3 Feet { get { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_006f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.Rigidbody)) { return ((Component)this).transform.position; } return new Vector3(((Component)enemy.Rigidbody).transform.position.x, ((Component)this).transform.position.y, ((Component)enemy.Rigidbody).transform.position.z); } } private void Awake() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_0122: 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) enemy = ((Component)this).GetComponent<Enemy>(); photonView = ((Component)this).GetComponent<PhotonView>(); health = ((Component)this).GetComponent<EnemyHealth>(); EnemyStateSpawn component = ((Component)this).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component)) { component.OnSpawn.AddListener(new UnityAction(OnSpawn)); } EnemyStateInvestigate investigate = ((Component)this).GetComponent<EnemyStateInvestigate>(); if (Object.op_Implicit((Object)(object)investigate)) { investigate.onInvestigateTriggered.AddListener((UnityAction)delegate { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && pack != null) { pack.Hear(investigate.onInvestigateTriggeredPosition); } }); } if (Object.op_Implicit((Object)(object)health)) { health.onDeath.AddListener(new UnityAction(OnDeath)); health.onHurt.AddListener(new UnityAction(OnHurt)); } pack = Pack.Join(this); sightTimer = Random.value * 0.3f; walkPhase = Random.value; idleHopWait = Random.Range(2f, 8f); if (Object.op_Implicit((Object)(object)pivot)) { pivotHome = pivot.localPosition; } } private void OnEnable() { if (Object.op_Implicit((Object)(object)photonView)) { photonView.RefreshRpcMonoBehaviourCache(); } if (Object.op_Implicit((Object)(object)pivot)) { ((Component)pivot).gameObject.SetActive(true); } } private void Update() { if (SemiFunc.IsMasterClientOrSingleplayer()) { HostLogic(); } Animate(); } private void HostLogic() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_0398: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) if (enemy.IsStunned()) { Set(State.Stun); } else if ((int)enemy.CurrentState == 11) { Set(State.Despawn); } pack.Tick(); EnemyNavMeshAgent navMeshAgent = enemy.NavMeshAgent; Vector3 feet = Feet; bool flag = pack.mode == Pack.Mode.Attack && Pack.Alive(pack.Target); if (flag != alert) { alert = flag; SendAlert(); } switch (state) { case State.Spawn: if (Impulse()) { timer = 1f; } if ((timer -= Time.deltaTime) <= 0f) { Set(State.Move); } break; case State.Stun: if (Impulse()) { StopMoving(); } if (!enemy.IsStunned()) { Set(State.Move); } break; case State.Despawn: if (Impulse()) { StopMoving(); enemy.EnemyParent.Despawn(); } break; case State.Move: { Look(); if (flag) { PlayerAvatar target = pack.Target; Vector3 position = ((Component)target).transform.position; bool sighted = pack.Sighted; Vector3 val = (sighted ? position : pack.LastSeenAt); Vector3 destination = ((Flat(feet, val) > 3f) ? val : (val + pack.Slot(this, 0.32f, 0.55f))); float value = Plugin.ChaseSpeed.Value; navMeshAgent.OverrideAgent(value, 25f, 0.2f); enemy.Rigidbody.OverrideFollowPosition(0.2f, value * 1.6f, -1f); navMeshAgent.SetDestination(destination); if (sighted) { if (!Perched(target, value)) { Squeeze(target, value); } TryJumpUp(target); } Vector3 realFeet = RealFeet; float num = position.y - realFeet.y; peckCooldown -= Time.deltaTime; if (peckCooldown <= 0f && Flat(realFeet, position) < 1f && num > -0.8f && num < 0.9f && !Blocked(realFeet + Vector3.up * 0.5f, position + Vector3.up * 0.6f, target)) { Peck(target); } break; } bool flag2 = pack.mode == Pack.Mode.Investigate; Vector3 val2 = pack.Destination + pack.Slot(this, Plugin.Spacing.Value, Plugin.Spacing.Value * 0.4f); float num2 = Plugin.WalkSpeed.Value * (flag2 ? 1.6f : 1f); if (Flat(feet, pack.Centre) > 10f) { num2 *= 1.8f; } if (pack.mode == Pack.Mode.Rest && Flat(feet, val2) < 0.5f + Plugin.Spacing.Value * 0.5f) { if (navMeshAgent.HasPath()) { navMeshAgent.ResetPath(); } } else { navMeshAgent.OverrideAgent(num2, 10f, 0.2f); navMeshAgent.SetDestination(val2); } if ((honkTimer -= Time.deltaTime) <= 0f) { honkTimer = Random.Range(4f, 10f); if (pack.MayHonk(8f, 20f)) { Honk(0.55f); } } break; } } RotationLogic(flag); } private void Look() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) if ((sightTimer -= Time.deltaTime) > 0f) { return; } sightTimer = 0.3f; Vector3 a = Feet + Vector3.up * Plugin.Height.Value * 0.9f; float value = Plugin.SightRange.Value; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!Pack.Alive(item)) { continue; } Vector3 val = ((Component)item).transform.position - Feet; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > value) { continue; } val.y = 0f; if ((!(magnitude > 2.5f) || !(Vector3.Angle(((Component)this).transform.forward, val) > 75f)) && (!Blocked(a, ((Component)item).transform.position + Vector3.up * 1.2f, item) || !Blocked(a, ((Component)item).transform.position + Vector3.up * 0.4f, item))) { if (pack.Spot(item)) { Honk(1f); } if ((Object)(object)item == (Object)(object)pack.Target) { break; } } } } private static float PlayerJumpHeight() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (playerJump > 0f) { return playerJump; } PlayerController instance = PlayerController.instance; if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance.rb)) { return 1.1f; } float num = Mathf.Max(0.01f, instance.rb.mass); float num2 = instance.JumpForce / num; float num3 = 0f - Physics.gravity.y + instance.CustomGravity / num; playerJump = Mathf.Clamp(num2 * num2 / (2f * num3), 0.4f, 3f); Plugin.Log.LogInfo((object)$"Player jump height {playerJump:0.00} m; SCP-1507 can jump {playerJump * Plugin.JumpScale.Value:0.00} m."); return playerJump; } private float Gravity() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) EnemyRigidbody rigidbody = enemy.Rigidbody; return 0f - Physics.gravity.y + ((rigidbody.customGravity > 0f) ? (rigidbody.customGravity / Mathf.Max(0.01f, rigidbody.rb.mass)) : 0f); } private void TryJumpUp(PlayerAvatar target) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) if ((jumpCooldown -= Time.deltaTime) > 0f || Plugin.JumpScale.Value <= 0f) { return; } EnemyRigidbody rigidbody = enemy.Rigidbody; if (airborne > 0f || !enemy.HasGrounded || !enemy.Grounded.grounded || rigidbody.grabbed || enemy.IsStunned() || (enemy.HasJump && enemy.Jump.jumping)) { return; } Vector3 realFeet = RealFeet; Vector3 position = ((Component)target).transform.position; float num = position.y - realFeet.y; float num2 = Flat(realFeet, position); float num3 = PlayerJumpHeight() * Plugin.JumpScale.Value; if (num < 0.35f || num > num3 || num2 > 3f) { return; } Vector3 val = position - realFeet; val.y = 0f; Vector3 val2 = ((num2 > 0.45f) ? (position - ((Vector3)(ref val)).normalized * 0.4f) : position); Vector3 val3 = realFeet + Vector3.up * Plugin.Height.Value; if (Blocked(val3, val3 + Vector3.up * (num + 0.3f), target)) { jumpCooldown = 0.5f; return; } if (Blocked(val3 + Vector3.up * (num + 0.3f), val2 + Vector3.up * (Plugin.Height.Value + 0.2f), target)) { jumpCooldown = 0.5f; return; } float num4 = Gravity(); float num5 = num + 0.3f; float num6 = Mathf.Sqrt(2f * num4 * num5) * 1.08f; float num7 = num6 / num4 + Mathf.Sqrt(0.6f / num4); Vector3 val4 = val2 - realFeet; val4.y = 0f; Vector3 val5 = val4 / Mathf.Max(0.3f, num7) + Vector3.up * num6; rigidbody.DisableFollowPosition(num7 + 0.15f, 10f); enemy.NavMeshAgent.Stop(num7); rigidbody.JumpImpulse(); enemy.Grounded.GroundedDisable(0.15f); rigidbody.rb.AddForce(val5 - rigidbody.rb.linearVelocity, (ForceMode)2); jumpCooldown = 1.2f; airborne = num7 + 0.3f; if (pack.MayHonk(0.5f, 1.5f)) { Honk(0.9f); } Plugin.Log.LogDebug((object)$"SCP-1507 jumps {num:0.00} m up after {target.playerName}."); } private bool Perched(PlayerAvatar target, float speed) { //IL_0033: 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) EnemyRigidbody rigidbody = enemy.Rigidbody; if (airborne > 0f) { airborne -= Time.deltaTime; return true; } if (((Component)rigidbody).transform.position.y - ((Component)this).transform.position.y < 0.4f) { return false; } if (enemy.HasGrounded && !enemy.Grounded.grounded) { return true; } Steer(target, speed * 0.6f); return true; } private void Steer(PlayerAvatar target, float speed) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) EnemyRigidbody rigidbody = enemy.Rigidbody; rigidbody.DisableFollowPosition(0.2f, 10f); Vector3 val = ((Component)target).transform.position - ((Component)rigidbody).transform.position; val.y = 0f; bool flag = ((Vector3)(ref val)).magnitude > 0.55f; Vector3 linearVelocity = rigidbody.rb.linearVelocity; if (sidestep > 0f) { sidestep -= Time.deltaTime; } else { if (flag) { Vector2 val2 = new Vector2(linearVelocity.x, linearVelocity.z); if (((Vector2)(ref val2)).magnitude < speed * 0.2f) { if ((stuckFor += Time.deltaTime) > 0.4f) { stuckFor = 0f; sidestep = 0.55f; side = 0f - side; if (!enemy.HasGrounded || enemy.Grounded.grounded) { rigidbody.rb.AddForce(Vector3.up * 2.2f, (ForceMode)2); } } goto IL_0134; } } stuckFor = 0f; } goto IL_0134; IL_0134: if (sidestep > 0f && flag) { val = Quaternion.Euler(0f, 70f * side, 0f) * val; } Vector3 val3 = (flag ? (((Vector3)(ref val)).normalized * speed) : Vector3.zero); Vector3 val4 = Vector3.ClampMagnitude(new Vector3(val3.x - linearVelocity.x, 0f, val3.z - linearVelocity.z), 20f * Time.deltaTime); rigidbody.rb.AddForce(val4, (ForceMode)2); } private bool Squeeze(PlayerAvatar target, float speed) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_003b: 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_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_009e: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)target).transform.position; Vector3 realFeet = RealFeet; if ((coverCheck -= Time.deltaTime) <= 0f) { coverCheck = 0.3f; NavMeshHit val = default(NavMeshHit); targetOffMesh = NavMesh.SamplePosition(position, ref val, 2f, -1) && Flat(((NavMeshHit)(ref val)).position, position) > 0.45f && Mathf.Abs(((NavMeshHit)(ref val)).position.y - position.y) < 0.6f; } if (!targetOffMesh) { return false; } if (Flat(realFeet, position) > 3.5f || Mathf.Abs(position.y - realFeet.y) > 0.5f) { return false; } if (Blocked(realFeet + Vector3.up * 0.25f, position + Vector3.up * 0.25f, target)) { return false; } Steer(target, speed * 0.5f); return true; } private void Peck(PlayerAvatar target) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) peckCooldown = Plugin.PeckInterval * Random.Range(0.85f, 1.15f); int num = Pack.Owe(target, Plugin.PeckDamage.Value); if (num > 0 && Object.op_Implicit((Object)(object)target.playerHealth)) { target.playerHealth.HurtOther(num, Vector3.zero, false, SemiFunc.EnemyGetIndex(enemy), false); } bool flag = pack.MayHonk(0.6f, 1.6f); if (SemiFunc.IsMultiplayer()) { photonView.RPC("Scp1507_PeckRPC", (RpcTarget)0, new object[1] { flag }); } else { Scp1507_PeckRPC(flag); } } private void Honk(float volume) { //IL_002c: 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) if (SemiFunc.IsMultiplayer()) { photonView.RPC("Scp1507_HonkRPC", (RpcTarget)0, new object[1] { volume }); } else { Scp1507_HonkRPC(volume); } } private void SendAlert() { if (SemiFunc.IsMultiplayer()) { photonView.RPC("Scp1507_AlertRPC", (RpcTarget)1, new object[1] { alert }); } } private void RotationLogic(bool attacking) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = enemy.NavMeshAgent.AgentVelocity; if (attacking && Object.op_Implicit((Object)(object)pack.Target) && pack.Sighted && Flat(Feet, ((Component)pack.Target).transform.position) < 2.5f) { val = ((Component)pack.Target).transform.position - ((Component)this).transform.position; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { rotationTarget = Quaternion.LookRotation(val); } ((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(rotationSpring, rotationTarget, -1f); enemy.Rigidbody.rotationSpeedIdle = 3f; enemy.Rigidbody.rotationSpeedChase = 8f; } private bool Blocked(Vector3 a, Vector3 b, PlayerAvatar target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Vector3 val = b - a; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.05f) { return false; } int mask = LayerMask.GetMask(new string[2] { "Default", "PhysGrabObjectHinge" }); int num = Physics.RaycastNonAlloc(a, val / magnitude, hits, magnitude, mask, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Collider collider = ((RaycastHit)(ref hits[i])).collider; if (Object.op_Implicit((Object)(object)collider) && (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.EnemyParent) || !((Component)collider).transform.IsChildOf(((Component)enemy.EnemyParent).transform)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerAvatar>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerTumble>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<Enemy>())) { return true; } } return false; } private static float Flat(Vector3 a, Vector3 b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) a.y = 0f; b.y = 0f; return Vector3.Distance(a, b); } private bool Impulse() { if (!impulse) { return false; } impulse = false; return true; } private void StopMoving() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) enemy.NavMeshAgent.ResetPath(); enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position, false); } private void Set(State s) { if (s != state) { state = s; impulse = true; timer = 0f; } } public void OnSpawn() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)pivot)) { ((Component)pivot).gameObject.SetActive(true); } if (SemiFunc.IsMasterClientOrSingleplayer()) { SemiFunc.EnemySpawn(enemy); state = State.Despawn; Set(State.Spawn); peckCooldown = Random.value; bool flag = pack.IsLeader(this); int num = 0; if (flag) { num = 4; } else if (Random.value < Plugin.ZombieChance.Value) { num = 1; } else if (Random.value < Plugin.SquadChance.Value) { num = ((Random.value < 0.5f) ? 2 : 3); } if (SemiFunc.IsMultiplayer()) { photonView.RPC("Scp1507_LookRPC", (RpcTarget)0, new object[2] { num, flag }); } else { Scp1507_LookRPC(num, flag); } } } public void OnHurt() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) shake = 0.3f; Sound obj = soundHurt; if (obj != null) { obj.Play(Object.op_Implicit((Object)(object)voice) ? ((Component)voice).transform.position : ((Component)this).transform.position, 0.8f, 1f, 1f, 1f); } if (!SemiFunc.IsMasterClientOrSingleplayer() || state == State.Despawn) { return; } PlayerAvatar val = null; float num = 8f; foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (Pack.Alive(item)) { float num2 = Vector3.Distance(((Component)item).transform.position, Feet); if (num2 < num) { num = num2; val = item; } } } if (Object.op_Implicit((Object)(object)val) && pack.Spot(val)) { Honk(1f); } } public void OnDeath() { //IL_0020: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (Object.op_Implicit((Object)(object)body) ? body.position : ((Component)this).transform.position); Sound obj = soundDeath; if (obj != null) { obj.Play(val, 0.9f, 1f, 1f, 1f); } if (Object.op_Implicit((Object)(object)voice)) { AudioSource.PlayClipAtPoint(Assets1507.Honk(), val + Vector3.up * 0.5f, 0.6f); } Gibs.Burst(body, Object.op_Implicit((Object)(object)bodyRenderer) ? ((Renderer)bodyRenderer).sharedMaterial : null, Object.op_Implicit((Object)(object)health) ? health.hurtDirection : Vector3.zero); if (Object.op_Implicit((Object)(object)pivot)) { ((Component)pivot).gameObject.SetActive(false); } if (SemiFunc.IsMasterClientOrSingleplayer()) { Patches.MarkDead(enemy.EnemyParent); enemy.EnemyParent.Despawn(); } } private float Ceiling(Vector3 rbPos, float h) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009b: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if ((ceilingTimer -= Time.deltaTime) > 0f) { return ceilingAt; } ceilingTimer = 0.08f; Vector3 val = pivot.position - Vector3.up * (pivot.localPosition.y - pivotHome.y); Vector3 val2 = pivot.forward; val2.y = 0f; val2 = ((((Vector3)(ref val2)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val2)).normalized : Vector3.forward); int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()); float num2 = 99f; float[] ceilingProbes = CeilingProbes; foreach (float num3 in ceilingProbes) { int num4 = Physics.RaycastNonAlloc(val + val2 * (num3 * h) + Vector3.up * 0.15f, Vector3.up, ceilingHits, h + 0.2f, num, (QueryTriggerInteraction)1); for (int j = 0; j < num4; j++) { Collider collider = ((RaycastHit)(ref ceilingHits[j])).collider; if (Object.op_Implicit((Object)(object)collider) && (!Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.EnemyParent) || !((Component)collider).transform.IsChildOf(((Component)enemy.EnemyParent).transform)) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerAvatar>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerTumble>()) && !Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<Enemy>())) { num2 = Mathf.Min(num2, ((RaycastHit)(ref ceilingHits[j])).distance + 0.15f); } } } return ceilingAt = num2; } private void Animate() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pivot) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)enemy) || !Object.op_Implicit((Object)(object)enemy.Rigidbody)) { return; } float num = Mathf.Max(Time.deltaTime, 0.0001f); Vector3 position = ((Component)enemy.Rigidbody).transform.position; Vector3 val = (position - lastPos) / num; val.y = 0f; lastPos = position; speedSmoothed = Mathf.Lerp(speedSmoothed, Mathf.Min(((Vector3)(ref val)).magnitude, 10f), 1f - Mathf.Exp(-10f * num)); float value = Plugin.Height.Value; float num2 = Mathf.Clamp01(speedSmoothed / 2f); float num3 = 2.2f + speedSmoothed * 1.1f; walkPhase += num * num3 * Mathf.Max(num2, (idleHopT > 0f) ? 1f : 0f); if (walkPhase >= 1f) { walkPhase -= Mathf.Floor(walkPhase); hopSize = ((Random.value < 0.18f) ? 1.9f : Random.Range(0.8f, 1.15f)); hopSide = 0f - hopSide; } float num4 = 4f * walkPhase * (1f - walkPhase); float num5 = (alert ? 0.2f : 0.11f) * value * hopSize; float num6 = num4 * num5 * Mathf.Max(num2, (idleHopT > 0f) ? 1f : 0f); float num7 = hopSide * num4 * 6f * num2; float num8 = 8f * num2 + (num4 - 0.5f) * -10f * num2; if (idleHopT > 0f) { idleHopT -= num; } else if (num2 < 0.15f && !enemy.IsStunned() && grazeT <= 0f && (idleHopWait -= num) <= 0f) { idleHopT = (float)Random.Range(1, 4) / num3; idleHopWait = Random.Range(3f, 9f); walkPhase = 0f; } float num9 = (position.y - lastY) / num; lastY = position.y; if (Mathf.Abs(num9) > 1.2f) { num8 += Mathf.Clamp((0f - num9) * 6f, -25f, 25f); } if (peckT > 0f) { peckT -= num; num8 += Mathf.Sin(MathF.PI * (1f - Mathf.Clamp01(peckT / 0.2f))) * 42f; } bool flag = enemy.IsStunned(); if (!alert && !flag && num2 < 0.15f) { if (grazeT > 0f) { grazeT -= num; } else if ((grazeWait -= num) <= 0f) { grazeT = 1.1f; grazeWait = Random.Range(2.5f, 8f); } } else { grazeT = Mathf.Max(0f, grazeT - num * 3f); } if (grazeT > 0f) { num8 += Mathf.SmoothStep(0f, 1f, Mathf.Min(1f, Mathf.Min(grazeT, 1.1f - grazeT) / 0.3f)) * 60f; } float num10 = Ceiling(position, value); float num11 = 0f; if (num10 < value * 1.02f) { float num12 = 0.42f * value; float num13 = Mathf.Max(0f, num10 - 0.06f - num12); float num14 = value - num12; num11 = Mathf.Acos(Mathf.Clamp(num13 / num14, 0.12f, 1f)) * 57.29578f; } duck = Mathf.MoveTowards(duck, num11, num * 240f); if (duck > 1f) { num8 = Mathf.Max(num8, duck); num6 *= 0.3f; num7 *= 0.5f; } if (flag) { num7 += Mathf.Sin(Time.time * 23f) * 14f; num8 += 10f; } if (shake > 0f) { shake -= num; num7 += Random.Range(-12f, 12f); } pivot.localPosition = pivotHome + Vector3.up * num6; Quaternion val2 = Quaternion.Euler(num8, 0f, num7); Vector3 val3 = Vector3.up * 0.42f * value; body.localRotation = val2; body.localPosition = val3 - val2 * val3; } [PunRPC] public void Scp1507_LookRPC(int l, bool leader, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } look = l; if (Object.op_Implicit((Object)(object)pivot)) { ((Component)pivot).gameObject.SetActive(true); } if (Object.op_Implicit((Object)(object)glasses)) { glasses.SetActive(leader); } Material[] looks = Builder1507.Looks; if (!Object.op_Implicit((Object)(object)bodyRenderer) || looks == null || l < 0 || l >= looks.Length) { return; } Material sharedMaterial = ((Renderer)bodyRenderer).sharedMaterial; int num = Shader.PropertyToID("_ColorOverlay"); Color val = ((Object.op_Implicit((Object)(object)sharedMaterial) && sharedMaterial.HasProperty(num)) ? sharedMaterial.GetColor(num) : Color.red); ((Renderer)bodyRenderer).sharedMaterial = looks[l]; Material material = ((Renderer)bodyRenderer).material; if (material.HasProperty(num)) { material.SetColor(num, val); material.SetFloat("_ColorOverlayAmount", 0f); } if (Object.op_Implicit((Object)(object)health) && health.instancedMaterials != null) { if (Object.op_Implicit((Object)(object)sharedMaterial)) { health.instancedMaterials.Remove(sharedMaterial); } health.instancedMaterials.Add(material); } } [PunRPC] public void Scp1507_PeckRPC(bool honk, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { peckT = 0.2f; Vector3 val = (Object.op_Implicit((Object)(object)body) ? body.TransformPoint(new Vector3(0f, 0.6f, 0.3f)) : ((Component)this).transform.position); Sound obj = soundPeck; if (obj != null) { obj.Play(val, 0.45f, 1f, 1f, 1f); } if (honk) { PlayHonk(0.8f); } } } [PunRPC] public void Scp1507_HonkRPC(float volume, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { PlayHonk(volume); } } [PunRPC] public void Scp1507_AlertRPC(bool a, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { alert = a; } } private void PlayHonk(float volume) { if (Object.op_Implicit((Object)(object)voice)) { voice.pitch = Random.Range(0.9f, 1.2f); voice.PlayOneShot(Assets1507.Honk(), volume); } } } internal static class Assets1507 { private const int SoundRate = 24000; private static readonly Dictionary<string, AudioClip> sounds = new Dictionary<string, AudioClip>(); private static readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>(); private static readonly Dictionary<string, Mesh> meshes = new Dictionary<string, Mesh>(); private static byte[] Embedded(string name) { using Stream stream = typeof(Assets1507).Assembly.GetManifestResourceStream("SCP1507." + name); if (stream == null) { throw new FileNotFoundException("Embedded resource missing: " + name); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } public static Mesh Mesh(string name) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_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_014f: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (meshes.TryGetValue(name, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } byte[] array = Embedded(name + ".mesh"); int num = BitConverter.ToInt32(array, 0); int num2 = BitConverter.ToInt32(array, 4); int num3 = 8; Vector3[] array2 = (Vector3[])(object)new Vector3[num]; Vector3[] array3 = (Vector3[])(object)new Vector3[num]; Vector2[] array4 = (Vector2[])(object)new Vector2[num]; int[] array5 = new int[num2]; int num4 = 0; while (num4 < num) { array2[num4] = new Vector3(F(array, num3), F(array, num3 + 4), F(array, num3 + 8)); num4++; num3 += 12; } int num5 = 0; while (num5 < num) { array3[num5] = new Vector3(F(array, num3), F(array, num3 + 4), F(array, num3 + 8)); num5++; num3 += 12; } int num6 = 0; while (num6 < num) { array4[num6] = new Vector2(F(array, num3), F(array, num3 + 4)); num6++; num3 += 8; } int num7 = 0; while (num7 < num2) { array5[num7] = BitConverter.ToInt32(array, num3); num7++; num3 += 4; } value = new Mesh { name = "SCP-1507 " + name }; value.vertices = array2; value.normals = array3; value.uv = array4; value.triangles = array5; value.RecalculateBounds(); value.RecalculateTangents(); Mesh obj = value; ((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20); return meshes[name] = value; } private static float F(byte[] b, int o) { return BitConverter.ToSingle(b, o); } public static Texture2D Texture(string name, bool linear = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0055: 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) if (textures.TryGetValue(name, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } value = new Texture2D(2, 2, (TextureFormat)4, true, linear) { name = "SCP-1507 " + name, wrapMode = (TextureWrapMode)0 }; ImageConversion.LoadImage(value, Embedded(name + ".png")); Texture2D obj = value; ((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20); return textures[name] = value; } public static AudioClip Sound(string name) { //IL_007c: 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) if (sounds.TryGetValue(name, out var value) && Object.op_Implicit((Object)(object)value)) { return value; } byte[] array = Embedded(name + ".pcm"); float[] array2 = new float[array.Length / 2]; for (int i = 0; i < array2.Length; i++) { array2[i] = (float)BitConverter.ToInt16(array, i * 2) / 32768f; } value = AudioClip.Create("SCP-1507 " + name, array2.Length, 1, 24000, false); value.SetData(array2, 0); AudioClip obj = value; ((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x20); return sounds[name] = value; } public static AudioClip Honk() { return Sound("honk" + Random.Range(1, 5)); } } internal static class Builder1507 { public const string PrefabName = "Enemy - SCP-1507"; public static EnemySetup Setup; private static bool tried; internal static Material[] Looks; internal static Material Glasses; internal static int GnomeGroup = 4; public static void BuildAndRegister(EnemyDirector director) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected I4, but got Unknown //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Expected O, but got Unknown //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Expected O, but got Unknown //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Expected O, but got Unknown //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Expected O, but got Unknown //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Expected O, but got Unknown //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Expected O, but got Unknown //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Expected O, but got Unknown //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Expected O, but got Unknown //IL_0729: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Expected O, but got Unknown //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_07b6: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Expected O, but got Unknown //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Expected I4, but got Unknown if (tried) { return; } tried = true; EnemySetup val = director.enemiesDifficulty1.Concat(director.enemiesDifficulty2).Concat(director.enemiesDifficulty3).FirstOrDefault((Func<EnemySetup, bool>)((EnemySetup s) => Object.op_Implicit((Object)(object)s) && ((Object)s).name.Contains("Gnome"))); if ((Object)(object)val == (Object)null) { throw new Exception("Could not find REPO's Gnome enemy to build on. The game may have been updated."); } GameObject val2 = val.spawnObjects.Select((PrefabRef r) => ((PrefabRef<GameObject>)(object)r)?.Prefab).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => Object.op_Implicit((Object)(object)p) && Object.op_Implicit((Object)(object)p.GetComponent<EnemyParent>()) && Object.op_Implicit((Object)(object)p.GetComponentInChildren<EnemyGnome>(true)))); if ((Object)(object)val2 == (Object)null) { throw new Exception("The Gnome enemy has no gnome prefab."); } GnomeGroup = Mathf.Clamp(val.spawnObjects.Count((PrefabRef r) => Object.op_Implicit((Object)(object)((PrefabRef<GameObject>)(object)r)?.Prefab) && Object.op_Implicit((Object)(object)((PrefabRef<GameObject>)(object)r).Prefab.GetComponentInChildren<EnemyGnome>(true))), 1, 8); EnemyParent component = val2.GetComponent<EnemyParent>(); Plugin.Log.LogInfo((object)($"Gnomes: groups of {GnomeGroup}, tier {component.difficulty + 1}, rarity {(Object.op_Implicit((Object)(object)val.rarityPreset) ? val.rarityPreset.chance : (-1f))}, " + $"spawned {component.SpawnedTimeMin:0}-{component.SpawnedTimeMax:0}s, despawned {component.DespawnedTimeMin:0}-{component.DespawnedTimeMax:0}s.")); GameObject val3 = new GameObject("SCP-1507 Prefabs"); val3.SetActive(false); ((Object)val3).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val3); GameObject val4 = Object.Instantiate<GameObject>(val2, val3.transform); ((Object)val4).name = "Enemy - SCP-1507"; EnemyParent component2 = val4.GetComponent<EnemyParent>(); Enemy componentInChildren = val4.GetComponentInChildren<Enemy>(true); EnemyRigidbody componentInChildren2 = val4.GetComponentInChildren<EnemyRigidbody>(true); if (!Object.op_Implicit((Object)(object)componentInChildren) || !Object.op_Implicit((Object)(object)componentInChildren2)) { throw new Exception("The Gnome prefab is missing its Enemy or EnemyRigidbody."); } AudioMixerGroup mixer = (from a in val4.GetComponentsInChildren<AudioSource>(true) select a.outputAudioMixerGroup).FirstOrDefault((Func<AudioMixerGroup, bool>)((AudioMixerGroup g) => Object.op_Implicit((Object)(object)g))); Material baseMat = (from r in val4.GetComponentsInChildren<Renderer>(true) where !(r is ParticleSystemRenderer) select r.sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m) && m.HasProperty("_ColorOverlay"))) ?? (from r in val4.GetComponentsInChildren<Renderer>(true) select r.sharedMaterial).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m))); EnemyGnome componentInChildren3 = val4.GetComponentInChildren<EnemyGnome>(true); Sound soundHurt = componentInChildren3.soundHurt; Sound soundDeath = componentInChildren3.soundDeath; Sound soundImpactLight = componentInChildren3.soundImpactLight; MonoBehaviour[] componentsInChildren = val4.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val5 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val5) && ((object)val5).GetType().Name.StartsWith("EnemyGnome")) { Object.DestroyImmediate((Object)(object)val5); } } Animator[] componentsInChildren2 = val4.GetComponentsInChildren<Animator>(true); for (int num = 0; num < componentsInChildren2.Length; num++) { ((Behaviour)componentsInChildren2[num]).enabled = false; } Renderer[] componentsInChildren3 = val4.GetComponentsInChildren<Renderer>(true); for (int num = 0; num < componentsInChildren3.Length; num++) { componentsInChildren3[num].enabled = false; } Light[] componentsInChildren4 = val4.GetComponentsInChildren<Light>(true); for (int num = 0; num < componentsInChildren4.Length; num++) { ((Behaviour)componentsInChildren4[num]).enabled = false; } AudioSource[] componentsInChildren5 = val4.GetComponentsInChildren<AudioSource>(true); for (int num = 0; num < componentsInChildren5.Length; num++) { componentsInChildren5[num].playOnAwake = false; } ParticleSystem[] componentsInChildren6 = val4.GetComponentsInChildren<ParticleSystem>(true); for (int num = 0; num < componentsInChildren6.Length; num++) { MainModule main = componentsInChildren6[num].main; ((MainModule)(ref main)).playOnAwake = false; } EnemyStateSpawn component3 = ((Component)componentInChildren).GetComponent<EnemyStateSpawn>(); if (Object.op_Implicit((Object)(object)component3)) { component3.OnSpawn = new UnityEvent(); } EnemyVision component4 = ((Component)componentInChildren).GetComponent<EnemyVision>(); if (Object.op_Implicit((Object)(object)component4)) { component4.onVisionTriggered = new UnityEvent(); ((Behaviour)component4).enabled = false; } EnemyStateInvestigate component5 = ((Component)componentInChildren).GetComponent<EnemyStateInvestigate>(); if (Object.op_Implicit((Object)(object)component5)) { component5.onInvestigateTriggered = new UnityEvent(); component5.OnlyEvent = true; } EnemyHealth component6 = ((Component)componentInChildren).GetComponent<EnemyHealth>(); if (Object.op_Implicit((Object)(object)component6)) { component6.onHurt = new UnityEvent(); component6.onDeathStart = new UnityEvent(); component6.onDeath = new UnityEvent(); component6.onObjectHurt = new UnityEvent(); component6.health = Plugin.Health.Value; component6.spawnValuable = false; component6.impactHurt = true; component6.impactLightDamage = Mathf.Max(1, Plugin.Health.Value / 3); component6.impactMediumDamage = Plugin.Health.Value; component6.impactHeavyDamage = Plugin.Health.Value * 3; } FieldInfo[] fields = typeof(EnemyRigidbody).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(UnityEvent)) { fieldInfo.SetValue(componentInChildren2, (object?)new UnityEvent()); } } Looks = (Material[])(object)new Material[5] { MakeMaterial(baseMat, "SCP-1507", "SCP1507_AlbedoTransparency", "SCP1507_Normal", Color.white, null), MakeMaterial(baseMat, "SCP-1507 Zombie", "SCP1507_zombie_AlbedoTransparency", "SCP1507_zombie_Normal", Color.white, "SCP1507_zombie_Emission"), MakeMaterial(baseMat, "SCP-1507 NTF", "SCP1507_clean_AlbedoTransparency", "SCP1507_Normal", new Color(0.1f, 0.55f, 1f), null), MakeMaterial(baseMat, "SCP-1507 Chaos", "SCP1507_clean_AlbedoTransparency", "SCP1507_Normal", new Color(0.12f, 0.45f, 0.2f), null), MakeMaterial(baseMat, "SCP-1507 Leader", "SCP1507_Alpha", "SCP1507_Normal", Color.white, null) }; Glasses = MakeMaterial(baseMat, "SCP-1507 Sunglasses", null, null, new Color(0.03f, 0.03f, 0.035f), null); if (Glasses.HasProperty("_Smoothness")) { Glasses.SetFloat("_Smoothness", 0.9f); } float value = Plugin.Height.Value; int layer = ((Component)componentInChildren2).gameObject.layer; GameObject val6 = new GameObject("SCP-1507 Model") { layer = layer }; val6.transform.SetParent(((Component)componentInChildren2).transform, false); val6.transform.localPosition = Vector3.up * ColliderFloor(((Component)componentInChildren2).transform); GameObject val7 = new GameObject("Flamingo") { layer = layer }; val7.transform.SetParent(val6.transform, false); val7.transform.localScale = Vector3.one * value; val7.AddComponent<MeshFilter>().sharedMesh = Assets1507.Mesh("flamingo"); MeshRenderer val8 = val7.AddComponent<MeshRenderer>(); ((Renderer)val8).sharedMaterial = Looks[0]; GameObject val9 = new GameObject("Sunglasses") { layer = layer }; val9.transform.SetParent(val7.transform, false); val9.AddComponent<MeshFilter>().sharedMesh = Assets1507.Mesh("glasses"); ((Renderer)val9.AddComponent<MeshRenderer>()).sharedMaterial = Glasses; val9.SetActive(false); if (Object.op_Implicit((Object)(object)component6)) { component6.meshParent = val6.transform; } AudioSource val10 = NewSource(val6.transform, "1507 Voice", mixer, 20f); ((Component)val10).transform.localPosition = new Vector3(0f, 0.95f * value, 0.2f * value); AI1507 aI = ((Component)componentInChildren).gameObject.AddComponent<AI1507>(); aI.pivot = val6.transform; aI.body = val7.transform; aI.bodyRenderer = val8; aI.glasses = val9; aI.voice = val10; aI.soundHurt = soundHurt; aI.soundDeath = soundDeath; aI.soundPeck = soundImpactLight; component2.enemyName = "SCP-1507"; component2.enemyNameLocalized = null; if (Plugin.Difficulty.Value > 0) { component2.difficulty = (Difficulty)(Mathf.Clamp(Plugin.Difficulty.Value, 1, 3) - 1); } Setup = Object.Instantiate<EnemySetup>(val); ((Object)Setup).name = "Enemy - SCP-1507"; if (Plugin.Rarity.Value > 0f || !Object.op_Implicit((Object)(object)val.rarityPreset)) { RarityPreset val11 = ScriptableObject.CreateInstance<RarityPreset>(); ((Object)val11).name = "Rarity - SCP-1507"; val11.chance = ((Plugin.Rarity.Value > 0f) ? Plugin.Rarity.Value : 100f); Setup.rarityPreset = val11; Object.DontDestroyOnLoad((Object)(object)val11); } Object.DontDestroyOnLoad((Object)(object)Setup); EnemyContent val12 = ScriptableObject.CreateInstance<EnemyContent>(); AccessTools.Field(typeof(EnemyContent), "_setup").SetValue(val12, Setup); AccessTools.Field(typeof(EnemyContent), "_spawnObjects").SetValue(val12, Enumerable.Repeat<GameObject>(val4, 8).ToList()); Enemies.RegisterEnemy(val12); Plugin.Log.LogInfo((object)$"Registered SCP-1507 (tier {component2.difficulty + 1}, rarity {Setup.rarityPreset?.chance}, packs {Plugin.RollPackSize()}ish, peck {Plugin.PeckDamage.Value} every {Plugin.PeckInterval:0.00}s)."); } private static Material MakeMaterial(Material baseMat, string name, string albedo, string normal, Color tint, string emission) { //IL_001a: 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_0020: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) Material val = (Object.op_Implicit((Object)(object)baseMat) ? new Material(baseMat) : new Material(Shader.Find("Standard"))); ((Object)val).name = name; Texture val2 = (Texture)(object)((albedo != null) ? Assets1507.Texture(albedo) : Texture2D.whiteTexture); Texture val3 = (Texture)(object)((normal != null) ? Assets1507.Texture(normal, linear: true) : null); Texture val4 = (Texture)(object)((emission != null) ? Assets1507.Texture(emission) : null); string[] array = new string[4] { "_BaseTexture", "_MainTex", "_BaseMap", "_AlbedoTexture" }; foreach (string text in array) { if (val.HasProperty(text)) { val.SetTexture(text, val2); } } array = new string[3] { "_BaseColor", "_Color", "_AlbedoColor" }; foreach (string text2 in array) { if (val.HasProperty(text2)) { val.SetColor(text2, tint); } } if (val.HasProperty("_NormalTexture")) { val.SetTexture("_NormalTexture", val3); } if (val.HasProperty("_BumpMap")) { val.SetTexture("_BumpMap", val3); } if (val.HasProperty("_NormalStrength")) { val.SetFloat("_NormalStrength", Object.op_Implicit((Object)(object)val3) ? 1f : 0f); } Color val5 = (Color)(Object.op_Implicit((Object)(object)val4) ? new Color(0.44f, 0.88f, 0.52f) : Color.black); if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", val5); } if (val.HasProperty("_EmissionTexture")) { val.SetTexture("_EmissionTexture", (Texture)(Object.op_Implicit((Object)(object)val4) ? ((object)val4) : ((object)Texture2D.blackTexture))); } if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(Object.op_Implicit((Object)(object)val4) ? ((object)val4) : ((object)Texture2D.blackTexture))); if (Object.op_Implicit((Object)(object)val4)) { val.EnableKeyword("_EMISSION"); } } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_MetallicTexture")) { val.SetTexture("_MetallicTexture", (Texture)(object)Texture2D.blackTexture); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.55f); } if (val.HasProperty("_SmoothnessTexture")) { val.SetTexture("_SmoothnessTexture", (Texture)(object)Texture2D.whiteTexture); } if (val.HasProperty("_FresnelAmount")) { val.SetFloat("_FresnelAmount", 0.2f); } if (val.HasProperty("_TilingX")) { val.SetFloat("_TilingX", 1f); val.SetFloat("_TilingY", 1f); } if (val.HasProperty("_OffsetX")) { val.SetFloat("_OffsetX", 0f); val.SetFloat("_OffsetY", 0f); } ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x20); return val; } private static float ColliderFloor(Transform body) { //IL_00f5: 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_0104: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) float num = float.MaxValue; Collider[] componentsInChildren = ((Component)body).GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if (val.isTrigger) { continue; } Transform transform = ((Component)val).transform; CapsuleCollider val2 = (CapsuleCollider)(object)((val is CapsuleCollider) ? val : null); IEnumerable<Vector3> enumerable; if (val2 != null) { Vector3 val3 = ((val2.direction == 0) ? Vector3.right : ((val2.direction == 1) ? Vector3.up : Vector3.forward)); float num2 = Mathf.Max(val2.height * 0.5f, val2.radius); enumerable = (IEnumerable<Vector3>)(object)new Vector3[3] { val2.center - val3 * num2, val2.center + val3 * num2, val2.center - Vector3.up * val2.radius }; } else { BoxCollider val4 = (BoxCollider)(object)((val is BoxCollider) ? val : null); if (val4 != null) { Vector3 val5 = val4.size * 0.5f; List<Vector3> list = new List<Vector3>(); for (int j = 0; j < 8; j++) { list.Add(val4.center + Vector3.Scale(val5, new Vector3((float)((j & 1) * 2 - 1), (float)((j & 2) - 1), (float)(((j & 4) >> 1) - 1)))); } enumerable = list; } else { SphereCollider val6 = (SphereCollider)(object)((val is SphereCollider) ? val : null); if (val6 == null) { continue; } enumerable = (IEnumerable<Vector3>)(object)new Vector3[1] { val6.center - Vector3.up * val6.radius }; } } foreach (Vector3 item in enumerable) { num = Mathf.Min(num, body.InverseTransformPoint(transform.TransformPoint(item)).y); } } if (num != float.MaxValue) { return num; } return 0f; } private static AudioSource NewSource(Transform parent, string name, AudioMixerGroup mixer, float maxDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.loop = false; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 1.5f; obj.maxDistance = maxDistance; obj.dopplerLevel = 0f; obj.outputAudioMixerGroup = mixer; return obj; } } internal class Gibs : MonoBehaviour { private static readonly string[][] Sets = new string[3][] { new string[3] { "gibA_1", "gibA_2", "gibA_3" }, new string[3] { "gibB_1", "gibB_2", "gibB_3" }, new string[2] { "gibC_1", "gibC_2" } }; private const float Life = 6f; private const float ShrinkTime = 1f; private float age; private Vector3 scale; public static void Burst(Transform body, Material material, Vector3 direction) { //IL_0025: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return; } if (((Vector3)(ref direction)).sqrMagnitude < 0.01f) { direction = Random.insideUnitSphere; } direction.y = Mathf.Max(0f, direction.y); ((Vector3)(ref direction)).Normalize(); int layer = LayerMask.NameToLayer("Default"); if (Object.op_Implicit((Object)(object)material)) { material = new Material(material); if (material.HasProperty("_ColorOverlayAmount")) { material.SetFloat("_ColorOverlayAmount", 0f); } Object.Destroy((Object)(object)material, 7f); } string[] array = Sets[Random.Range(0, Sets.Length)]; foreach (string text in array) { Mesh val; try { val = Assets1507.Mesh(text); } catch { continue; } GameObject val2 = new GameObject("SCP-1507 " + text) { layer = layer }; val2.transform.SetPositionAndRotation(body.position, body.rotation); val2.transform.localScale = body.lossyScale; val2.AddComponent<MeshFilter>().sharedMesh = val; ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterial = material; MeshCollider obj2 = val2.AddComponent<MeshCollider>(); obj2.sharedMesh = val; obj2.convex = true; Rigidbody obj3 = val2.AddComponent<Rigidbody>(); obj3.mass = 0.15f; obj3.interpolation = (RigidbodyInterpolation)1; obj3.collisionDetectionMode = (CollisionDetectionMode)2; Transform transform = val2.transform; Bounds bounds = val.bounds; Vector3 val3 = transform.TransformPoint(((Bounds)(ref bounds)).center) - (body.position + Vector3.up * body.lossyScale.y * 0.5f); obj3.linearVelocity = direction * Random.Range(2f, 3.5f) + ((Vector3)(ref val3)).normalized * Random.Range(1f, 2.5f) + Vector3.up * Random.Range(1.5f, 3f); obj3.angularVelocity = Random.insideUnitSphere * 12f; val2.AddComponent<Gibs>().scale = val2.transform.localScale; } } private void Update() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) age += Time.deltaTime; float num = 6f - age; if (num <= 0f) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (num < 1f) { ((Component)this).transform.localScale = scale * (num / 1f); } } } internal class Pack { public enum Mode { Rest, Wander, Investigate, Attack } private static readonly List<Pack> packs = new List<Pack>(); private static Pack pending; public readonly List<AI1507> Members = new List<AI1507>(); public Mode mode; public Vector3 Destination; public PlayerAvatar Target; public Vector3 LastSeenAt; private float lastSeen = -99f; private float timer = 3f; private float nextHonk; private Vector3 searchFrom; private int lastTick = -1; private bool hasDestination; private static readonly Dictionary<int, float> owed = new Dictionary<int, float>(); public bool Sighted => Time.time - lastSeen < 0.75f; public Vector3 Centre { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0030: 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) //IL_0063: 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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; foreach (AI1507 member in Members) { if (Object.op_Implicit((Object)(object)member) && member.Active) { val += member.Feet; num++; } } if (num <= 0) { return Destination; } return val / (float)num; } } public static void BeginNew() { packs.RemoveAll((Pack p) => p.Members.TrueForAll((AI1507 m) => !Object.op_Implicit((Object)(object)m))); pending = new Pack(); packs.Add(pending); } public static Pack Join(AI1507 bird) { if (pending == null) { BeginNew(); } pending.Members.Add(bird); return pending; } public bool IsLeader(AI1507 bird) { if (Members.Count > 0) { return (Object)(object)Members[0] == (Object)(object)bird; } return false; } public int IndexOf(AI1507 bird) { return Mathf.Max(0, Members.IndexOf(bird)); } public Vector3 Slot(AI1507 bird, float spacing, float inner) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) int num = IndexOf(bird); float num2 = (float)num * 2.39996f; float num3 = inner + spacing * Mathf.Sqrt((float)num); return new Vector3(Mathf.Cos(num2) * num3, 0f, Mathf.Sin(num2) * num3); } public void Tick() { //IL_004e: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount == lastTick) { return; } lastTick = Time.frameCount; Members.RemoveAll((AI1507 m) => !Object.op_Implicit((Object)(object)m)); if (!hasDestination) { Destination = Centre; hasDestination = true; } timer -= Time.deltaTime; switch (mode) { case Mode.Rest: if (timer <= 0f && !SemiFunc.EnemySpawnIdlePause()) { PickWander(); } break; case Mode.Wander: if (timer <= 0f || Flat(Centre, Destination) < 2.5f) { Rest(); } break; case Mode.Investigate: if (timer <= 0f) { Rest(); } else if (Flat(Centre, Destination) < 2f && timer > 2f) { Look(searchFrom, 5f); } break; case Mode.Attack: if (!Alive(Target)) { Target = null; Investigate(LastSeenAt, 6f); } else if ((!Sighted && Flat(Centre, LastSeenAt) < 2f) || Time.time - lastSeen > 6f) { Target = null; Investigate(LastSeenAt, 10f); } break; } } public bool Spot(PlayerAvatar p) { //IL_0063: 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) if (!Alive(p)) { return false; } int num; if (mode == Mode.Attack) { num = ((!Alive(Target)) ? 1 : 0); if (num == 0 && !((Object)(object)p == (Object)(object)Target)) { goto IL_0043; } } else { num = 1; } Target = p; mode = Mode.Attack; goto IL_0043; IL_0043: if ((Object)(object)p == (Object)(object)Target) { lastSeen = Time.time; LastSeenAt = ((Component)p).transform.position; } return (byte)num != 0; } public void Hear(Vector3 at) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (mode != Mode.Attack) { Investigate(at, 10f); } } public bool MayHonk(float minGap, float maxGap) { if (Time.time < nextHonk) { return false; } nextHonk = Time.time + Random.Range(minGap, maxGap); return true; } private void Rest() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) mode = Mode.Rest; timer = Random.Range(4f, 12f); Destination = Centre; } private void Investigate(Vector3 at, float time) { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) mode = Mode.Investigate; timer = time; searchFrom = at; NavMeshHit val = default(NavMeshHit); Destination = (NavMesh.SamplePosition(at, ref val, 3f, -1) ? ((NavMeshHit)(ref val)).position : at); } private void Look(Vector3 around, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Vector2 val = Random.insideUnitCircle * radius; NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(around + new Vector3(val.x, 0f, val.y), ref val2, 2f, -1)) { Destination = ((NavMeshHit)(ref val2)).position; } } private void PickWander() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) Vector3 centre = Centre; LevelPoint val = SemiFunc.LevelPointGet(centre, 8f, 25f) ?? SemiFunc.LevelPointGet(centre, 0f, 999f); NavMeshHit val2 = default(NavMeshHit); if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 4f, -1)) { mode = Mode.Wander; timer = 30f; Destination = ((NavMeshHit)(ref val2)).position; } else { Rest(); } } private static float Flat(Vector3 a, Vector3 b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) a.y = 0f; b.y = 0f; return Vector3.Distance(a, b); } public static bool Alive(PlayerAvatar p) { if (Object.op_Implicit((Object)(object)p) && !p.isDisabled) { return !p.deadSet; } return false; } public static int Owe(PlayerAvatar p, float damage) { int key = (Object.op_Implicit((Object)(object)p.photonView) ? p.photonView.ViewID : ((Object)p).GetInstanceID()); owed.TryGetValue(key, out var value); value += damage; int num = Mathf.FloorToInt(value); owed[key] = value - (float)num; return num; } } [HarmonyPatch] internal static class Patches { private static int packLeft; private static int levelTotal; private static int levelId; private static int lives; private static readonly HashSet<EnemyParent> living = new HashSet<EnemyParent>(); private static readonly HashSet<EnemyParent> dead = new HashSet<EnemyParent>(); [HarmonyPatch(typeof(EnemyDirector), "Awake")] [HarmonyPrefix] [HarmonyPriority(800)] private static void BuildBeforeDirector(EnemyDirector __instance) { try { Builder1507.BuildAndRegister(__instance); } catch (Exception ex) { Plugin.Log.LogError((object)("Failed to build SCP-1507: " + ex)); } } [HarmonyPatch(typeof(EnemyDirector), "AmountSetup")] [HarmonyPostfix] private static void Force1507(EnemyDirector __instance) { if (!Plugin.AlwaysSpawn.Value || (Object)(object)Builder1507.Setup == (Object)null) { return; } List<EnemySetup> enemyList = __instance.enemyList; int num = __instance.enemyListIndex + 1; if (!enemyList.Contains(Builder1507.Setup)) { if (num < enemyList.Count) { enemyList[num] = Builder1507.Setup; return; } enemyList.Add(Builder1507.Setup); __instance.totalAmount++; } } private static void LevelCheck() { int num = (Object.op_Implicit((Object)(object)LevelGenerator.Instance) ? ((Object)LevelGenerator.Instance).GetInstanceID() : 0); if (num != levelId) { levelId = num; levelTotal = 0; lives = 0; living.Clear(); dead.Clear(); } } private static int RoomLeft() { LevelCheck(); return Mathf.Max(0, Plugin.MaxPerLevel.Value - levelTotal); } [HarmonyPatch(typeof(LevelGenerator), "EnemySpawnBudgeted")] [HarmonyPrefix] private static void RollPack(EnemySetup _enemySetup) { if (!((Object)(object)_enemySetup == (Object)null) && !((Object)(object)_enemySetup != (Object)(object)Builder1507.Setup)) { packLeft = Mathf.Min(Plugin.RollPackSize(), RoomLeft()); Pack.BeginNew(); Plugin.Log.LogInfo((object)$"Spawning a pack of {packLeft} SCP-1507 ({levelTotal} already in this level)."); } } [HarmonyPatch(typeof(LevelGenerator), "EnemySpawnObject")] [HarmonyPrefix] private static bool LimitPack(EnemySetup _setup) { if ((Object)(object)_setup == (Object)null || (Object)(object)_setup != (Object)(object)Builder1507.Setup) { return true; } if (packLeft <= 0 || RoomLeft() <= 0) { return false; } packLeft--; levelTotal++; return true; } internal static void MarkDead(EnemyParent p) { dead.RemoveWhere((EnemyParent x) => !Object.op_Implicit((Object)(object)x)); if (Object.op_Implicit((Object)(object)p)) { dead.Add(p); living.Remove(p); } } [HarmonyPatch(typeof(EnemyParent), "Spawn")] [HarmonyPrefix] private static bool LifeCap(EnemyParent __instance) { if (!Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)((Component)__instance).GetComponentInChildren<AI1507>(true))) { return true; } LevelCheck(); if (living.Contains(__instance)) { return true; } if (Plugin.StayDead.Value && dead.Contains(__instance)) { return false; } if (lives >= Plugin.MaxPerLevel.Value) { return false; } lives++; living.Add(__instance); dead.Remove(__instance); if (lives == Plugin.MaxPerLevel.Value) { Plugin.Log.LogInfo((object)$"SCP-1507: {lives} flamingos have now lived in this level; no more will spawn."); } return true; } } [BepInPlugin("bigbootyteam.scp1507", "PinkFlamingos", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "bigbootyteam.scp1507"; public const string Name = "PinkFlamingos"; public const string Version = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<float> PeckDamage; internal static ConfigEntry<float> PeckRate; internal static ConfigEntry<float> Height; internal static ConfigEntry<float> WalkSpeed; internal static ConfigEntry<float> ChaseSpeed; internal static ConfigEntry<float> SightRange; internal static ConfigEntry<float> Rarity; internal static ConfigEntry<float> ZombieChance; internal static ConfigEntry<float> SquadChance; internal static ConfigEntry<float> JumpScale; internal static ConfigEntry<float> Spacing; internal static ConfigEntry<int> Health; internal static ConfigEntry<int> PackMin; internal static ConfigEntry<int> PackMax; internal static ConfigEntry<int> MaxPerLevel; internal static ConfigEntry<int> Difficulty; internal static ConfigEntry<bool> AlwaysSpawn; internal static ConfigEntry<bool> StayDead; internal const int MaxPack = 8; internal static float PeckInterval => Mathf.Max(0.125f, PeckDamage.Value / Mathf.Max(0.01f, PeckRate.Value)); private void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0238: Unknown result type (mig