forked from nikita/muzika-gromche
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.
This commit is contained in:
parent
829c44e347
commit
0d4f180a37
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue