Please disclose if your mod was created primarily 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 Smoke Detector v1.0.2
SmokeDetectorMod.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using SmokeDetectorMod.Behaviors; 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("SmokeDetectorMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SmokeDetectorMod")] [assembly: AssemblyTitle("SmokeDetectorMod")] [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 SmokeDetectorMod { [BepInPlugin("mmudrick.SmokeDetector", "Smoke Detector", "1.0.0")] public class SmokeDetector : BaseUnityPlugin { private const string modGUID = "mmudrick.SmokeDetector"; private const string modName = "Smoke Detector"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("mmudrick.SmokeDetector"); private static SmokeDetector Instance; internal static ManualLogSource mls; internal static List<AudioClip> SoundFX; internal static AudioSource ChirpSource; internal static Item smokeDetector; internal static AssetBundle SoundBundle; internal static AssetBundle ItemBundle; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("mmudrick.SmokeDetector"); mls.LogInfo((object)"The Smoke Detector mod has awoken"); mls = ((BaseUnityPlugin)this).Logger; SoundFX = new List<AudioClip>(); string location = ((BaseUnityPlugin)Instance).Info.Location; location = location.TrimEnd("SmokeDetectorMod.dll".ToCharArray()); ItemBundle = AssetBundle.LoadFromFile(location + "smokedetector"); SoundBundle = AssetBundle.LoadFromFile(location + "chirp"); if ((Object)(object)SoundBundle != (Object)null) { SoundFX = SoundBundle.LoadAllAssets<AudioClip>().ToList(); mls.LogInfo((object)"Successfully loaded sound asset bundle"); } else { mls.LogError((object)"Failed to load sound asset bundle"); } if ((Object)(object)ItemBundle != (Object)null) { smokeDetector = ItemBundle.LoadAsset<Item>("Assets/SmokeDetector/SmokeDetectorItem.asset"); mls.LogInfo((object)"Successfully loaded item asset bundle"); } else { mls.LogError((object)"Failed to load item asset bundle"); } ChirpItem chirpItem = smokeDetector.spawnPrefab.AddComponent<ChirpItem>(); ((GrabbableObject)chirpItem).grabbable = true; ((GrabbableObject)chirpItem).grabbableToEnemies = true; ((GrabbableObject)chirpItem).itemProperties = smokeDetector; NetworkPrefabs.RegisterNetworkPrefab(smokeDetector.spawnPrefab); Utilities.FixMixerGroups(smokeDetector.spawnPrefab); Items.RegisterScrap(smokeDetector, 30, (LevelTypes)(-1)); } } } namespace SmokeDetectorMod.Behaviors { internal class ChirpItem : PhysicsProp { private const float noiseRange = 30f; private const float noiseLoudness = 1f; private const float chirpCooldown = 60f; private float chirpTime = 0f; private AudioSource chirpSource; public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if ((Object)(object)chirpSource == (Object)null) { chirpSource = ((Component)this).gameObject.GetComponent<AudioSource>(); } if (buttonDown && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { chirpSource.PlayOneShot(SmokeDetector.SoundFX[0]); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 30f, 1f, 0, StartOfRound.Instance.hangarDoorsClosed, 0); } } public override void Update() { ((GrabbableObject)this).Update(); if ((Object)(object)chirpSource == (Object)null) { chirpSource = ((Component)this).gameObject.GetComponent<AudioSource>(); } if (chirpTime >= 60f) { chirpSource.PlayOneShot(SmokeDetector.SoundFX[0]); chirpTime = 0f; } else { chirpTime += Time.deltaTime; } } } }