commit e95bbff8de5893fc93bc5cbe3f16debd9697d3ac Author: Rendo Date: Thu Sep 10 20:49:41 2026 +0500 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd42ee3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/ +obj/ diff --git a/Audio/Death.wav b/Audio/Death.wav new file mode 100644 index 0000000..3ecba4c Binary files /dev/null and b/Audio/Death.wav differ diff --git a/Audio/Fostral.wav b/Audio/Fostral.wav new file mode 100644 index 0000000..d4c3b9f Binary files /dev/null and b/Audio/Fostral.wav differ diff --git a/Audio/Glorx.wav b/Audio/Glorx.wav new file mode 100644 index 0000000..792ddea Binary files /dev/null and b/Audio/Glorx.wav differ diff --git a/Audio/Infernals.wav b/Audio/Infernals.wav new file mode 100644 index 0000000..4c66c40 Binary files /dev/null and b/Audio/Infernals.wav differ diff --git a/Audio/MainTheme.wav b/Audio/MainTheme.wav new file mode 100644 index 0000000..165841b Binary files /dev/null and b/Audio/MainTheme.wav differ diff --git a/Audio/Necross.wav b/Audio/Necross.wav new file mode 100644 index 0000000..0e82fc9 Binary files /dev/null and b/Audio/Necross.wav differ diff --git a/Audio/OuterWorlds.wav b/Audio/OuterWorlds.wav new file mode 100644 index 0000000..8e738db Binary files /dev/null and b/Audio/OuterWorlds.wav differ diff --git a/Audio/VangersForever.wav b/Audio/VangersForever.wav new file mode 100644 index 0000000..12dd3f2 Binary files /dev/null and b/Audio/VangersForever.wav differ diff --git a/Audio/Xplo.wav b/Audio/Xplo.wav new file mode 100644 index 0000000..c93c83c Binary files /dev/null and b/Audio/Xplo.wav differ diff --git a/Plugin.cs b/Plugin.cs new file mode 100644 index 0000000..5ebb6d4 --- /dev/null +++ b/Plugin.cs @@ -0,0 +1,93 @@ +using System.IO; +using System.Collections; +using System.Collections.Generic; +using BepInEx; +using BepInEx.Logging; +using UnityEngine; +using HarmonyLib; +using CUCoreLib.Helpers; + +namespace VangersMusic; + +[BepInPlugin(MOD_CUSTOM_ID, MOD_CUSTOM_NAME, MOD_CUSTOM_VER)] +[BepInDependency("net.cucorelib", BepInDependency.DependencyFlags.HardDependency)] +public class Plugin : BaseUnityPlugin +{ + internal static new ManualLogSource Logger; + private readonly Harmony _harmony = new(MOD_CUSTOM_ID); + + const string MOD_CUSTOM_ID = "org.rendo.vangersmusic"; + const string MOD_CUSTOM_NAME = "VangersMusic"; + const string MOD_CUSTOM_VER = "0.1"; + + private AudioClip _mainMenu; + private AudioClip[] _location; + private AudioClip _death; + private AudioClip _dying; + private AudioClip _infernals; + + private SongList GenerateSongList(AudioClip forClip) { + SongList list = new SongList(); + list.songs = new AudioClip[] {forClip}; + return list; + } + + + private void Awake() + { + // Plugin startup logic + Logger = base.Logger; + + _mainMenu = AssetLoader.LoadEmbeddedAudio("Audio.MainTheme.wav"); + + _location = new AudioClip[] { + AssetLoader.LoadEmbeddedAudio("Audio.Fostral.wav"), + AssetLoader.LoadEmbeddedAudio("Audio.Necross.wav"), + AssetLoader.LoadEmbeddedAudio("Audio.Glorx.wav"), + AssetLoader.LoadEmbeddedAudio("Audio.Xplo.wav"), + AssetLoader.LoadEmbeddedAudio("Audio.OuterWorlds.wav"), + }; + + _death = AssetLoader.LoadEmbeddedAudio("Audio.Death.wav"); + _dying = AssetLoader.LoadEmbeddedAudio("Audio.VangersForever.wav"); + _infernals = AssetLoader.LoadEmbeddedAudio("Audio.Infernals.wav"); + + Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!"); + StartCoroutine(OverrideMenuMusic()); + StartCoroutine(OverrideMusicManager()); + + } + private void Start() { + PreRunScript.instance.menuSongs = new List(){_mainMenu}; + } + private IEnumerator OverrideMusicManager() { + while (true) { + Logger.LogInfo("Waiting for music player to load"); + yield return new WaitUntil(()=> MusicManager.main != null); + Logger.LogInfo("Started overriding music"); + + MusicManager.main.deadClip = _death; + MusicManager.main.dyingClip = _dying; + MusicManager.main.biomeMusic = new SongList[] { + GenerateSongList(_location[0]), + GenerateSongList(_location[1]), + GenerateSongList(_location[2]), + GenerateSongList(_location[3]), + GenerateSongList(_location[4]), + }; + foreach(var droneTrack in MusicManager.main.droneTracks) { + droneTrack.clip = _infernals; + } + Logger.LogInfo("Ended overriding music"); + yield return new WaitUntil(()=> MusicManager.main == null); + } + } + private IEnumerator OverrideMenuMusic() { + while (true) { + yield return new WaitUntil(()=> PreRunScript.instance != null); + + PreRunScript.instance.menuSongs = new List(){_mainMenu}; + yield return new WaitUntil(()=> PreRunScript.instance == null); + } + } +} diff --git a/VangersMusic.csproj b/VangersMusic.csproj new file mode 100644 index 0000000..4b90f3f --- /dev/null +++ b/VangersMusic.csproj @@ -0,0 +1,38 @@ + + + + netstandard2.1 + VangersMusic + VangersMusic + 1.0.0 + true + latest + + https://api.nuget.org/v3/index.json; + https://nuget.bepinex.dev/v3/index.json; + https://nuget.samboy.dev/v3/index.json + + VangersMusic + + + + + + + + ../../../CasualtiesUnknown_Data/Managed/Assembly-CSharp.dll + + + ../CUCoreLib.dll + + + + + + + + + + + +