using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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: AssemblyTitle("EmptyChildMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmptyChildMod")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eb22faed-b405-4d38-9eb8-cae6b316dbed")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TARDISMod;
[BepInPlugin("com.you.tardisroom", "TARDIS Room Loader", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public class PlaySoundOnPhysGrab : MonoBehaviour
{
private PhysGrabObject physGrab;
private AudioSource audioSource;
private bool wasGrabbedLastFrame = false;
private void Awake()
{
physGrab = ((Component)this).GetComponent<PhysGrabObject>();
audioSource = ((Component)this).gameObject.GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.spatialBlend = 1f;
audioSource.minDistance = 1f;
audioSource.maxDistance = 10f;
if ((Object)(object)TARDISGrabSound != (Object)null)
{
audioSource.clip = TARDISGrabSound;
}
}
private void Update()
{
if (!((Object)(object)physGrab == (Object)null))
{
bool flag = physGrab.playerGrabbing != null && physGrab.playerGrabbing.Count > 0;
if (flag && !wasGrabbedLastFrame && (Object)(object)audioSource.clip != (Object)null)
{
audioSource.PlayOneShot(audioSource.clip);
}
wasGrabbedLastFrame = flag;
}
}
}
public static class NightMusicPatch
{
public static void Postfix(ConstantMusic __instance, ref bool ___setup)
{
if (!(((Object)((Component)__instance).gameObject).name != "Outside Night Music") && ___setup && !((Object)(object)TARDISNightSound == (Object)null))
{
AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)TARDISNightSound))
{
component.Stop();
component.clip = TARDISNightSound;
component.loop = true;
component.Play();
component.volume = 1f;
Log.LogInfo((object)"TARDIS: 'Outside Night Music' found and swapped to TARDIS Night Sound.");
}
}
}
}
public class ProximityLookAwayDisappear : MonoBehaviour
{
[CompilerGenerated]
private sealed class <Dematerialise>d__17 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ProximityLookAwayDisappear <>4__this;
private float <timer>5__1;
private List<Renderer>.Enumerator <>s__2;
private Renderer <r>5__3;
private Material[] <>s__4;
private int <>s__5;
private Material <m>5__6;
private float <progress>5__7;
private float <pulse>5__8;
private float <alpha>5__9;
private List<Renderer>.Enumerator <>s__10;
private Renderer <r>5__11;
private Material[] <>s__12;
private int <>s__13;
private Material <m>5__14;
private Color <c>5__15;
private List<Renderer>.Enumerator <>s__16;
private Renderer <r>5__17;
private Collider[] <>s__18;
private int <>s__19;
private Collider <col>5__20;
private Light[] <>s__21;
private int <>s__22;
private Light <lit>5__23;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Dematerialise>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__2 = default(List<Renderer>.Enumerator);
<r>5__3 = null;
<>s__4 = null;
<m>5__6 = null;
<>s__10 = default(List<Renderer>.Enumerator);
<r>5__11 = null;
<>s__12 = null;
<m>5__14 = null;
<>s__16 = default(List<Renderer>.Enumerator);
<r>5__17 = null;
<>s__18 = null;
<col>5__20 = null;
<>s__21 = null;
<lit>5__23 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(<>4__this.audioDelay);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)<>4__this.audioSource != (Object)null)
{
((Component)<>4__this.audioSource).transform.SetParent((Transform)null);
}
<>s__2 = <>4__this.renderers.GetEnumerator();
try
{
while (<>s__2.MoveNext())
{
<r>5__3 = <>s__2.Current;
<>s__4 = <r>5__3.materials;
for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
{
<m>5__6 = <>s__4[<>s__5];
<>4__this.SetMaterialTransparent(<m>5__6);
<m>5__6 = null;
}
<>s__4 = null;
<r>5__3 = null;
}
}
finally
{
((IDisposable)<>s__2).Dispose();
}
<>s__2 = default(List<Renderer>.Enumerator);
<timer>5__1 = 0f;
break;
case 2:
<>1__state = -1;
break;
}
if (<timer>5__1 < <>4__this.dematDuration)
{
<timer>5__1 += Time.deltaTime;
<progress>5__7 = <timer>5__1 / <>4__this.dematDuration;
<pulse>5__8 = Mathf.Sin(<timer>5__1 * <>4__this.pulseSpeed * (float)Math.PI * 2f) * <>4__this.pulseStrength * (1f - <progress>5__7);
<alpha>5__9 = Mathf.Clamp01(1f - <progress>5__7 + <pulse>5__8);
<>s__10 = <>4__this.renderers.GetEnumerator();
try
{
while (<>s__10.MoveNext())
{
<r>5__11 = <>s__10.Current;
<>s__12 = <r>5__11.materials;
for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++)
{
<m>5__14 = <>s__12[<>s__13];
if (<>4__this.originalColors.TryGetValue(<m>5__14, out <c>5__15))
{
if (((Object)<m>5__14).name.Contains("New Material2"))
{
<m>5__14.EnableKeyword("_EMISSION");
<m>5__14.SetColor("_EmissionColor", Color.white * 2f);
}
<c>5__15.a = <alpha>5__9;
if (<m>5__14.HasProperty("_BaseColor"))
{
<m>5__14.SetColor("_BaseColor", <c>5__15);
}
else if (<m>5__14.HasProperty("_Color"))
{
<m>5__14.SetColor("_Color", <c>5__15);
}
<m>5__14 = null;
}
}
<>s__12 = null;
<r>5__11 = null;
}
}
finally
{
((IDisposable)<>s__10).Dispose();
}
<>s__10 = default(List<Renderer>.Enumerator);
<>2__current = null;
<>1__state = 2;
return true;
}
<>s__16 = <>4__this.renderers.GetEnumerator();
try
{
while (<>s__16.MoveNext())
{
<r>5__17 = <>s__16.Current;
<r>5__17.enabled = false;
<r>5__17 = null;
}
}
finally
{
((IDisposable)<>s__16).Dispose();
}
<>s__16 = default(List<Renderer>.Enumerator);
<>s__18 = <>4__this.targetObject.GetComponentsInChildren<Collider>(true);
for (<>s__19 = 0; <>s__19 < <>s__18.Length; <>s__19++)
{
<col>5__20 = <>s__18[<>s__19];
<col>5__20.enabled = false;
<col>5__20 = null;
}
<>s__18 = null;
<>s__21 = <>4__this.targetObject.GetComponentsInChildren<Light>(true);
for (<>s__22 = 0; <>s__22 < <>s__21.Length; <>s__22++)
{
<lit>5__23 = <>s__21[<>s__22];
((Behaviour)<lit>5__23).enabled = false;
<lit>5__23 = null;
}
<>s__21 = null;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("Target")]
public GameObject targetObject;
[Header("Activation Anchor")]
public Transform activationAnchor;
[Header("Distances")]
public float activationDistance = 2.5f;
public float disappearDistance = 6f;
[Header("Audio")]
public AudioSource audioSource;
public AudioClip disappearClip;
[Header("Dematerialisation")]
public float audioDelay = 1.5f;
public float dematDuration = 16.5f;
public float pulseStrength = 0.6f;
public float pulseSpeed = 0.6f;
private bool activated = false;
private bool triggered = false;
private List<Renderer> renderers = new List<Renderer>();
private Dictionary<Material, Color> originalColors = new Dictionary<Material, Color>();
private void Start()
{
//IL_00be: 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)
if ((Object)(object)targetObject == (Object)null)
{
targetObject = ((Component)this).gameObject;
}
if ((Object)(object)activationAnchor == (Object)null)
{
activationAnchor = targetObject.transform;
}
renderers.AddRange(targetObject.GetComponentsInChildren<Renderer>(true));
foreach (Renderer renderer in renderers)
{
Material[] materials = renderer.materials;
foreach (Material val in materials)
{
if (!originalColors.ContainsKey(val))
{
if (val.HasProperty("_BaseColor"))
{
originalColors[val] = val.GetColor("_BaseColor");
}
else if (val.HasProperty("_Color"))
{
originalColors[val] = val.GetColor("_Color");
}
}
}
}
}
private void Update()
{
//IL_0027: 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 (triggered || (Object)(object)Camera.main == (Object)null)
{
return;
}
float num = Vector3.Distance(((Component)Camera.main).transform.position, activationAnchor.position);
if (!activated)
{
if (num <= activationDistance)
{
activated = true;
}
}
else if (num >= disappearDistance)
{
TriggerDisappear();
}
}
private void TriggerDisappear()
{
triggered = true;
if ((Object)(object)audioSource != (Object)null && (Object)(object)disappearClip != (Object)null)
{
audioSource.PlayOneShot(disappearClip);
}
((MonoBehaviour)this).StartCoroutine(Dematerialise());
}
[IteratorStateMachine(typeof(<Dematerialise>d__17))]
private IEnumerator Dematerialise()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Dematerialise>d__17(0)
{
<>4__this = this
};
}
private void SetMaterialTransparent(Material mat)
{
if (mat.HasProperty("_Surface"))
{
mat.SetFloat("_Surface", 1f);
mat.SetFloat("_ZWrite", 0f);
mat.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
mat.renderQueue = 3000;
}
else
{
mat.SetFloat("_Mode", 3f);
mat.SetInt("_SrcBlend", 5);
mat.SetInt("_DstBlend", 10);
mat.SetInt("_ZWrite", 0);
mat.EnableKeyword("_ALPHABLEND_ON");
mat.renderQueue = 3000;
}
}
}
public static class PrefabSwapPatch
{
public static void Postfix(string name, Type type, ref Object __result)
{
if (!((Object)(object)TARDISPrefab == (Object)null) && !string.IsNullOrEmpty(name) && name.Contains("Treasure Trove"))
{
Log.LogInfo((object)("TARDIS: Swapping asset load -> " + name));
__result = (Object)(object)TARDISPrefab;
}
}
}
public static class ShopMusicPatch
{
public static void Postfix(AmbienceLoop __instance)
{
//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)
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (name.ToLower().Contains("shop") && !((Object)(object)TARDISMenuTheme == (Object)null))
{
AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)TARDISMenuTheme))
{
component.Stop();
component.clip = TARDISMenuTheme;
component.loop = true;
component.volume = 0.315f;
component.spatialBlend = 1f;
component.dopplerLevel = 0f;
component.rolloffMode = (AudioRolloffMode)2;
component.maxDistance = 20f;
component.Play();
Log.LogInfo((object)("TARDIS: Shop music swapped on " + ((Object)((Component)__instance).gameObject).name + " (3D Settings applied)."));
}
}
}
}
public static class MenuMusicPatch
{
public static void Postfix(ConstantMusic __instance, ref bool ___setup)
{
if (___setup && !((Object)(object)TARDISMenuTheme == (Object)null))
{
AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)TARDISMenuTheme))
{
component.Stop();
component.clip = TARDISMenuTheme;
component.loop = true;
component.Play();
Log.LogInfo((object)"TARDIS: Menu music successfully swapped via manual patch.");
}
}
}
}
public static class ComponentInjectorPatch
{
public static void Postfix(Object original, ref Object __result)
{
//IL_0079: 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)
Object obj = __result;
GameObject val = (GameObject)(object)((obj is GameObject) ? obj : null);
if (val == null)
{
return;
}
if (((Object)val).name.Contains("Treasure Trove") && (Object)(object)val.transform.Find("TARDIS_Model") == (Object)null)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)"TARDIS: Vanilla Treasure Trove detected. Replacing...");
if ((Object)(object)TARDISPrefab != (Object)null)
{
GameObject val2 = Object.Instantiate<GameObject>(TARDISPrefab, val.transform.position, val.transform.rotation);
Instance.SetupTARDISComponents(val2);
Object.Destroy((Object)(object)val);
__result = (Object)(object)val2;
}
else
{
((BaseUnityPlugin)Instance).Logger.LogError((object)"TARDIS: Prefab is null, cannot replace!");
}
}
else if (((Object)val).name.Contains("Tardis") || (Object)(object)val.transform.Find("TARDIS_Model") != (Object)null)
{
Instance.SetupTARDISComponents(val);
}
}
}
public class TARDISFlightScroller : MonoBehaviour
{
public float scrollSpeed = 11000f;
public float maxDistanceX = 250f;
private float offsetX = -150f;
public float rotationSpeed = 460f;
public float forwardTilt = 0f;
public float sideLean = -20f;
private float currentYRotation = 0f;
private void Start()
{
TruckLandscapeScroller componentInParent = ((Component)this).GetComponentInParent<TruckLandscapeScroller>();
if ((Object)(object)componentInParent != (Object)null)
{
scrollSpeed = componentInParent.truckSpeed * 15f;
}
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_0071: 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)
Transform transform = ((Component)this).transform;
transform.localPosition += Vector3.right * scrollSpeed * Time.deltaTime;
if (((Component)this).transform.localPosition.x > maxDistanceX)
{
((Component)this).transform.localPosition = new Vector3(offsetX, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z);
}
currentYRotation += rotationSpeed * Time.deltaTime;
Quaternion val = Quaternion.Euler(0f, currentYRotation, 0f);
Quaternion val2 = Quaternion.Euler(forwardTilt, 0f, sideLean);
((Component)this).transform.localRotation = val2 * val;
}
}
[CompilerGenerated]
private sealed class <GlobalPaintingSweep>d__13 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
private MeshRenderer[] <allRenderers>5__1;
private int <replacedCount>5__2;
private MeshRenderer[] <>s__3;
private int <>s__4;
private MeshRenderer <renderer>5__5;
private string <objName>5__6;
private Material[] <mats>5__7;
private bool <hasChanged>5__8;
private int <i>5__9;
private string <matName>5__10;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GlobalPaintingSweep>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<allRenderers>5__1 = null;
<>s__3 = null;
<renderer>5__5 = null;
<objName>5__6 = null;
<mats>5__7 = null;
<matName>5__10 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(4f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Log.LogInfo((object)"TARDIS: Starting Global Painting Sweep...");
<allRenderers>5__1 = Object.FindObjectsOfType<MeshRenderer>(true);
<replacedCount>5__2 = 0;
<>s__3 = <allRenderers>5__1;
for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
{
<renderer>5__5 = <>s__3[<>s__4];
<objName>5__6 = ((Object)((Component)<renderer>5__5).gameObject).name.ToLower();
if (<objName>5__6.Contains("painting"))
{
<mats>5__7 = ((Renderer)<renderer>5__5).materials;
<hasChanged>5__8 = false;
<i>5__9 = 0;
while (<i>5__9 < <mats>5__7.Length)
{
if (!((Object)(object)<mats>5__7[<i>5__9] == (Object)null))
{
<matName>5__10 = ((Object)<mats>5__7[<i>5__9]).name.ToLower();
if (<matName>5__10.Contains("v_furman") && (Object)(object)ReplacementMaterial != (Object)null)
{
<mats>5__7[<i>5__9] = ReplacementMaterial;
<hasChanged>5__8 = true;
<replacedCount>5__2++;
}
else if (<matName>5__10.Contains("h_landscape") && (Object)(object)LandscapeReplacement != (Object)null)
{
<mats>5__7[<i>5__9] = LandscapeReplacement;
<hasChanged>5__8 = true;
<replacedCount>5__2++;
}
<matName>5__10 = null;
}
<i>5__9++;
}
if (<hasChanged>5__8)
{
((Renderer)<renderer>5__5).materials = <mats>5__7;
Log.LogInfo((object)("TARDIS: Replaced painting on object: " + ((Object)((Component)<renderer>5__5).gameObject).name));
}
<mats>5__7 = null;
}
<objName>5__6 = null;
<renderer>5__5 = null;
}
<>s__3 = null;
Log.LogInfo((object)$"TARDIS: Sweep complete. Total paintings replaced: {<replacedCount>5__2}");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MainWorldMusicMonitor>d__20 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
private bool <musicHijacked>5__1;
private AudioSource[] <allSources>5__2;
private IOrderedEnumerable<AudioSource> <sortedSources>5__3;
private IEnumerator<AudioSource> <>s__4;
private AudioSource <source>5__5;
private string <clipName>5__6;
private bool <isForbiddenClip>5__7;
private bool <isAlreadyTardis>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MainWorldMusicMonitor>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<allSources>5__2 = null;
<sortedSources>5__3 = null;
<>s__4 = null;
<source>5__5 = null;
<clipName>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<musicHijacked>5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)LevelGenerator.Instance != (Object)null && LevelGenerator.Instance.Generated)
{
if (!<musicHijacked>5__1)
{
<allSources>5__2 = Object.FindObjectsOfType<AudioSource>();
<sortedSources>5__3 = <allSources>5__2.OrderByDescending((AudioSource s) => (Object)(object)s.clip != (Object)null && ((Object)s.clip).name.ToLower().Contains("music"));
<>s__4 = <sortedSources>5__3.GetEnumerator();
try
{
while (<>s__4.MoveNext())
{
<source>5__5 = <>s__4.Current;
if ((Object)(object)<source>5__5.clip == (Object)null)
{
continue;
}
<clipName>5__6 = ((Object)<source>5__5.clip).name.ToLower();
<isForbiddenClip>5__7 = <clipName>5__6.Contains("prop") || <clipName>5__6.Contains("truck") || <clipName>5__6.Contains("player") || <clipName>5__6.Contains("phys") || <clipName>5__6.Contains("grabber") || <clipName>5__6.Contains("move") || <clipName>5__6.Contains("tumble") || <clipName>5__6.Contains("ambience") || <clipName>5__6.Contains("ambient");
if (!<isForbiddenClip>5__7)
{
<isAlreadyTardis>5__8 = (Object)(object)<source>5__5.clip == (Object)(object)TARDISMenuTheme;
if (<source>5__5.loop && !<isAlreadyTardis>5__8)
{
Log.LogInfo((object)("TARDIS: Target Found! Original Clip Asset: '" + ((Object)<source>5__5.clip).name + "'"));
<source>5__5.Stop();
<source>5__5.clip = TARDISMenuTheme;
<source>5__5.volume = 0.315f;
<source>5__5.spatialBlend = 1f;
<source>5__5.maxDistance = 20f;
<source>5__5.rolloffMode = (AudioRolloffMode)2;
<source>5__5.Play();
Log.LogInfo((object)("TARDIS: Hijack complete. '" + <clipName>5__6 + "' is now the TARDIS theme."));
<musicHijacked>5__1 = true;
break;
}
<clipName>5__6 = null;
<source>5__5 = null;
}
}
}
finally
{
if (<>s__4 != null)
{
<>s__4.Dispose();
}
}
<>s__4 = null;
<allSources>5__2 = null;
<sortedSources>5__3 = null;
}
}
else
{
<musicHijacked>5__1 = false;
}
<>2__current = (object)new WaitForSeconds(3f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MenuSpawnMonitor>d__24 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
private GameObject <anchor>5__1;
private TruckLandscapeScroller <scroller>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MenuSpawnMonitor>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<anchor>5__1 = null;
<scroller>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
<anchor>5__1 = null;
break;
}
<anchor>5__1 = GameObject.Find("Sign - Closed Road (1)");
if ((Object)(object)<anchor>5__1 != (Object)null && (Object)(object)GameObject.Find("TARDIS_Menu_Flyby") == (Object)null)
{
<scroller>5__2 = Object.FindObjectOfType<TruckLandscapeScroller>();
if ((Object)(object)<scroller>5__2 != (Object)null)
{
<>4__this.SpawnMenuTardis(<scroller>5__2, <anchor>5__1);
}
<scroller>5__2 = null;
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static Plugin Instance;
public static GameObject TARDISPrefab;
public static GameObject TARDISMenuPrefab;
public static AudioClip TARDISSound;
public static AudioClip TARDISGrabSound;
public static AudioClip TARDISNightSound;
public static AudioClip TARDISMenuTheme;
public static Material ReplacementMaterial;
public static Material LandscapeReplacement;
public static ManualLogSource Log;
private void Awake()
{
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Expected O, but got Unknown
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Instance = this;
string text = Path.Combine(Paths.PluginPath, "TARDISMod", "tardisroom");
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val != (Object)null)
{
TARDISMenuPrefab = val.LoadAsset<GameObject>("tardis");
TARDISPrefab = val.LoadAsset<GameObject>("Module - Manor - N - 3 - Tardis");
TARDISSound = LoadAudio(val, "tardis");
TARDISGrabSound = LoadAudio(val, "tardis_grab");
TARDISNightSound = LoadAudio(val, "tardis_night");
TARDISMenuTheme = LoadAudio(val, "tardis_menu_loop");
ReplacementMaterial = val.LoadAsset<Material>("302854");
LandscapeReplacement = val.LoadAsset<Material>("images");
Log.LogInfo((object)"TARDIS: All assets loaded.");
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"TARDIS: Failed to load AssetBundle!");
}
((MonoBehaviour)this).StartCoroutine(MenuSpawnMonitor());
SceneManager.sceneLoaded += OnSceneLoaded;
Harmony val2 = new Harmony("com.you.tardisroom");
val2.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MenuMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(ConstantMusic), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(NightMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
val2.Patch((MethodBase)AccessTools.Method(typeof(AmbienceLoop), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ShopMusicPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo = AccessTools.Method(typeof(Object), "Instantiate", new Type[3]
{
typeof(Object),
typeof(Vector3),
typeof(Quaternion)
}, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(ComponentInjectorPatch), "Postfix", (Type[])null, (Type[])null);
val2.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"TARDIS: Patches applied.");
}
private AudioClip LoadAudio(AssetBundle bundle, string name)
{
return bundle.LoadAsset<AudioClip>(name) ?? bundle.LoadAsset<AudioClip>("assets/" + name + ".wav") ?? bundle.LoadAsset<AudioClip>("assets/" + name + ".mp3");
}
private void Update()
{
if (Input.GetKeyDown((KeyCode)117) && !((Object)(object)TARDISPrefab != (Object)null))
{
}
}
[IteratorStateMachine(typeof(<GlobalPaintingSweep>d__13))]
private IEnumerator GlobalPaintingSweep()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GlobalPaintingSweep>d__13(0)
{
<>4__this = this
};
}
public void SetupTARDISComponents(GameObject newRoom)
{
((Object)newRoom).name = "TARDIS_SUPER_SAVE";
Transform val = newRoom.transform.Find("TARDIS_Model") ?? newRoom.transform;
ProximityLookAwayDisappear proximityLookAwayDisappear = ((Component)val).gameObject.GetComponent<ProximityLookAwayDisappear>() ?? ((Component)val).gameObject.AddComponent<ProximityLookAwayDisappear>();
AudioSource val2 = ((Component)val).gameObject.GetComponent<AudioSource>() ?? ((Component)val).gameObject.AddComponent<AudioSource>();
val2.spatialBlend = 1f;
val2.maxDistance = 25f;
proximityLookAwayDisappear.targetObject = ((Component)val).gameObject;
proximityLookAwayDisappear.audioSource = val2;
proximityLookAwayDisappear.disappearClip = TARDISSound;
proximityLookAwayDisappear.activationAnchor = val;
((BaseUnityPlugin)this).Logger.LogInfo((object)"TARDIS: Components injected.");
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
Log.LogInfo((object)("TARDIS: Scene loaded - " + ((Scene)(ref scene)).name + "."));
((MonoBehaviour)this).StartCoroutine(GlobalPaintingSweep());
if (((Scene)(ref scene)).name == "Main")
{
((MonoBehaviour)this).StartCoroutine(MainWorldMusicMonitor());
}
}
[IteratorStateMachine(typeof(<MainWorldMusicMonitor>d__20))]
private IEnumerator MainWorldMusicMonitor()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MainWorldMusicMonitor>d__20(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<MenuSpawnMonitor>d__24))]
private IEnumerator MenuSpawnMonitor()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MenuSpawnMonitor>d__24(0)
{
<>4__this = this
};
}
private void SpawnMenuTardis(TruckLandscapeScroller scroller, GameObject anchor)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)TARDISMenuPrefab == (Object)null))
{
GameObject val = Object.Instantiate<GameObject>(TARDISMenuPrefab, ((Component)scroller).transform);
((Object)val).name = "TARDIS_Menu_Flyby";
val.transform.position = anchor.transform.position + Vector3.up * 15f;
val.AddComponent<TARDISFlightScroller>();
Log.LogInfo((object)"TARDIS: Spawned at triple height (15m) above Sign.");
}
}
}
public class TARDISFlightScroller : MonoBehaviour
{
public float scrollSpeed = 12f;
public float maxDistanceX = 80f;
private float offsetX = -22f;
public float heightOffset = 4.5f;
public float rotationSpeed = 50f;
public float forwardTilt = 15f;
private TruckLandscapeScroller truck;
private void Start()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
truck = ((Component)this).GetComponentInParent<TruckLandscapeScroller>();
if ((Object)(object)truck != (Object)null)
{
scrollSpeed *= truck.truckSpeed;
}
((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, heightOffset, ((Component)this).transform.localPosition.z);
((Component)this).transform.localRotation = Quaternion.Euler(forwardTilt, 0f, 0f);
}
private void Update()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)this).transform;
transform.localPosition += Vector3.right * scrollSpeed * Time.deltaTime;
if (((Component)this).transform.localPosition.x > maxDistanceX + offsetX)
{
((Component)this).transform.localPosition = new Vector3(0f - maxDistanceX + offsetX, ((Component)this).transform.localPosition.y, ((Component)this).transform.localPosition.z);
}
((Component)this).transform.Rotate(Vector3.up, rotationSpeed * Time.deltaTime, (Space)1);
}
}
[HarmonyPatch(typeof(ConstantMusic), "Update")]
public static class MenuMusicPatch
{
private static void Postfix(ConstantMusic __instance, ref bool ___setup)
{
if (___setup && !((Object)(object)Plugin.TARDISMenuTheme == (Object)null))
{
AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component.clip == (Object)(object)Plugin.TARDISMenuTheme))
{
component.Stop();
component.clip = Plugin.TARDISMenuTheme;
component.loop = true;
component.Play();
Plugin.Log.LogInfo((object)"TARDIS: Specific menu loop applied.");
}
}
}
}
[HarmonyPatch(typeof(TruckLandscapeScroller), "Start")]
public static class LobbyInjectionPatch
{
private static void Postfix(TruckLandscapeScroller __instance)
{
if ((Object)(object)Plugin.TARDISMenuPrefab == (Object)null)
{
Plugin.Log.LogError((object)"TARDIS: Menu prefab ('tardis') missing from bundle!");
}
else if (!((Object)(object)GameObject.Find("TARDIS_Menu_Flyby") != (Object)null))
{
GameObject val = Object.Instantiate<GameObject>(Plugin.TARDISMenuPrefab, ((Component)__instance).transform);
((Object)val).name = "TARDIS_Menu_Flyby";
val.AddComponent<TARDISFlightScroller>();
Plugin.ProximityLookAwayDisappear componentInChildren = val.GetComponentInChildren<Plugin.ProximityLookAwayDisappear>();
if ((Object)(object)componentInChildren != (Object)null)
{
Object.Destroy((Object)(object)componentInChildren);
}
Plugin.PlaySoundOnPhysGrab componentInChildren2 = val.GetComponentInChildren<Plugin.PlaySoundOnPhysGrab>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
Object.Destroy((Object)(object)componentInChildren2);
}
Plugin.Log.LogInfo((object)"TARDIS: Menu flyby injected.");
}
}
}