Add config option to skip tracks marked as Explicit Content/Lyrics
Unfortunately it is configurable by host only, and there is no sane way to make work from clients.
This commit is contained in:
parent
2a33457661
commit
8e065d3e51
|
@ -371,6 +371,7 @@ namespace MuzikaGromche
|
|||
Name = "PWNED",
|
||||
AudioType = AudioType.OGGVORBIS,
|
||||
Language = Language.ENGLISH,
|
||||
IsExplicit = true,
|
||||
WindUpTimer = 39.73f,
|
||||
Bars = 32,
|
||||
BeatsOffset = -0.2f,
|
||||
|
@ -466,12 +467,13 @@ namespace MuzikaGromche
|
|||
public static Track ChooseTrack()
|
||||
{
|
||||
var seed = RoundManager.Instance.dungeonGenerator.Generator.ChosenSeed;
|
||||
int[] weights = [.. Tracks.Select(track => track.Weight.Value)];
|
||||
var tracks = Config.SkipExplicitTracks.Value ? [.. Tracks.Where(track => !track.IsExplicit)] : Tracks;
|
||||
int[] weights = [.. tracks.Select(track => track.Weight.Value)];
|
||||
var rwi = new RandomWeightedIndex(weights);
|
||||
var trackId = rwi.GetRandomWeightedIndex(seed);
|
||||
var track = Tracks[trackId];
|
||||
var track = tracks[trackId];
|
||||
Debug.Log($"Seed is {seed}, chosen track is \"{track.Name}\", #{trackId} of {rwi}");
|
||||
return Tracks[trackId];
|
||||
return tracks[trackId];
|
||||
}
|
||||
|
||||
public static Track CurrentTrack;
|
||||
|
@ -616,6 +618,8 @@ namespace MuzikaGromche
|
|||
public string Name;
|
||||
// Language of the track's lyrics.
|
||||
public Language Language;
|
||||
// Whether this track has NSFW/explicit lyrics.
|
||||
public bool IsExplicit = false;
|
||||
// Wind-up time can and should be shorter than the Start audio track,
|
||||
// so that the "pop" effect can be baked into the Start audio and kept away
|
||||
// from the looped part. This also means that the light show starts before
|
||||
|
@ -1395,6 +1399,8 @@ namespace MuzikaGromche
|
|||
|
||||
public static ConfigEntry<float> AudioOffset { get; private set; }
|
||||
|
||||
public static ConfigEntry<bool> SkipExplicitTracks { get; private set; }
|
||||
|
||||
public static bool ShouldSkipWindingPhase { get; private set; } = false;
|
||||
|
||||
public static Palette PaletteOverride { get; private set; } = null;
|
||||
|
@ -1423,6 +1429,10 @@ namespace MuzikaGromche
|
|||
new AcceptableValueRange<float>(-0.5f, 0.5f)));
|
||||
LethalConfigManager.AddConfigItem(new FloatSliderConfigItem(AudioOffset, requiresRestart: false));
|
||||
|
||||
SkipExplicitTracks = configFile.Bind("General", "Skip Explicit Tracks", false,
|
||||
new ConfigDescription("When choosing tracks at random, skip the ones with Explicit Content/Lyrics."));
|
||||
LethalConfigManager.AddConfigItem(new BoolCheckBoxConfigItem(SkipExplicitTracks, requiresRestart: false));
|
||||
|
||||
#if DEBUG
|
||||
SetupEntriesToSkipWinding(configFile);
|
||||
SetupEntriesForPaletteOverride(configFile);
|
||||
|
@ -1462,8 +1472,8 @@ namespace MuzikaGromche
|
|||
}
|
||||
|
||||
// Create slider entry for track
|
||||
string name = $"[{language.Short}] {track.Name}";
|
||||
string description = $"Language: {language.Full}\n\nRandom (relative) chance of selecting this track.\n\nSet to zero to effectively disable the track.";
|
||||
string warning = track.IsExplicit ? "Explicit Content/Lyrics!\n\n" : "";
|
||||
string description = $"Language: {language.Full}\n\n{warning}Random (relative) chance of selecting this track.\n\nSet to zero to effectively disable the track.";
|
||||
track.Weight = configFile.BindSyncedEntry(
|
||||
new ConfigDefinition(section, track.Name),
|
||||
50,
|
||||
|
|
Loading…
Reference in New Issue