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 Backrooms v1.1.7
Backrooms.dll
Decompiled 2 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Backrooms; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Script")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Backrooms")] [assembly: AssemblyTitle("Backrooms")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class BackLadder : MonoBehaviour { [Header("Ladder Settings")] public float climbSpeed = 3f; public PhysicMaterial stickyMaterial; public PhysicMaterial defaultMaterial; private readonly HashSet<Rigidbody> players = new HashSet<Rigidbody>(); private Collider ladderCollider; private void Awake() { ladderCollider = ((Component)this).GetComponent<Collider>(); } private void OnTriggerEnter(Collider other) { Rigidbody attachedRigidbody = other.attachedRigidbody; if (Object.op_Implicit((Object)(object)attachedRigidbody)) { players.Add(attachedRigidbody); if (Object.op_Implicit((Object)(object)ladderCollider) && Object.op_Implicit((Object)(object)stickyMaterial)) { ladderCollider.material = stickyMaterial; } } } private void OnTriggerExit(Collider other) { Rigidbody attachedRigidbody = other.attachedRigidbody; if (Object.op_Implicit((Object)(object)attachedRigidbody)) { players.Remove(attachedRigidbody); if (players.Count == 0 && Object.op_Implicit((Object)(object)ladderCollider) && Object.op_Implicit((Object)(object)defaultMaterial)) { ladderCollider.material = defaultMaterial; } } } private void FixedUpdate() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } foreach (Rigidbody player in players) { if (Object.op_Implicit((Object)(object)player) && IsLocalPlayer(player)) { Vector3 velocity = player.velocity; float axisRaw = Input.GetAxisRaw("Vertical"); if (Mathf.Abs(axisRaw) > 0.01f) { velocity.y = axisRaw * climbSpeed; } else { velocity.y = Mathf.Lerp(velocity.y, 0f, 0.5f); } player.velocity = velocity; } } } private bool IsLocalPlayer(Rigidbody rb) { return ((Component)rb).CompareTag("Player"); } } public class PlaneMoverToggle : MonoBehaviourPun, IPunObservable { private enum ElevatorState { Idle, ClosingDoors, MovingPlatform, OpeningDoors } private enum SoundEvent { DoorOpen, DoorClose, ArrivalDing } [Header("Platform Settings")] public Transform floor; public Transform pointA; public Transform pointB; public float speed = 2f; private Rigidbody floorRb; private bool movingToB = true; private bool isMoving = false; private bool isAtPointA = true; private bool hasPlayedOpenSound = false; private Vector3 networkPosition; private Vector3 velocity = Vector3.zero; [Header("Door Settings")] public float doorSpeed = 2f; public float doorCloseDelay = 1f; public float doorOpenDelay = 0.5f; [Header("Top Door")] public Transform topDoor; public Transform topDoorOpenPoint; public Transform topDoorClosedPoint; public AudioSource topDoorAudioSource; public AudioClip topDoorSound; [Header("Bottom Door")] public Transform bottomDoor; public Transform bottomDoorOpenPoint; public Transform bottomDoorClosedPoint; public AudioSource bottomDoorAudioSource; public AudioClip bottomDoorSound; [Header("Arrival Ding")] public AudioClip arrivalDing; public AudioSource topArrivalAudioSource; public AudioSource bottomArrivalAudioSource; [Header("Elevator Music")] public AudioClip elevatorMusic; public AudioSource elevatorMusicSource; private bool isMultiplayer; private ElevatorState state = ElevatorState.Idle; private float doorTimer = 0f; private Vector3 topDoorTargetPos; private Vector3 bottomDoorTargetPos; private void Start() { //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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) floorRb = ((Component)floor).GetComponent<Rigidbody>(); isMultiplayer = PhotonNetwork.IsConnected && PhotonNetwork.InRoom; if (isMultiplayer && ((MonoBehaviourPun)this).photonView.IsMine) { PhotonNetwork.SendRate = 20; PhotonNetwork.SerializationRate = 10; } networkPosition = floor.position; topDoorTargetPos = topDoor.position; bottomDoorTargetPos = bottomDoor.position; } private void FixedUpdate() { //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_00b3: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)floorRb) || !Object.op_Implicit((Object)(object)pointA) || !Object.op_Implicit((Object)(object)pointB)) { return; } if (!isMultiplayer || ((MonoBehaviourPun)this).photonView.IsMine) { switch (state) { case ElevatorState.ClosingDoors: HandleDoorClosing(); break; case ElevatorState.MovingPlatform: MovePlatform(); break; case ElevatorState.OpeningDoors: HandleDoorOpening(); break; } } else { floor.position = Vector3.SmoothDamp(floor.position, networkPosition, ref velocity, 0.1f); topDoor.position = Vector3.Lerp(topDoor.position, topDoorTargetPos, Time.fixedDeltaTime * doorSpeed); bottomDoor.position = Vector3.Lerp(bottomDoor.position, bottomDoorTargetPos, Time.fixedDeltaTime * doorSpeed); } } public void TriggerNextMove() { if (state == ElevatorState.Idle) { state = ElevatorState.ClosingDoors; doorTimer = doorCloseDelay; PlaySyncedSound(SoundEvent.DoorClose, GetCurrentDoorAudioSource()); } } private void HandleDoorClosing() { if (!MoveDoor(GetCurrentDoor(), GetCurrentDoorClosedPoint(), doorSpeed)) { return; } if (doorTimer > 0f) { doorTimer -= Time.fixedDeltaTime; return; } state = ElevatorState.MovingPlatform; isMoving = true; if (Object.op_Implicit((Object)(object)elevatorMusic) && Object.op_Implicit((Object)(object)elevatorMusicSource)) { elevatorMusicSource.Play(); } } private void MovePlatform() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (movingToB ? pointB.position : pointA.position); Vector3 val2 = Vector3.MoveTowards(floor.position, val, speed * Time.fixedDeltaTime); floorRb.MovePosition(val2); if (Vector3.Distance(floor.position, val) < 0.01f) { isMoving = false; isAtPointA = !movingToB; movingToB = !movingToB; doorTimer = doorOpenDelay; state = ElevatorState.OpeningDoors; if (Object.op_Implicit((Object)(object)elevatorMusicSource) && elevatorMusicSource.isPlaying) { elevatorMusicSource.Stop(); } PlaySyncedSound(SoundEvent.ArrivalDing, null); } } private void HandleDoorOpening() { if (doorTimer > 0f) { doorTimer -= Time.fixedDeltaTime; return; } if (state != ElevatorState.MovingPlatform && !hasPlayedOpenSound) { PlaySyncedSound(SoundEvent.DoorOpen, GetCurrentDoorAudioSource()); hasPlayedOpenSound = true; } if (MoveDoor(GetCurrentDoor(), GetCurrentDoorOpenPoint(), doorSpeed)) { state = ElevatorState.Idle; hasPlayedOpenSound = false; } } private bool MoveDoor(Transform door, Transform targetPoint, float speed) { //IL_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)door) || !Object.op_Implicit((Object)(object)targetPoint)) { return true; } Vector3 position = Vector3.MoveTowards(door.position, targetPoint.position, speed * Time.fixedDeltaTime); door.position = position; if (((MonoBehaviourPun)this).photonView.IsMine) { if ((Object)(object)door == (Object)(object)topDoor) { topDoorTargetPos = targetPoint.position; } if ((Object)(object)door == (Object)(object)bottomDoor) { bottomDoorTargetPos = targetPoint.position; } } return Vector3.Distance(door.position, targetPoint.position) < 0.01f; } private void PlaySyncedSound(SoundEvent sound, AudioSource source) { string text = (Object.op_Implicit((Object)(object)source) ? ((Object)((Component)source).gameObject).name : ""); if (isMultiplayer) { ((MonoBehaviourPun)this).photonView.RPC("RPC_PlaySound", (RpcTarget)0, new object[2] { (int)sound, text }); } else { PlaySound(sound, source); } } [PunRPC] private void RPC_PlaySound(int soundType, string sourceName) { object obj; if (string.IsNullOrEmpty(sourceName)) { obj = null; } else { GameObject obj2 = GameObject.Find(sourceName); obj = ((obj2 != null) ? obj2.GetComponent<AudioSource>() : null); } AudioSource src = (AudioSource)obj; PlaySound((SoundEvent)soundType, src); } private void PlaySound(SoundEvent soundType, AudioSource src) { switch (soundType) { case SoundEvent.DoorOpen: if (Object.op_Implicit((Object)(object)src) && Object.op_Implicit((Object)(object)GetCurrentDoorSound())) { src.PlayOneShot(GetCurrentDoorSound()); } break; case SoundEvent.DoorClose: if (Object.op_Implicit((Object)(object)src) && Object.op_Implicit((Object)(object)GetCurrentDoorSound())) { src.PlayOneShot(GetCurrentDoorSound()); } break; case SoundEvent.ArrivalDing: if (!isAtPointA && Object.op_Implicit((Object)(object)bottomArrivalAudioSource) && Object.op_Implicit((Object)(object)arrivalDing)) { bottomArrivalAudioSource.PlayOneShot(arrivalDing); } else if (isAtPointA && Object.op_Implicit((Object)(object)topArrivalAudioSource) && Object.op_Implicit((Object)(object)arrivalDing)) { topArrivalAudioSource.PlayOneShot(arrivalDing); } break; } } private Transform GetCurrentDoor() { return isAtPointA ? topDoor : bottomDoor; } private Transform GetCurrentDoorOpenPoint() { return isAtPointA ? topDoorOpenPoint : bottomDoorOpenPoint; } private Transform GetCurrentDoorClosedPoint() { return isAtPointA ? topDoorClosedPoint : bottomDoorClosedPoint; } private AudioSource GetCurrentDoorAudioSource() { return isAtPointA ? topDoorAudioSource : bottomDoorAudioSource; } private AudioClip GetCurrentDoorSound() { return isAtPointA ? topDoorSound : bottomDoorSound; } public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (isMultiplayer) { if (stream.IsWriting) { stream.SendNext((object)floor.position); stream.SendNext((object)topDoor.position); stream.SendNext((object)bottomDoor.position); } else { networkPosition = (Vector3)stream.ReceiveNext(); topDoorTargetPos = (Vector3)stream.ReceiveNext(); bottomDoorTargetPos = (Vector3)stream.ReceiveNext(); } } } } [BepInPlugin("com.Backrooms.LevelGeneration", "Backrooms LevelGeneration", "1.2.0")] public class LevelGeneration : BaseUnityPlugin { private bool backroomsActive = false; private float previousModuleWidth = 0f; private bool previousSaved = false; private void Awake() { SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneUnloaded -= OnSceneUnloaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (((Scene)(ref scene)).name != "Main") { return; } try { Level val = RunManager.instance?.levelCurrent; if ((Object)(object)val == (Object)null) { return; } string name = ((Object)val).name; if (name == "Level - Backrooms") { if (!previousSaved) { previousModuleWidth = LevelGenerator.ModuleWidth; previousSaved = true; } LevelGenerator.ModuleWidth = 6f; backroomsActive = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Backrooms detected — ModuleWidth set to 6."); ApplySettings(); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"LevelGeneration error (OnSceneLoaded): {arg}"); } } private void OnSceneUnloaded(Scene unloadedScene) { if (!backroomsActive || ((Scene)(ref unloadedScene)).name != "Main") { return; } try { if (previousSaved) { LevelGenerator.ModuleWidth = previousModuleWidth; previousSaved = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Left Backrooms — ModuleWidth restored to {previousModuleWidth}."); } backroomsActive = false; } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"LevelGeneration error (OnSceneUnloaded): {arg}"); } } public void ApplySettings() { if (!backroomsActive) { return; } bool navigationConfig = global::Backrooms.Backrooms.Instance.NavigationConfig; bool enableMinimap = global::Backrooms.Backrooms.Instance.EnableMinimap; bool disableAmbience = global::Backrooms.Backrooms.Instance.DisableAmbience; GameObject val = GameObject.Find("Map"); if ((Object)(object)val != (Object)null) { if (!navigationConfig) { Transform obj = val.transform.Find("Backtracker"); GameObject val2 = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val2 != (Object)null) { val2.SetActive(false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Backtracker disabled (NavigationConfig = FALSE)."); } } if (!enableMinimap) { Transform obj2 = val.transform.Find("Map Controller"); GameObject val3 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val3 != (Object)null) { val3.SetActive(false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Map Controller disabled (EnableMinimap = FALSE)."); } } } if (disableAmbience) { return; } GameObject val4 = GameObject.Find("Audio Manager"); if ((Object)(object)val4 != (Object)null) { Transform obj3 = val4.transform.Find("Ambience Loop"); GameObject val5 = ((obj3 != null) ? ((Component)obj3).gameObject : null); if ((Object)(object)val5 != (Object)null) { val5.SetActive(false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Ambience Loop disabled (DisableAmbience = FALSE)."); } } } } public class LevelPointVisualizer : MonoBehaviour { private LevelPoint[] levelPoints; private BoxCollider levelPointTrigger; private Vector3 offset = new Vector3(0.1f, 0f, 0.1f); private void OnDrawGizmos() { //IL_0072: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0199: 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_0116: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) levelPoints = ((Component)this).GetComponentsInChildren<LevelPoint>(); if (levelPoints == null || levelPoints.Length == 0) { return; } LevelPoint[] array = levelPoints; LevelPoint[] array2 = array; foreach (LevelPoint val in array2) { levelPointTrigger = ((Component)val).gameObject.GetComponent<BoxCollider>(); if (val.ModuleConnect) { Gizmos.color = Color.yellow; } else { Gizmos.color = Color.green; } Gizmos.DrawCube(((Component)val).transform.position + levelPointTrigger.center, levelPointTrigger.size); if (val.ConnectedPoints == null || levelPoints.Length == 0) { continue; } foreach (LevelPoint connectedPoint in val.ConnectedPoints) { List<LevelPoint> connectedPoints = connectedPoint.ConnectedPoints; if (connectedPoints.Contains(val)) { Gizmos.color = Color.green; Gizmos.DrawLine(((Component)connectedPoint).transform.position + offset, ((Component)val).transform.position + offset); Gizmos.DrawLine(((Component)val).transform.position - offset, ((Component)connectedPoint).transform.position - offset); } else { Gizmos.color = Color.red; Gizmos.DrawLine(((Component)connectedPoint).transform.position, ((Component)val).transform.position); } } } } } public class PlaneMover : MonoBehaviourPun { [CompilerGenerated] private sealed class <MoveLoop>d__11 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PlaneMover <>4__this; private int <nextIndex>5__1; private Vector3 <target>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MoveLoop>d__11(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00ba; } <>1__state = -1; goto IL_01d5; IL_00ba: if (Vector3.Distance(((Component)<>4__this).transform.position, <target>5__2) > 0.001f) { ((Component)<>4__this).transform.position = Vector3.MoveTowards(((Component)<>4__this).transform.position, <target>5__2, <>4__this.speed * Time.deltaTime); <>2__current = null; <>1__state = 1; return true; } ((Component)<>4__this).transform.position = <target>5__2; <>4__this.currentIndex = <nextIndex>5__1; if (<>4__this.currentIndex == <>4__this.points.Length - 1) { <>4__this.dir = -1; } else if (<>4__this.currentIndex == 0) { <>4__this.dir = 1; } if (<>4__this.isMultiplayer && PhotonNetwork.IsMasterClient) { ((MonoBehaviourPun)<>4__this).photonView.RPC("StartNextLegRPC", (RpcTarget)0, new object[2] { <>4__this.currentIndex, <>4__this.dir }); } if (<>4__this.isMultiplayer && !PhotonNetwork.IsMasterClient) { return false; } goto IL_01d5; IL_01d5: <nextIndex>5__1 = <>4__this.currentIndex + <>4__this.dir; <target>5__2 = <>4__this.points[<nextIndex>5__1]; goto IL_00ba; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [Header("Waypoints")] public Transform pointA; public Transform pointB; [Header("Movement")] public float speed = 2f; private Vector3[] points; private int currentIndex = 0; private int dir = 1; private Coroutine moveRoutine; private bool isMultiplayer; private void Start() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pointA == (Object)null || (Object)(object)pointB == (Object)null) { Debug.LogError((object)"[PlaneMoverV2] Missing pointA or pointB."); ((Behaviour)this).enabled = false; return; } points = (Vector3[])(object)new Vector3[2]; points[0] = pointA.position; points[1] = pointB.position; isMultiplayer = PhotonNetwork.IsConnected && PhotonNetwork.InRoom; if (!isMultiplayer) { StartMovementLocal(); } else if (PhotonNetwork.IsMasterClient) { ((MonoBehaviourPun)this).photonView.RPC("StartMovementRPC", (RpcTarget)0, new object[3] { currentIndex, dir, speed }); } } [PunRPC] private void StartMovementRPC(int startIndex, int direction, float moveSpeed) { currentIndex = startIndex; dir = direction; speed = moveSpeed; StartMovementLocal(); } private void StartMovementLocal() { if (moveRoutine != null) { ((MonoBehaviour)this).StopCoroutine(moveRoutine); } moveRoutine = ((MonoBehaviour)this).StartCoroutine(MoveLoop()); } [IteratorStateMachine(typeof(<MoveLoop>d__11))] private IEnumerator MoveLoop() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MoveLoop>d__11(0) { <>4__this = this }; } [PunRPC] private void StartNextLegRPC(int newIndex, int newDir) { currentIndex = newIndex; dir = newDir; if (moveRoutine != null) { ((MonoBehaviour)this).StopCoroutine(moveRoutine); } moveRoutine = ((MonoBehaviour)this).StartCoroutine(MoveLoop()); } } public class ValuableVolumeVisualizer : MonoBehaviour { private void OnDrawGizmos() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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) BoxCollider component = ((Component)this).GetComponent<BoxCollider>(); Gizmos.color = new Color(1f, 1.18f, 0f, 6f); Gizmos.matrix = ((Component)this).transform.localToWorldMatrix; Gizmos.DrawWireCube(component.center, component.size); Gizmos.color = new Color(1f, 1.18f, 0f, 0.2f); Gizmos.DrawCube(component.center, component.size); Gizmos.color = Color.white; Gizmos.matrix = Matrix4x4.identity; Bounds bounds = ((Collider)component).bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 val = center + ((Component)this).transform.forward * 0.5f; Gizmos.DrawLine(center, val); Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, -((Component)this).transform.right, 0.5f) * 0.25f); Gizmos.DrawLine(val, val + Vector3.LerpUnclamped(-((Component)this).transform.forward, ((Component)this).transform.right, 0.5f) * 0.25f); } } namespace Backrooms { [BepInPlugin("Backrooms", "Backrooms", "1.1.6")] public class Backrooms : BaseUnityPlugin { private ConfigEntry<bool> navigationConfig; private ConfigEntry<bool> enableMinimap; private ConfigEntry<bool> disableAmbience; internal static Backrooms Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } public bool NavigationConfig => navigationConfig.Value; public bool EnableMinimap => enableMinimap.Value; public bool DisableAmbience => disableAmbience.Value; private void Awake() { Instance = this; navigationConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Minimap Navigation", true, "If FALSE, disables mini-map navigation in the Backrooms."); enableMinimap = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Minimap", true, "If FALSE, disables mini-map in the Backrooms."); disableAmbience = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio", "Disable Ambience", true, "If FALSE, disables lighting ambience in the Backrooms."); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded."); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { Backrooms.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { Backrooms.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } }