Decompiled source of Tolian Interiors v1.0.1

TolianInterior/HyperionStation/HyperionStation.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HyperionStation")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HyperionStation")]
[assembly: AssemblyTitle("HyperionStation")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HyperionStation
{
	public static class Common
	{
		public static bool CollideWithPlayer(Collider collider_obj)
		{
			if (((Component)collider_obj).tag == "Player")
			{
				return true;
			}
			GameObject gameObject = ((Component)collider_obj).gameObject;
			while ((Object)(object)gameObject != (Object)null)
			{
				if (gameObject.tag == "Player")
				{
					return true;
				}
				if ((Object)(object)gameObject.transform.parent == (Object)null)
				{
					return false;
				}
				gameObject = ((Component)gameObject.transform.parent).gameObject;
			}
			return false;
		}

		public static bool CollideWithEnemy(Collider collider_obj)
		{
			if (((Component)collider_obj).tag == "Enemy")
			{
				return true;
			}
			GameObject gameObject = ((Component)collider_obj).gameObject;
			while ((Object)(object)gameObject != (Object)null)
			{
				if (gameObject.tag == "Enemy")
				{
					return true;
				}
				if ((Object)(object)gameObject.transform.parent == (Object)null)
				{
					return false;
				}
				gameObject = ((Component)gameObject.transform.parent).gameObject;
			}
			return false;
		}
	}
	[Serializable]
	public class dotATSequence
	{
		public int totalFrames = 0;

		public int firstFrame = 0;

		public int startingFrame = 0;

		public bool randomly = false;
	}
	[ExecuteInEditMode]
	public class DotAnimatedTexture : MonoBehaviour
	{
		public int materialTotalFrames;

		public int activeSequence = 0;

		public List<dotATSequence> sequences;

		public float FPS = 10f;

		public bool showWarnings = false;

		private Renderer _renderer = null;

		private int materialTileRows = 0;

		private int materialTileCols = 0;

		private int prevIndex = -1;

		private void Start()
		{
			Init();
		}

		private void Init()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_008e: 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)
			if ((Object)(object)_renderer == (Object)null)
			{
				_renderer = ((Component)this).GetComponent<Renderer>();
			}
			Material val = (((Object)(object)_renderer == (Object)null) ? null : _renderer.sharedMaterial);
			if ((Object)(object)val == (Object)null)
			{
				materialTileRows = (materialTileCols = 0);
				return;
			}
			Vector2 mainTextureScale = val.mainTextureScale;
			materialTileRows = ((!(mainTextureScale.y > 0f)) ? 1 : Mathf.RoundToInt(1f / mainTextureScale.y));
			materialTileCols = ((!(mainTextureScale.x > 0f)) ? 1 : Mathf.RoundToInt(1f / mainTextureScale.x));
		}

		private void Update()
		{
			ForceUpdate(force: false);
		}

		public void ForceUpdate(bool force = true)
		{
			//IL_0159: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_01fc: 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_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			bool isPlaying = Application.isPlaying;
			if (!isPlaying)
			{
				Init();
			}
			materialTotalFrames = materialTileRows * materialTileCols;
			if (materialTotalFrames == 0 || sequences == null || activeSequence + 1 > sequences.Count)
			{
				return;
			}
			int totalFrames = sequences[activeSequence].totalFrames;
			int startingFrame = sequences[activeSequence].startingFrame;
			int firstFrame = sequences[activeSequence].firstFrame;
			bool randomly = sequences[activeSequence].randomly;
			if (totalFrames == 0 || totalFrames + firstFrame > materialTileCols * materialTileRows || (Object)(object)_renderer == (Object)null)
			{
				return;
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(1f / (float)materialTileCols, 1f / (float)materialTileRows);
			int num;
			if (isPlaying)
			{
				num = ((int)(Time.time * FPS) + startingFrame) % totalFrames;
			}
			else
			{
				num = startingFrame % totalFrames;
				Vector2 mainTextureScale = _renderer.sharedMaterial.mainTextureScale;
				int num2 = 0;
				if (mainTextureScale.x * mainTextureScale.y != 0f)
				{
					num2 = Mathf.RoundToInt(1f / (mainTextureScale.x * mainTextureScale.y));
				}
				materialTotalFrames = num2;
			}
			if (firstFrame + num != prevIndex)
			{
				prevIndex = firstFrame + num;
				if (randomly && isPlaying)
				{
					num = Mathf.RoundToInt(Random.value * (float)(totalFrames - 1));
				}
				num += firstFrame;
				Vector2 mainTextureOffset = default(Vector2);
				((Vector2)(ref mainTextureOffset))..ctor((float)(num % materialTileCols) * val.x, 1f - val.y - (float)(num / materialTileCols) * val.y);
				if (isPlaying)
				{
					_renderer.material.mainTextureOffset = mainTextureOffset;
				}
			}
		}
	}
	public enum dotHskDoorStats
	{
		none = 0,
		closed = 1,
		broken = 2,
		off = 4,
		blocked = 8
	}
	public enum dotHskDoorMode
	{
		active = 1,
		activeOpen = 0,
		blocked = 9,
		brokenOpen = 6,
		brokenClosed = 7,
		inactiveOpen = 4,
		inactiveClosed = 5
	}
	[ExecuteInEditMode]
	public class DotHskDoor : MonoBehaviour
	{
		public dotHskDoorMode mode = dotHskDoorMode.active;

		public DotHskDoorSlider doorScript;

		private dotHskDoorMode prevMode = dotHskDoorMode.active;

		private bool first = true;

		private void Update()
		{
			if ((Object)(object)doorScript != (Object)null && (prevMode != mode || first))
			{
				if (doorScript.setMode(mode, first))
				{
					prevMode = mode;
				}
				else
				{
					mode = prevMode;
				}
				first = false;
			}
		}
	}
	public class DotHskDoorBase : DotHskDoorsEventsClass
	{
		[Header("Sounds")]
		public AudioSource audioSource;

		public AudioClip openSound;

		public AudioClip closeSound;

		public AudioClip blockedSound;

		[Header("Lights")]
		public Color blockedColor = new Color(1f, 0f, 0f);

		public Color activeColor = new Color(0f, 1f, 4f / 85f);

		public Light[] lights;

		[Header("Glass")]
		public Renderer doorGlass = null;

		public Material glassOn = null;

		public Material glassBlocked = null;

		public Material glassOff = null;

		private float[] soundLen = new float[3];

		public void Start()
		{
			if ((Object)(object)closeSound != (Object)null)
			{
				soundLen[0] = closeSound.length;
			}
			if ((Object)(object)openSound != (Object)null)
			{
				soundLen[2] = openSound.length;
			}
		}

		public override void OnStartMotion(float fromPos, int dir)
		{
			if ((Object)(object)audioSource != (Object)null && soundLen[dir + 1] > 0f)
			{
				audioSource.clip = ((dir == 1) ? openSound : closeSound);
				audioSource.time = ((fromPos == 0f) ? 0f : ((dir == 1) ? fromPos : (1f - fromPos)));
				audioSource.Play();
			}
		}

		public override void OnBlock()
		{
			if ((Object)(object)audioSource != (Object)null && (Object)(object)blockedSound != (Object)null)
			{
				audioSource.clip = blockedSound;
				audioSource.time = 0f;
				audioSource.Play();
			}
		}

		public override void OnChangeMode(bool isOff, bool isBlocked)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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)
			if ((Object)(object)doorGlass != (Object)null)
			{
				if (isOff)
				{
					doorGlass.sharedMaterial = glassOff;
				}
				else if (isBlocked)
				{
					doorGlass.sharedMaterial = glassBlocked;
				}
				else
				{
					doorGlass.sharedMaterial = glassOn;
				}
			}
			if (lights.Length != 0)
			{
				for (int i = 0; i < lights.Length; i++)
				{
					lights[i].color = (Color)(isOff ? new Color(0f, 0f, 0f) : (isBlocked ? blockedColor : activeColor));
					((Behaviour)lights[i]).enabled = !isOff;
				}
			}
		}

		public override void OnInit()
		{
		}

		public override void OnStop()
		{
		}
	}
	public class DotHskDoorBeep : MonoBehaviour
	{
		public AudioSource audioSource;

		public AudioClip beepSound;

		private void OnTriggerEnter(Collider other)
		{
			if (Common.CollideWithPlayer(other) && (Object)(object)audioSource != (Object)null && (Object)(object)beepSound != (Object)null)
			{
				audioSource.clip = beepSound;
				audioSource.time = 0f;
				audioSource.Play();
			}
			if (Common.CollideWithEnemy(other) && (Object)(object)audioSource != (Object)null && (Object)(object)beepSound != (Object)null)
			{
				audioSource.clip = beepSound;
				audioSource.time = 0f;
				audioSource.Play();
			}
		}
	}
	[Serializable]
	public class dotHskDoorFlap
	{
		public Vector3 openPos = default(Vector3);

		public Vector3 closedPos = default(Vector3);

		public Vector3 almostOpenPos = default(Vector3);

		public Vector3 almostClosedPos = default(Vector3);

		public Transform flap;
	}
	public abstract class DotHskDoorsEventsClass : MonoBehaviour
	{
		[HideInInspector]
		public DotHskDoorSlider door;

		public abstract void OnInit();

		public abstract void OnStartMotion(float fromPos, int dir);

		public abstract void OnChangeMode(bool isOff, bool isBlocked);

		public abstract void OnBlock();

		public abstract void OnStop();
	}
	[ExecuteInEditMode]
	public class DotHskDoorSlider : MonoBehaviour
	{
		public List<dotHskDoorFlap> doorFlaps;

		public float motionTime = 1f;

		[HideInInspector]
		public DotHskDoorsEventsClass doorEvents;

		private int dir = 0;

		public float curPos = 0f;

		private float targetPos = 0f;

		private bool isOff = false;

		private bool isBlocked = false;

		public bool getIsFullyOpen()
		{
			return curPos == 1f;
		}

		public bool getIsFullyClosed()
		{
			return curPos == 0f;
		}

		public bool getIsStopped()
		{
			return dir == 0;
		}

		private void Start()
		{
			Init();
		}

		private void Update()
		{
			if (Application.isPlaying)
			{
				if (dir != 0)
				{
					float num = curPos + (float)dir * ((motionTime == 0f) ? 1f : (1f / motionTime)) * Time.deltaTime;
					if ((float)dir * (targetPos - num) < 0.01f)
					{
						num = targetPos;
						dir = 0;
					}
					moveTo(num);
					if ((Object)(object)doorEvents != (Object)null && dir == 0)
					{
						doorEvents.OnStop();
					}
				}
			}
			else
			{
				Init();
			}
		}

		private void Init()
		{
			if ((Object)(object)doorEvents == (Object)null)
			{
				doorEvents = ((Component)this).GetComponent<DotHskDoorsEventsClass>();
				if ((Object)(object)doorEvents != (Object)null)
				{
					doorEvents.door = this;
					doorEvents.OnInit();
				}
			}
		}

		private void moveTo(float newPos)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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)
			if (newPos != curPos)
			{
				for (int i = 0; i < doorFlaps.Count; i++)
				{
					doorFlaps[i].flap.localPosition = Vector3.Lerp(doorFlaps[i].closedPos, doorFlaps[i].openPos, newPos);
				}
				curPos = newPos;
			}
		}

		public bool setMode(dotHskDoorMode mode, bool isInit)
		{
			//IL_0099: 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_009e: 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_00a7: 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)
			bool flag = (mode & dotHskDoorMode.active) != 0;
			isOff = (mode & dotHskDoorMode.inactiveOpen) != 0;
			isBlocked = (mode & (dotHskDoorMode)8) != 0;
			if ((Object)(object)doorEvents != (Object)null)
			{
				doorEvents.OnChangeMode(isOff, isBlocked);
			}
			if ((mode & (dotHskDoorMode)2) != 0)
			{
				for (int i = 0; i < doorFlaps.Count; i++)
				{
					Vector3 val2 = (doorFlaps[i].flap.localPosition = (flag ? doorFlaps[i].almostClosedPos : doorFlaps[i].almostOpenPos));
					Vector3 val3 = val2;
					float magnitude = ((Vector3)(ref doorFlaps[i].openPos)).magnitude;
					curPos = ((magnitude == 0f) ? 0f : (((Vector3)(ref val3)).magnitude / magnitude));
				}
				dir = 0;
			}
			else
			{
				float num = (targetPos = (flag ? 0f : 1f));
				if (Application.isPlaying && num != curPos && !isInit)
				{
					dir = ((num > curPos) ? 1 : (-1));
					if ((Object)(object)doorEvents != (Object)null)
					{
						doorEvents.OnStartMotion(curPos, dir);
					}
				}
				else
				{
					dir = 0;
					moveTo(num);
				}
			}
			return true;
		}

		public void operate(bool open)
		{
			if (isOff)
			{
				return;
			}
			if (isBlocked)
			{
				if ((Object)(object)doorEvents != (Object)null && open)
				{
					doorEvents.OnBlock();
				}
				return;
			}
			float num = (open ? 1f : 0f);
			if (targetPos != num)
			{
				dir = ((curPos < (targetPos = num)) ? 1 : (-1));
				if ((Object)(object)doorEvents != (Object)null)
				{
					doorEvents.OnStartMotion(curPos, dir);
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if (Common.CollideWithPlayer(other))
			{
				operate(open: true);
			}
			if (Common.CollideWithEnemy(other))
			{
				operate(open: true);
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (Common.CollideWithPlayer(other))
			{
				operate(open: false);
			}
			if (Common.CollideWithEnemy(other))
			{
				operate(open: false);
			}
		}
	}
	[BepInPlugin("Tolian.HyperionStation", "Hyperion Station", "0.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "Tolian.HyperionStation";

		public const string NAME = "Hyperion Station";

		public const string VERSION = "0.3.0";

		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "hyperionstation"));
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Interior Dungeon assets.");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Interior Assets loaded successfully");
			ExtendedMod val2 = val.LoadAsset<ExtendedMod>("Assets/LethalCompany/Mods/HyperStation/LLL/HyperStation.asset");
			PatchedContent.RegisterExtendedMod(val2);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Extended DungeonFlow");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "HyperionStation";

		public const string PLUGIN_NAME = "HyperionStation";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}

TolianInterior/TeraSpace/TeraScript.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TeraScript")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeraScript")]
[assembly: AssemblyTitle("TeraScript")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TeraScript
{
	public class DSBlinking : MonoBehaviour
	{
		[Serializable]
		public class DSBlinkingValues
		{
			public enum SwitchMode
			{
				simple,
				multi,
				broken
			}

			public bool IsActive;

			[Header("Max HDR bright")]
			[ColorUsage(true, true)]
			public Color MaxBright;

			[Header("blinking")]
			public float SwitchTime = 0.1f;

			[Header("Simple blinking, Increasing Blinking, Broken lamp")]
			public SwitchMode SwitchModes = SwitchMode.simple;

			[HideInInspector]
			public int mode;

			[HideInInspector]
			public int count;

			[Header("Shared Material")]
			public Material SharedMaterial;

			[Header("Shader String")]
			public string WorkingString = "_EmissiveColor";

			public IEnumerator ColorSwitch(float random)
			{
				while (true)
				{
					yield return (object)new WaitForSeconds(SwitchTime + random);
					if (SwitchModes == SwitchMode.simple)
					{
						mode = 1 - mode;
						if (mode == 0)
						{
							SharedMaterial.SetColor(WorkingString, Color.black);
						}
						else
						{
							SharedMaterial.SetColor(WorkingString, MaxBright);
						}
					}
					else if (SwitchModes == SwitchMode.multi)
					{
						mode++;
						if (mode > 2)
						{
							mode = 0;
						}
						if (mode == 0)
						{
							SharedMaterial.SetColor(WorkingString, Color.black);
						}
						else if (mode == 1)
						{
							SharedMaterial.SetColor(WorkingString, MaxBright * 0.5f);
						}
						else
						{
							SharedMaterial.SetColor(WorkingString, MaxBright);
						}
					}
					else
					{
						if (count < 10)
						{
							mode++;
							if (mode > 2)
							{
								mode = 0;
							}
							if (mode == 0)
							{
								SharedMaterial.SetColor(WorkingString, Color.black);
							}
							else if (mode == 1)
							{
								SharedMaterial.SetColor(WorkingString, MaxBright * 0.5f);
							}
							else
							{
								SharedMaterial.SetColor(WorkingString, MaxBright);
							}
						}
						else if (count < 20)
						{
							SharedMaterial.SetColor(WorkingString, MaxBright * 0.5f);
						}
						else
						{
							SharedMaterial.SetColor(WorkingString, MaxBright);
						}
						count++;
						if (count > 50)
						{
							count = 0;
						}
					}
					random = 0f;
				}
			}
		}

		public DSBlinkingValues[] _DSBlinkingValues;

		[Header("Shader String")]
		public string WorkingString = "_EmissiveColor";

		private void Awake()
		{
			Random.InitState((int)DateTime.Now.Ticks * 1000);
		}

		private void Start()
		{
			for (int i = 0; i < _DSBlinkingValues.Length; i++)
			{
				if (_DSBlinkingValues[i].IsActive)
				{
					float random = Random.Range(0.07f, 0.95f);
					((MonoBehaviour)this).StartCoroutine(_DSBlinkingValues[i].ColorSwitch(random));
				}
			}
		}

		private void Update()
		{
		}

		private void OnDestroy()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < _DSBlinkingValues.Length; i++)
			{
				if (_DSBlinkingValues[i].IsActive)
				{
					_DSBlinkingValues[i].SharedMaterial.SetColor(WorkingString, _DSBlinkingValues[i].MaxBright);
				}
			}
		}
	}
	public class DSCaster : MonoBehaviour
	{
		[Header("'Water' - one of built in Unity layers:")]
		public string InteractLayer;

		[Space(10f)]
		public GameObject Canvas;

		public float RayLength = 1f;

		private int buttonsMask;

		private Material PrevMat = null;

		private Color PrevColor;

		[Header("Shader String")]
		public string WorkingString = "_EmissiveColor";

		private void Awake()
		{
			buttonsMask = LayerMask.GetMask(new string[1] { InteractLayer });
			if (Object.op_Implicit((Object)(object)Canvas))
			{
				Canvas.SetActive(false);
			}
		}

		private void Start()
		{
		}

		private void Update()
		{
			//IL_0007: 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_0159: 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_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_010c: 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)
			RaycastHit val = default(RaycastHit);
			if (Physics.Linecast(((Component)this).transform.position, ((Component)this).transform.TransformPoint(new Vector3(0f, 0f, RayLength)), ref val, buttonsMask))
			{
				if (Object.op_Implicit((Object)(object)Canvas))
				{
					Canvas.SetActive(true);
				}
				if (Input.GetMouseButtonUp(0))
				{
					((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<DSTrigger>().DSTriggerExecute();
				}
				Material val2 = ((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponent<Renderer>().materials[0];
				Color color = val2.GetColor(WorkingString);
				if ((Object)(object)PrevMat != (Object)(object)val2)
				{
					if (Object.op_Implicit((Object)(object)PrevMat))
					{
						PrevMat.SetColor(WorkingString, PrevColor);
					}
					PrevMat = val2;
					PrevColor = color;
					val2.SetColor(WorkingString, new Color(0f, 1.27f, 5f));
				}
			}
			else
			{
				if (Object.op_Implicit((Object)(object)Canvas))
				{
					Canvas.SetActive(false);
				}
				if (Object.op_Implicit((Object)(object)PrevMat))
				{
					PrevMat.SetColor(WorkingString, PrevColor);
					PrevMat = null;
				}
			}
		}

		private void FixedUpdate()
		{
		}
	}
	public class DSElevator : MonoBehaviour
	{
		[Header("Current mesh position, e.g. 1,2,3,4.. floor (from 1)")]
		public int StartFloor;

		[Space(10f)]
		public int TotalFloors;

		[Header("smaller = faster")]
		public float Speed = 5f;

		[HideInInspector]
		public bool IsMoving;

		[HideInInspector]
		public bool CallerBusy;

		[HideInInspector]
		public int CurrentFloor;

		private float TimeStart;

		private Vector3 StartPos;

		private Vector3 EndPos;

		private void Start()
		{
			CurrentFloor = StartFloor;
		}

		private void Update()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (IsMoving)
			{
				float num = Time.time - TimeStart;
				float num2 = num / Speed;
				((Component)this).transform.position = Vector3.Lerp(StartPos, EndPos, num2);
				if (num2 >= 1f)
				{
					IsMoving = false;
				}
			}
		}

		public void StartMoving(bool direction)
		{
			//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_00cf: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00b7: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			if (!(!IsMoving & !CallerBusy))
			{
				return;
			}
			if (direction)
			{
				if (CurrentFloor + 1 > TotalFloors)
				{
					return;
				}
				CurrentFloor++;
			}
			else
			{
				if (CurrentFloor - 1 < 1)
				{
					return;
				}
				CurrentFloor--;
			}
			IsMoving = true;
			TimeStart = Time.time;
			StartPos = ((Component)this).transform.position;
			if (direction)
			{
				EndPos = ((Component)this).transform.position + Vector3.up * 4f;
			}
			else
			{
				EndPos = ((Component)this).transform.position - Vector3.up * 4f;
			}
		}
	}
	public class DSElevatorCaller : MonoBehaviour
	{
		[Header("!caller doesn't work with Y pos < 0 (negative numbers)!")]
		public DSElevator _DSElevator;

		[Header("smaller = faster")]
		public float Speed = 5f;

		private bool IsMoving;

		private float TimeStart;

		private Vector3 StartPos;

		private Vector3 EndPos;

		private void Start()
		{
			//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_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)
			StartPos = Vector3.zero;
			EndPos = Vector3.zero;
		}

		private void Update()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (IsMoving)
			{
				float num = Time.time - TimeStart;
				float num2 = num / Speed;
				((Component)_DSElevator).transform.position = new Vector3(((Component)_DSElevator).transform.position.x, Mathf.Lerp(StartPos.y, EndPos.y, num2), ((Component)_DSElevator).transform.position.z);
				if (num2 >= 1f)
				{
					IsMoving = false;
					_DSElevator.CallerBusy = false;
				}
			}
		}

		public void StartMoving()
		{
			//IL_0032: 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)
			if (!(!IsMoving & !_DSElevator.IsMoving))
			{
				return;
			}
			StartPos.y = ((Component)_DSElevator).transform.position.y;
			EndPos.y = (int)((Component)this).transform.position.y;
			EndPos.y = (int)EndPos.y / 4;
			EndPos.y *= 4f;
			if (EndPos.y == StartPos.y)
			{
				return;
			}
			IsMoving = true;
			_DSElevator.CallerBusy = true;
			TimeStart = Time.time;
			int num = 0;
			num = ((!((StartPos.y < 0f) | (EndPos.y < 0f))) ? ((int)Mathf.Abs(StartPos.y - EndPos.y)) : ((int)(Mathf.Abs(StartPos.y) + Mathf.Abs(EndPos.y))));
			num /= 4;
			if (StartPos.y != EndPos.y)
			{
				if (StartPos.y > EndPos.y)
				{
					_DSElevator.CurrentFloor -= num;
				}
				else
				{
					_DSElevator.CurrentFloor += num;
				}
			}
		}
	}
	internal class DSGates : MonoBehaviour
	{
		public enum StartStates
		{
			opened,
			closed
		}

		public string AnimationOpen;

		public string AnimationClose;

		public StartStates StartState = StartStates.closed;

		private bool CurrentState;

		private void Start()
		{
			if (StartState == StartStates.closed)
			{
				((Component)this).GetComponent<Animation>().Play(AnimationClose);
				CurrentState = true;
			}
			else
			{
				((Component)this).GetComponent<Animation>().Play(AnimationOpen);
				CurrentState = false;
			}
		}

		private void Update()
		{
		}

		public void StartOpenClose()
		{
			if (((Component)this).GetComponent<Animation>().isPlaying)
			{
				return;
			}
			CurrentState = !CurrentState;
			if (CurrentState)
			{
				if (!((Component)this).GetComponent<Animation>().isPlaying)
				{
					((Component)this).GetComponent<Animation>().Play(AnimationClose);
				}
			}
			else if (!((Component)this).GetComponent<Animation>().isPlaying)
			{
				((Component)this).GetComponent<Animation>().Play(AnimationOpen);
			}
		}
	}
	public class DSReparent : MonoBehaviour
	{
		private void Start()
		{
		}

		private void Update()
		{
		}

		private void OnTriggerEnter(Collider other)
		{
			if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<CharacterController>()))
			{
				((Component)other).gameObject.transform.parent = ((Component)this).transform;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<CharacterController>()))
			{
				((Component)other).gameObject.transform.parent = null;
			}
		}
	}
	public class DSScrollTexture : MonoBehaviour
	{
		[Header("Texture Offsets")]
		public Vector2[] MoveRate;

		[Header("Shared Materials")]
		public Material[] SharedMaterials;

		[Header("Shader String")]
		public string WorkingString = "_EmissiveColorMap";

		private void Start()
		{
		}

		private void Update()
		{
			//IL_0014: 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)
			//IL_001a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_004c: 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)
			for (int i = 0; i < SharedMaterials.Length; i++)
			{
				Vector2 textureOffset = SharedMaterials[i].GetTextureOffset(WorkingString);
				textureOffset += MoveRate[i] * Time.deltaTime;
				textureOffset.x %= 50f;
				textureOffset.y %= 50f;
				SharedMaterials[i].SetTextureOffset(WorkingString, textureOffset);
			}
		}

		private void OnDestroy()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < SharedMaterials.Length; i++)
			{
				SharedMaterials[i].SetTextureOffset(WorkingString, Vector2.zero);
			}
		}
	}
	public class DSTrigger : MonoBehaviour
	{
		public enum ExecMode
		{
			elevator_up,
			elevator_dwn,
			gate,
			elevator_call
		}

		public bool IsActive = true;

		public GameObject Executor;

		public ExecMode ExecModes = ExecMode.gate;

		private void Start()
		{
		}

		private void Update()
		{
		}

		public void DSTriggerExecute()
		{
			if (IsActive)
			{
				if (ExecModes == ExecMode.elevator_up)
				{
					Executor.GetComponent<DSElevator>().StartMoving(direction: true);
				}
				else if (ExecModes == ExecMode.elevator_dwn)
				{
					Executor.GetComponent<DSElevator>().StartMoving(direction: false);
				}
				else if (ExecModes == ExecMode.gate)
				{
					Executor.GetComponent<DSGates>().StartOpenClose();
				}
				else if (ExecModes == ExecMode.elevator_call)
				{
					Executor.GetComponent<DSElevatorCaller>().StartMoving();
				}
			}
		}
	}
	public class DSTvMovie : MonoBehaviour
	{
		[Serializable]
		public class DSTvMovieValues
		{
			public bool IsActive;

			[Header("max emission bright")]
			public float MaxBright = 3f;

			[Header("frames speed")]
			public float Speed;

			[Header("shared material")]
			public Material SharedMaterial;

			[Header("frames")]
			public Texture[] Frames;

			[HideInInspector]
			public int i;
		}

		public DSTvMovieValues[] _DSTvMovieValues;

		[Header("Shader String")]
		public string WorkingString = "_EmissiveColor";

		[Header("Shader String 2")]
		public string WorkingString2 = "_EmissiveColorMap";

		private void Awake()
		{
			Random.InitState((int)DateTime.Now.Ticks * 1000);
		}

		private void Start()
		{
			//IL_00a5: 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)
			for (int i = 0; i < _DSTvMovieValues.Length; i++)
			{
				if (_DSTvMovieValues[i].IsActive)
				{
					float num = Random.Range(1.5f, _DSTvMovieValues[i].MaxBright);
					float num2 = Random.Range(0.2f, 0.8f);
					float num3 = Random.Range(0.2f, 0.8f);
					float num4 = Random.Range(0.2f, 0.8f);
					_DSTvMovieValues[i].SharedMaterial.SetColor(WorkingString, new Color(num + num2, num + num3, num + num4));
				}
				else
				{
					_DSTvMovieValues[i].SharedMaterial.SetColor(WorkingString, Color.black);
				}
			}
		}

		private void Update()
		{
			for (int i = 0; i < _DSTvMovieValues.Length; i++)
			{
				if (_DSTvMovieValues[i].IsActive)
				{
					_DSTvMovieValues[i].i = (int)(Time.time * _DSTvMovieValues[i].Speed);
					_DSTvMovieValues[i].i = _DSTvMovieValues[i].i % _DSTvMovieValues[i].Frames.Length;
					_DSTvMovieValues[i].SharedMaterial.SetTexture(WorkingString2, _DSTvMovieValues[i].Frames[_DSTvMovieValues[i].i]);
				}
			}
		}

		private void OnDestroy()
		{
			for (int i = 0; i < _DSTvMovieValues.Length; i++)
			{
				if (_DSTvMovieValues[i].IsActive)
				{
				}
			}
		}
	}
	[BepInPlugin("Tolian.TeraSpace", "TeraSpace", "0.8.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "Tolian.TeraSpace";

		public const string NAME = "TeraSpace";

		public const string VERSION = "0.8.0";

		private void Awake()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "teraspace"));
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Interior Dungeon assets.");
				return;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Interior Assets loaded successfully");
			ExtendedDungeonFlow val2 = val.LoadAsset<ExtendedDungeonFlow>("Assets/LethalCompany/Mods/TeraSpace/TeraDungFlow.asset");
			PatchedContent.RegisterExtendedDungeonFlow(val2);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Extended DungeonFlow");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TeraScript";

		public const string PLUGIN_NAME = "TeraScript";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}