From 0d4f180a37f5a1bc5a87272954cf4cbd5f442b75 Mon Sep 17 00:00:00 2001 From: ivan tkachenko Date: Tue, 15 Jul 2025 23:23:23 +0300 Subject: [PATCH] Add debug-only ability to change weights of tracks while on a moon And drop obsoleted debug code. With the new on-the-fly track weights configuration, hardcoding one in build is not necessary anymore. --- MuzikaGromche/Plugin.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index 8656e96..0a68a3b 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -68,21 +68,12 @@ namespace MuzikaGromche } ]; - public static int IndexOfTrack(string trackName) - { - return Array.FindIndex(Tracks, track => track.Name == trackName); - } - public static Track ChooseTrack() { var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed; int[] weights = [.. Tracks.Select(track => track.Weight.Value)]; var rwi = new RandomWeightedIndex(weights); var trackId = rwi.GetRandomWeightedIndex(seed); -#if DEBUG - // Override for testing - // trackId = IndexOfTrack("DeployDestroy"); -#endif var track = Tracks[trackId]; Debug.Log($"Seed is {seed}, chosen track is \"{track.Name}\", #{trackId} of {rwi}"); return Tracks[trackId]; @@ -412,10 +403,12 @@ namespace MuzikaGromche { return CanModifyResult.False("Only for host"); } +#if !DEBUG // Changing tracks on the fly might lead to a desync. But it may speed up development process if (!startOfRound.inShipPhase) { return CanModifyResult.False("Only while orbiting"); } +#endif return CanModifyResult.True(); }