Decompiled source of ComedianSound v1.0.7

ComedianSound.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using ComedianSound.Patches;
using GameNetcodeStuff;
using HarmonyLib;
using LCSoundTool;
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("ComedianSound")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ComedianSound")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("361fc50e-4661-43c4-89a7-82688169550e")]
[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 ComedianSound
{
	[BepInPlugin("RuinaDevelopment.ComedianSound", "Comedy sound of deaths", "1.0.0")]
	public class ComedianSoundBase : BaseUnityPlugin
	{
		private const string modGUID = "RuinaDevelopment.ComedianSound";

		private const string modName = "Comedy sound of deaths";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("RuinaDevelopment.ComedianSound");

		private static ComedianSoundBase PluginInstance;

		internal static ManualLogSource mls;

		public static ComedianSoundBase GetInstance()
		{
			return PluginInstance;
		}

		private void Awake()
		{
			if (Object.op_Implicit((Object)(object)(PluginInstance = null)))
			{
				PluginInstance = this;
			}
			mls = Logger.CreateLogSource("RuinaDevelopment.ComedianSound");
			mls.LogInfo((object)"ComedianSound loaded");
			harmony.PatchAll(typeof(ComedianSoundBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace ComedianSound.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch : BaseUnityPlugin
	{
		[HarmonyPatch("KillPlayer")]
		[HarmonyPostfix]
		private static void AnnounceDeath(PlayerControllerB __instance)
		{
			if (__instance.isPlayerDead)
			{
				AudioClip audioClip = SoundTool.GetAudioClip("RuinaDevelopment-ComedianSound", "audio.wav");
				AudioSource val = ((Component)__instance).gameObject.AddComponent<AudioSource>();
				val.clip = audioClip;
				val.Play();
			}
		}
	}
}