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 DetectorMod v1.0.6
plugin/Detector.dll
Decompiled 2 years agousing 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 Detector.Behaviours; using LethalLib.Modules; 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("Detector")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("???")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Detector")] [assembly: AssemblyTitle("Detector")] [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 Detector { [BepInPlugin("Detector", "Detector", "1.0.2")] public class Plugin : BaseUnityPlugin { private const string GUID = "Detector"; private const string NAME = "Detector"; private const string PLUGIN = "1.0.2"; public static Plugin instance; public void Awake() { if ((Object)(object)instance != (Object)null) { instance = this; } string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "detector-mod"); ((BaseUnityPlugin)this).Logger.LogInfo((object)text); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("assets/detector/detector-item.asset"); val2.creditsWorth = 10; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); DetectorItem detectorItem = val2.spawnPrefab.AddComponent<DetectorItem>(); ((GrabbableObject)detectorItem).grabbable = true; ((GrabbableObject)detectorItem).grabbableToEnemies = true; ((GrabbableObject)detectorItem).itemProperties = val2; Items.RegisterScrap(val2, 25, (LevelTypes)(-1)); TerminalNode val3 = ScriptableObject.CreateInstance<TerminalNode>(); val3.clearPreviousText = true; val3.displayText = "info here\n\n"; Items.RegisterShopItem(val2, (TerminalNode)null, (TerminalNode)null, val3, 35); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Detector is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "Detector"; public const string PLUGIN_NAME = "Detector"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Detector.Behaviours { internal class DetectorItem : PhysicsProp { public enum DetectorStatus { OFF, HEALTHY, UNHEALTHY, CRITICAL } private DetectorStatus status = DetectorStatus.OFF; private bool inRange = false; private Light indicator; [SerializeField] private float detectionRange = 20f; private Material red; private Material green; private MeshRenderer onOffIndicator; private AudioSource detectSound; private AnimationCurve beepDelayCurve; private float beepDelay = 0f; private float currentDist = 10f; private bool playSound = false; public override void Start() { ((GrabbableObject)this).Start(); beepDelayCurve = AnimationCurve.EaseInOut(0f, 10f, detectionRange, 0.15f); indicator = ((Component)this).GetComponentInChildren<Light>(); red = ((Renderer)((Component)((Component)this).transform.GetChild(3).GetChild(0)).GetComponent<MeshRenderer>()).material; green = ((Renderer)((Component)((Component)this).transform.GetChild(3).GetChild(1)).GetComponent<MeshRenderer>()).material; onOffIndicator = ((Component)((Component)this).transform.GetChild(0).GetChild(1)).GetComponent<MeshRenderer>(); detectSound = ((Component)((Component)this).transform.GetChild(4).GetChild(0)).GetComponent<AudioSource>(); } public override void DiscardItem() { playSound = false; ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { playSound = true; ((PhysicsProp)this).EquipItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); ((GrabbableObject)this).isBeingUsed = !((GrabbableObject)this).isBeingUsed; playSound = ((GrabbableObject)this).isBeingUsed; Debug.Log((object)playSound); status = ((((GrabbableObject)this).isBeingUsed && !(((GrabbableObject)this).insertedBattery.charge <= 0f)) ? ((((GrabbableObject)this).insertedBattery.charge > 0.35f) ? DetectorStatus.HEALTHY : DetectorStatus.UNHEALTHY) : DetectorStatus.OFF); if (!((GrabbableObject)this).isBeingUsed) { ((Behaviour)indicator).enabled = false; } if (((GrabbableObject)this).isBeingUsed && status != 0) { ((Renderer)onOffIndicator).material = green; } else if (!((GrabbableObject)this).isBeingUsed || status == DetectorStatus.OFF) { ((Renderer)onOffIndicator).material = red; } } public override void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, detectionRange, LayerMask.GetMask(new string[1] { "Enemies" })); if (array.Length != 0) { inRange = true; } if (inRange) { if (!((Behaviour)indicator).enabled && ((GrabbableObject)this).isBeingUsed) { ((Behaviour)indicator).enabled = true; indicator.intensity = 0f; } else if (playSound && ((GrabbableObject)this).isBeingUsed && array.Length != 0) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)array[0]).transform.position); float num2 = detectionRange - num; indicator.intensity = 0.1f * num2 * num2; if (beepDelay <= 0f) { Debug.Log((object)"BEEPE"); detectSound.Play(); currentDist = num; beepDelay = beepDelayCurve.Evaluate(currentDist); } } } else if (!((Behaviour)indicator).enabled && ((GrabbableObject)this).isBeingUsed && status == DetectorStatus.UNHEALTHY) { Debug.Log((object)("twtf, " + status)); float num3 = Random.Range(0, 100); bool flag = num3 > 95f; beepDelay -= beepDelayCurve.Evaluate(num3) * Time.deltaTime; if (flag) { ((MonoBehaviour)this).StartCoroutine(detectNothing()); } } beepDelay -= beepDelayCurve.Evaluate(currentDist) * Time.deltaTime; } private IEnumerator detectNothing() { Debug.Log((object)"BREAK"); float duration = Random.Range(2, 10); while (duration > 0f) { indicator.intensity = Random.Range(0, 40); duration -= Time.deltaTime; yield return 0; } yield return null; } public override void UseUpBatteries() { ((GrabbableObject)this).UseUpBatteries(); ((Behaviour)indicator).enabled = false; } } }