Decompiled source of TerrasScrap v81.2.2

TerrasScrap.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TerrasScrap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TerrasScrap")]
[assembly: AssemblyTitle("TerrasScrap")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace TerrasScrap
{
	public class EggTimerItem : PhysicsProp
	{
		public string ringingBoolString;

		public Animator itemAnimator;

		public AudioSource itemAudio;

		public AudioLowPassFilter itemAudioLowPassFilter;

		public AudioClip ringAudio;

		public AudioClip clickingAudio;

		public AudioClip clickAudio;

		public Transform handleObject;

		public float noiseRange;

		public float noiseLoudness;

		private bool eggTimerSet;

		private bool eggTimerGrabbed;

		private float eggTimerTime;

		private int timesPlayedInOneSpot;

		private float makeNoiseInterval;

		private Vector3 lastPosition;

		public override void Start()
		{
			//IL_0024: 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_0072: 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)
			((GrabbableObject)this).Start();
			if (!((GrabbableObject)this).isInShipRoom && (float)new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 100) < 55f)
			{
				eggTimerSet = true;
				eggTimerTime = new Random(StartOfRound.Instance.randomMapSeed + 50 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(5, 177);
				Debug.Log((object)("Egg timer was set for " + eggTimerTime + " seconds."));
			}
		}

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			if (eggTimerSet && !eggTimerGrabbed)
			{
				Debug.Log((object)("Egg timer of " + eggTimerTime + " seconds was grabbed!"));
				eggTimerGrabbed = true;
				itemAudio.clip = clickingAudio;
				itemAudio.loop = true;
				itemAudio.Play();
			}
			if ((Object)(object)itemAudio != (Object)null)
			{
				if ((Object)(object)itemAudioLowPassFilter != (Object)null)
				{
					itemAudioLowPassFilter.cutoffFrequency = 20000f;
				}
				itemAudio.volume = 1f;
			}
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if ((Object)(object)itemAudio != (Object)null)
			{
				if ((Object)(object)itemAudioLowPassFilter != (Object)null)
				{
					itemAudioLowPassFilter.cutoffFrequency = 20000f;
				}
				itemAudio.volume = 1f;
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if ((Object)(object)itemAudio != (Object)null)
			{
				if ((Object)(object)itemAudioLowPassFilter != (Object)null)
				{
					itemAudioLowPassFilter.cutoffFrequency = 1700f;
				}
				itemAudio.volume = 0.5f;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !itemAnimator.GetBool(ringingBoolString))
			{
				return;
			}
			itemAnimator.SetBool(ringingBoolString, false);
			if ((Object)(object)itemAudio != (Object)null)
			{
				itemAudio.Stop();
				if ((Object)(object)clickAudio != (Object)null)
				{
					itemAudio.loop = false;
					itemAudio.PlayOneShot(clickAudio);
					WalkieTalkie.TransmitOneShotAudio(itemAudio, clickAudio, 1f);
				}
			}
			((GrabbableObject)this).SetControlTipsForItem();
		}

		public override void SetControlTipsForItem()
		{
			string[] toolTips = ((GrabbableObject)this).itemProperties.toolTips;
			if (toolTips.Length < 1)
			{
				Debug.LogError((object)"Egg timer control tips array length is too short to set tips!");
				return;
			}
			if (itemAnimator.GetBool(ringingBoolString))
			{
				toolTips[0] = "Stop Egg timer : [RMB]";
			}
			else
			{
				toolTips[0] = "";
			}
			HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties);
		}

		public override void Update()
		{
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (((GrabbableObject)this).isInShipRoom && StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving)
			{
				eggTimerTime = 0f;
				itemAnimator.SetBool(ringingBoolString, false);
				itemAudio.Stop();
				eggTimerSet = false;
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).isPocketed)
				{
					((GrabbableObject)this).SetControlTipsForItem();
				}
			}
			if (eggTimerSet && eggTimerGrabbed && eggTimerTime > 0f)
			{
				eggTimerTime -= Time.deltaTime;
				if (eggTimerTime <= 0f)
				{
					eggTimerTime = 0f;
					itemAnimator.SetBool(ringingBoolString, true);
					itemAudio.clip = ringAudio;
					itemAudio.loop = true;
					itemAudio.Play();
					eggTimerSet = false;
					if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !((GrabbableObject)this).isPocketed)
					{
						((GrabbableObject)this).SetControlTipsForItem();
					}
				}
			}
			handleObject.localRotation = Quaternion.Euler(0f, eggTimerTime * 2f, 0f);
			if ((Object)(object)itemAudio == (Object)null || !itemAudio.isPlaying)
			{
				return;
			}
			if (makeNoiseInterval <= 0f && (Object)(object)itemAudio.clip == (Object)(object)ringAudio)
			{
				makeNoiseInterval = 0.75f;
				if (Vector3.Distance(lastPosition, ((Component)this).transform.position) < 4f)
				{
					timesPlayedInOneSpot++;
				}
				else
				{
					timesPlayedInOneSpot = 0;
				}
				if (((GrabbableObject)this).isPocketed)
				{
					RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange / 2f, noiseLoudness / 2f, timesPlayedInOneSpot, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				}
				else
				{
					RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, noiseLoudness, timesPlayedInOneSpot, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
				}
			}
			else
			{
				makeNoiseInterval -= Time.deltaTime;
			}
		}
	}
	public class FireTruckItem : AnimatedItem
	{
		public Light light1;

		public Light light2;

		public override void Update()
		{
			((AnimatedItem)this).Update();
			if (base.itemAudio.isPlaying && !((GrabbableObject)this).isPocketed)
			{
				((Component)light1).gameObject.SetActive(true);
				((Component)light2).gameObject.SetActive(true);
			}
			else
			{
				((Component)light1).gameObject.SetActive(false);
				((Component)light2).gameObject.SetActive(false);
			}
		}
	}
	public class LavaLampItem : PhysicsProp
	{
		public Light light;

		private static readonly int Color = Shader.PropertyToID("Color");

		public override void Start()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Start();
			Color val = Color.HSVToRGB((float)new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 360) / 360f, 0.5f, 1f);
			if ((Object)(object)((GrabbableObject)this).mainObjectRenderer != (Object)null)
			{
				((Renderer)((GrabbableObject)this).mainObjectRenderer).material.SetColor("_Color", val);
			}
			if ((Object)(object)light != (Object)null)
			{
				light.color = val;
			}
		}
	}
}