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 SignalHorn v1.2.0
SignalHorn.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SignalHorn1.1")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SignalHorn1.1")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("920ab2d1-d722-4a4e-83bf-316d39736b4a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace SignalHorn; [BepInPlugin("com.author.signalhorn", "SignalHorn", "1.2.0")] public class SignalHornPlugin : BaseUnityPlugin { public const string PluginGUID = "com.author.signalhorn"; public const string PluginName = "SignalHorn"; public const string PluginVersion = "1.2.0"; private readonly Harmony harmony = new Harmony("com.author.signalhorn"); private static string soundFilePath = ""; public static SignalHornPlugin Instance { get; private set; } private void Awake() { Instance = this; harmony.PatchAll(); FindAudioFile(); ((MonoBehaviour)this).StartCoroutine(RegisterRpcDelayed()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[SignalHorn] SignalHorn 1.2.0 успешно загружен!"); } private IEnumerator RegisterRpcDelayed() { while (ZRoutedRpc.instance == null) { yield return null; } ZRoutedRpc.instance.Register<Vector3>("RPC_SignalHorn_PlaySound", (Action<long, Vector3>)RPC_PlaySound); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[SignalHorn] Сетевой RPC успешно зарегистрирован!"); } private static void RPC_PlaySound(long sender, Vector3 position) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance != (Object)null) { Instance.PlayHornAtPosition(position); } } private void Update() { if (Input.GetKeyDown((KeyCode)104)) { TriggerHorn(); } } public void TriggerHorn() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null)) { PlayHornAtPosition(((Component)Player.m_localPlayer).transform.position); if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_SignalHorn_PlaySound", new object[1] { ((Component)Player.m_localPlayer).transform.position }); } } } public void PlayHornAtPosition(Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(PlayHornAudioRoutine(position)); } private IEnumerator PlayHornAudioRoutine(Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(soundFilePath) || !File.Exists(soundFilePath)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[SignalHorn] Файл horn.wav не найден!"); yield break; } string url = "file://" + soundFilePath; UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)20); try { yield return www.SendWebRequest(); if ((int)www.result == 2 || (int)www.result == 3) { ((BaseUnityPlugin)this).Logger.LogError((object)("[SignalHorn] Ошибка загрузки звука: " + www.error)); yield break; } AudioClip clip = DownloadHandlerAudioClip.GetContent(www); if ((Object)(object)clip != (Object)null) { GameObject audioObj = new GameObject("SignalHornAudioSource"); audioObj.transform.position = position; AudioSource audioSource = audioObj.AddComponent<AudioSource>(); audioSource.clip = clip; audioSource.volume = 1f; audioSource.spatialBlend = 1f; audioSource.minDistance = 10f; audioSource.maxDistance = 150f; audioSource.rolloffMode = (AudioRolloffMode)1; audioSource.Play(); Object.Destroy((Object)(object)audioObj, clip.length + 1f); } } finally { ((IDisposable)www)?.Dispose(); } } private void FindAudioFile() { string[] files = Directory.GetFiles(Paths.PluginPath, "horn.wav", SearchOption.AllDirectories); if (files.Length != 0) { soundFilePath = files[0]; ((BaseUnityPlugin)this).Logger.LogInfo((object)("[SignalHorn] Найден звуковой файл: " + soundFilePath)); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"[SignalHorn] Файл horn.wav не найден в папке plugins!"); } } }