using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TurretTf2Sound.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TurretTf2Sound")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TurretTf2Sound")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7877c248-1e7c-4842-8d77-3a29f4576973")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TurretTf2Sound
{
[BepInPlugin("Arlecchino.Tf2TurretSoundMod", "Turret Tf2 Sentry sound mod", "1.0.0")]
public class Tf2TurretSound : BaseUnityPlugin
{
private const string modGUID = "Arlecchino.Tf2TurretSoundMod";
private const string modName = "Turret Tf2 Sentry sound mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Arlecchino.Tf2TurretSoundMod");
private static Tf2TurretSound Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFX;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Arlecchino.Tf2TurretSoundMod");
mls.LogInfo((object)"Tf2 turret mod started");
harmony.PatchAll(typeof(Tf2TurretSound));
harmony.PatchAll(typeof(TurretPatch));
mls = ((BaseUnityPlugin)this).Logger;
SoundFX = new List<AudioClip>();
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("TurretTf2Sound.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "sentrytf2");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"Successfully loaded asset bundle");
SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogError((object)"Failed to load asset bundle");
}
}
}
}
namespace TurretTf2Sound.Patches
{
[HarmonyPatch(typeof(Turret))]
internal class TurretPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void OverrideAudio(Turret __instance)
{
__instance.detectPlayerSFX = Tf2TurretSound.SoundFX[0];
__instance.firingSFX = Tf2TurretSound.SoundFX[1];
__instance.firingFarSFX = Tf2TurretSound.SoundFX[2];
__instance.turretDeactivate = Tf2TurretSound.SoundFX[3];
}
}
}