1
0
Fork 0

Select new random track groups every time

This commit is contained in:
ivan tkachenko 2026-04-06 05:45:17 +03:00
parent dfefc06abf
commit b99e4c1e2c
3 changed files with 23 additions and 17 deletions

View File

@ -6,6 +6,8 @@
- Show real Artist & Song info in the config. - Show real Artist & Song info in the config.
- Added a new track Yesterday. - Added a new track Yesterday.
- Added lyrics to the existing track HighLow. - Added lyrics to the existing track HighLow.
- New random track will be selected every time instead of having the same track all day.
- Groupped tracks (verses of the same song) are still played together in a sequence.
## MuzikaGromche 1337.9001.68 - LocalHost hotfix ## MuzikaGromche 1337.9001.68 - LocalHost hotfix

View File

@ -35,12 +35,8 @@ namespace MuzikaGromche
private static int GetCurrentSeed() private static int GetCurrentSeed()
{ {
var seed = 0; var rng = new System.Random(unchecked((int)DateTime.Now.Ticks));
var roundManager = RoundManager.Instance; var seed = rng.Next();
if (roundManager != null && roundManager.dungeonGenerator != null)
{
seed = roundManager.dungeonGenerator.Generator.ChosenSeed;
}
return seed; return seed;
} }
@ -2049,11 +2045,6 @@ namespace MuzikaGromche
const string IntroAudioGameObjectName = "MuzikaGromcheAudio (Intro)"; const string IntroAudioGameObjectName = "MuzikaGromcheAudio (Intro)";
const string LoopAudioGameObjectName = "MuzikaGromcheAudio (Loop)"; const string LoopAudioGameObjectName = "MuzikaGromcheAudio (Loop)";
// Number of times a selected track has been played.
// Increases by 1 with each ChooseTrackOnServer call.
// Resets on SettingChanged.
private int SelectedTrackIndex = 0;
internal IAudioTrack? CurrentTrack = null; internal IAudioTrack? CurrentTrack = null;
internal BeatTimeState? BeatTimeState = null; internal BeatTimeState? BeatTimeState = null;
internal AudioSource IntroAudioSource = null!; internal AudioSource IntroAudioSource = null!;
@ -2145,7 +2136,8 @@ namespace MuzikaGromche
private void ChooseTrackDeferredDelegate(object sender, EventArgs e) private void ChooseTrackDeferredDelegate(object sender, EventArgs e)
{ {
SelectedTrackIndex = 0; HostSelectableTrack = null;
HostSelectableTrackIndex = 0;
ChooseTrackDeferred(); ChooseTrackDeferred();
} }
@ -2226,13 +2218,25 @@ namespace MuzikaGromche
} }
} }
// Host selected this group of tracks, and
private ISelectableTrack? HostSelectableTrack = null;
// Number of times a selected track has been played.
// Increases by 1 with each ChooseTrackOnServer call.
// Resets on SettingChanged.
private int HostSelectableTrackIndex = 0;
void ChooseTrackOnServer() void ChooseTrackOnServer()
{ {
var selectableTrack = Plugin.ChooseTrack(); if (HostSelectableTrack == null || HostSelectableTrackIndex >= HostSelectableTrack.Count())
var audioTrack = selectableTrack.SelectTrack(SelectedTrackIndex); {
Plugin.Log.LogInfo($"ChooseTrackOnServer {selectableTrack.Name} #{SelectedTrackIndex} {audioTrack.Name}"); HostSelectableTrack = Plugin.ChooseTrack();
HostSelectableTrackIndex = 0;
}
var audioTrack = HostSelectableTrack.SelectTrack(HostSelectableTrackIndex);
Plugin.Log.LogInfo($"ChooseTrackOnServer {HostSelectableTrack.Name} #{HostSelectableTrackIndex} {audioTrack.Name}");
SetTrackClientRpc(audioTrack.Name); SetTrackClientRpc(audioTrack.Name);
SelectedTrackIndex += 1; HostSelectableTrackIndex += 1;
} }
void ChooseTrackCompat() void ChooseTrackCompat()

View File

@ -2,7 +2,7 @@
_Add some content to your Inverse teleporter experience on Titan!<sup>1</sup>_ _Add some content to your Inverse teleporter experience on Titan!<sup>1</sup>_
Muzika Gromche literally means _"crank music louder"_. This mod replaces Jester's winding up and chasing sounds with **a whole library** of timed to the beat and **seamlessly looped** popular energetic songs, combined with various **visual effects**. Song choice is random each day but **synchronized** with clients: everyone in the lobby will vibe to the same tunes, however **vanilla-compatible** client-side playback is also supported. Muzika Gromche literally means _"crank music louder"_. This mod replaces Jester's winding up and chasing sounds with **a whole library** of timed to the beat and **seamlessly looped** popular energetic songs, combined with various **visual effects**. Song choice is random each time but **synchronized** with clients: everyone in the lobby will vibe to the same tunes, however **vanilla-compatible** client-side playback is also supported.
A demo video is worth a thousand words. Check out what Muzika Gromche does: A demo video is worth a thousand words. Check out what Muzika Gromche does: