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.4.2
TerrasScrap.dll
Decompiled a month 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] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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, 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, 941); } 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_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) ((GrabbableObject)this).InitializeAfterPositioning(); if (lampHue <= 0) { lampHue = new Random(StartOfRound.Instance.randomMapSeed + 10 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 360) + 1; SetLampColor(); } } private void SetLampColor() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) Color val = Color.HSVToRGB((float)(lampHue - 1) / 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 LighterItem : PhysicsProp { public Transform lighterLid; public Transform lighterCam; public Transform lighterFlame; public SpriteRenderer lighterFlameSprite; public Light lighterLight; public Transform lighterFlameFlicker; public AudioSource lighterAudioSource; public AudioClip lighterOpenAudioClip; public AudioClip lighterCloseAudioClip; public bool lighterActive; public float lighterFuel; private bool lighterFlameActive; private float lighterLerp; private float lighterFlameLerp; private float delayUse = -1f; private float lighterFuelRatio = 1f; private float lighterEmptyLerp = 1f; private Random lighterAudioRandom; public override void Start() { ((GrabbableObject)this).Start(); lighterAudioRandom = new Random(StartOfRound.Instance.randomMapSeed + 85); } 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) { lighterFuel = new Random(StartOfRound.Instance.randomMapSeed + 18 + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.z).Next(0, 700); if (lighterFuel < 75f) { lighterFuel = 0f; } } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return (int)lighterFuel; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); lighterFuel = saveData; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance.localPlayerController) && Object.op_Implicit((Object)(object)((GrabbableObject)this).playerHeldBy) && !(delayUse > -1f)) { lighterActive = !lighterActive; if (Object.op_Implicit((Object)(object)lighterAudioSource)) { lighterAudioSource.pitch = (float)lighterAudioRandom.Next(95, 105) / 100f; AudioClip val = (lighterActive ? lighterOpenAudioClip : lighterCloseAudioClip); lighterAudioSource.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(lighterAudioSource, val, 1f); } delayUse = 0f; } } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); lighterActive = false; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); lighterActive = false; lighterLerp = 0f; } 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)"Lighter control tips array length is too short to set tips!"); return; } if (!lighterActive) { toolTips[0] = "Open lighter : [RMB]"; } else { toolTips[0] = "Close lighter : [RMB]"; } HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, ((GrabbableObject)this).itemProperties); } public override void Update() { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); ((GrabbableObject)this).SetControlTipsForItem(); if (delayUse >= 0f) { delayUse += Time.deltaTime; if (delayUse >= 0.5f) { delayUse = -1f; } } lighterLerp = (lighterActive ? Mathf.Min(lighterLerp + 4f * Time.deltaTime, 1f) : Mathf.Max(lighterLerp - 4f * Time.deltaTime, 0f)); if (lighterFuel > 0f) { lighterFuel = (lighterActive ? (lighterFuel - Time.deltaTime) : lighterFuel); } else { lighterFuel = Mathf.Max(lighterFuel, 0f); } if (lighterFlameActive) { lighterFuelRatio = Mathf.Min(lighterFuel / 500f, 1f); if (lighterFuel <= 0f) { lighterEmptyLerp = Mathf.Max(lighterEmptyLerp - 10f * Time.deltaTime, 0f); } } else { lighterEmptyLerp = ((lighterFuel <= 0f) ? 0f : 1f); } lighterLid.localEulerAngles = new Vector3(135f * Mathf.Sin(MathF.PI / 2f * lighterLerp) + 45f * Mathf.Sin(MathF.PI * lighterLerp), 0f, 0f); lighterCam.localEulerAngles = new Vector3(107f * Mathf.Sin(MathF.PI / 2f * Mathf.Min(lighterLerp * 2f, 1f)), 0f, 0f); if (lighterLerp > 0.15f && lighterEmptyLerp > 0f && !((GrabbableObject)this).isPocketed) { lighterFlameActive = true; lighterFlameLerp = Mathf.Min(lighterFlameLerp + 10f * Time.deltaTime, 1f); } else { lighterFlameActive = false; lighterFlameLerp = 0f; } ((Component)lighterFlame).gameObject.SetActive(lighterFlameActive); ((Component)lighterLight).gameObject.SetActive(lighterFlameActive); if (!(lighterLerp <= 0f) && !(lighterFlameLerp <= 0f) && !(lighterEmptyLerp <= 0f)) { lighterFlame.localScale = new Vector3(1f + 0.5f * Mathf.Sin(MathF.PI * lighterFlameLerp), 1f, (Mathf.Sin(MathF.PI / 2f * lighterFlameLerp) + 0.25f * Mathf.Sin(MathF.PI * lighterFlameLerp)) * (0.7f + 0.3f * lighterFuelRatio) * (0.5f + lighterEmptyLerp / 2f)); lighterLight.intensity = (10f + 5f * lighterFuelRatio) * lighterEmptyLerp * lighterFlameLerp + lighterFlameFlicker.localScale.x; lighterFlameSprite.color = new Color(1f, (0.75f + Mathf.Sin(MathF.PI / 2f * lighterFlameLerp) * 0.25f) * (0.7f + 0.3f * lighterFuelRatio) * lighterEmptyLerp, 0.4f + 0.6f * lighterFuelRatio, Mathf.Sin(MathF.PI / 2f * lighterFlameLerp) * (0.7f + 0.3f * lighterFuelRatio) * lighterEmptyLerp); } } } public class TrophyItem : PhysicsProp { public Material[] trophyPlaques; public int plaque; public override void InitializeAfterPositioning() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).InitializeAfterPositioning(); if (plaque <= 0) { 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 - 1] }); } 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(); } } }