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 TerrasScrap v81.3.5
TerrasScrap.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; 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() { if (!((NetworkBehaviour)this).IsOwner || !Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy) || ((GrabbableObject)this).isPocketed) { return; } 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (((GrabbableObject)this).isInShipRoom && StartOfRound.Instance.inShipPhase && !StartOfRound.Instance.shipIsLeaving) { eggTimerTime = 0f; itemAnimator.SetBool(ringingBoolString, false); itemAudio.Stop(); eggTimerSet = false; ((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; ((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 FanItem : PhysicsProp { public Transform bladeObject; public AudioSource fanAudio; public AudioSource itemAudio; public AudioClip clickAudio; public float batteryLife; public float noiseRange; public float noiseLoudness; private float bladeAngle; private float bladeSpeed; private bool fanActive; private float fanVolume; private int timesPlayedInOneSpot; private float makeNoiseInterval; private Vector3 lastPosition; public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!Object.op_Implicit((Object)(object)GameNetworkManager.Instance.localPlayerController)) { return; } if (Object.op_Implicit((Object)(object)itemAudio)) { itemAudio.PlayOneShot(clickAudio); WalkieTalkie.TransmitOneShotAudio(itemAudio, clickAudio, 1f); } if (!fanActive && ((GrabbableObject)this).insertedBattery.charge > 0f) { if (Object.op_Implicit((Object)(object)fanAudio) && !fanAudio.isPlaying) { fanAudio.Play(); } fanActive = true; } else { fanActive = false; } } public override void Update() { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (((GrabbableObject)this).insertedBattery.charge <= 0f) { fanActive = false; } if (fanActive) { Battery insertedBattery = ((GrabbableObject)this).insertedBattery; insertedBattery.charge -= 1f / batteryLife * Time.deltaTime; bladeSpeed = Mathf.Min(bladeSpeed + 1f * Time.deltaTime, 8f); fanVolume = Mathf.Min(fanVolume + 0.1f * Time.deltaTime, 1f); } else { bladeSpeed = Mathf.Max(bladeSpeed - 0.6f * Time.deltaTime, 0f); fanVolume = Mathf.Max(fanVolume - 0.6f * Time.deltaTime, 0f); } if (Object.op_Implicit((Object)(object)fanAudio)) { if (fanVolume > 0f) { fanAudio.volume = fanVolume; fanAudio.pitch = 0.5f + fanVolume / 2f; } else { fanAudio.Stop(); } } bladeAngle += bladeSpeed; if (bladeAngle > 360f) { bladeAngle -= 360f; } if (Object.op_Implicit((Object)(object)bladeObject)) { bladeObject.localEulerAngles = new Vector3(0f, 0f - bladeAngle, 0f); } if (!Object.op_Implicit((Object)(object)fanAudio) || !fanAudio.isPlaying || !fanActive) { return; } if (makeNoiseInterval <= 0f) { makeNoiseInterval = 0.75f; if (Vector3.Distance(lastPosition, ((Component)this).transform.position) < 4f) { timesPlayedInOneSpot++; } else { timesPlayedInOneSpot = 0; } RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange * fanVolume, noiseLoudness * fanVolume, 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 EquipItem() { ((AnimatedItem)this).EquipItem(); if (base.itemAudio.isPlaying) { ((Component)light1).gameObject.SetActive(true); ((Component)light2).gameObject.SetActive(true); } } public override void DiscardItem() { ((AnimatedItem)this).DiscardItem(); ((Component)light1).gameObject.SetActive(false); ((Component)light2).gameObject.SetActive(false); } public override void PocketItem() { ((AnimatedItem)this).PocketItem(); ((Component)light1).gameObject.SetActive(false); ((Component)light2).gameObject.SetActive(false); } } public class LavaLampItem : PhysicsProp { public Light light; private int lampHue; private static readonly int Color = Shader.PropertyToID("Color"); public override void InitializeAfterPositioning() { //IL_0023: 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) ((GrabbableObject)this).InitializeAfterPositioning(); if (!((GrabbableObject)this).isInShipRoom) { lampHue = new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 360); SetLampColor(); } } private void SetLampColor() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Color val = Color.HSVToRGB((float)lampHue / 360f, 0.5f, 1f); if (Object.op_Implicit((Object)(object)((GrabbableObject)this).mainObjectRenderer)) { ((Renderer)((GrabbableObject)this).mainObjectRenderer).materials[1].SetColor("_Color", val); } if (Object.op_Implicit((Object)(object)light)) { light.color = val; } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return lampHue; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); lampHue = saveData; SetLampColor(); } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); ((Component)light).gameObject.SetActive(true); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); ((Component)light).gameObject.SetActive(true); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); ((Component)light).gameObject.SetActive(false); } } public class TrophyItem : PhysicsProp { public Material[] trophyPlaques; public int plaque; public override void InitializeAfterPositioning() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).InitializeAfterPositioning(); if (!((GrabbableObject)this).isInShipRoom) { if (trophyPlaques.Length != 0) { plaque = new Random(StartOfRound.Instance.randomMapSeed + 5 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, trophyPlaques.Length - 1); ChangePlaque(); } else { Debug.LogError((object)"Bronze trophy lacks plaque materials!"); } } } public void ChangePlaque() { if (Object.op_Implicit((Object)(object)((Component)this).GetComponent<MeshRenderer>()) && Object.op_Implicit((Object)(object)((Renderer)((Component)this).GetComponent<MeshRenderer>()).sharedMaterials[2]) && trophyPlaques.Length != 0) { ((Renderer)((Component)this).GetComponent<MeshRenderer>()).SetSharedMaterials(new List<Material> { ((Renderer)((Component)this).GetComponent<MeshRenderer>()).sharedMaterials[0], ((Renderer)((Component)this).GetComponent<MeshRenderer>()).sharedMaterials[1], trophyPlaques[plaque] }); } else { Debug.LogError((object)"Bronze trophy mesh renderer materials couldn't be accessed!"); } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return plaque; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); plaque = saveData; ChangePlaque(); } } }