Pass allowed mods and consume on server callback

This commit is contained in:
smoogipoo 2021-01-29 18:21:22 +09:00
parent b79d1c7b81
commit ab9a3e6dd0
1 changed files with 4 additions and 1 deletions

View File

@ -192,7 +192,8 @@ public Task ChangeSettings(Optional<string> name = default, Optional<PlaylistIte
BeatmapID = item.GetOr(existingPlaylistItem).BeatmapID,
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
Mods = item.HasValue ? item.Value.AsNonNull().RequiredMods.Select(m => new APIMod(m)).ToList() : Room.Settings.Mods
Mods = item.HasValue ? item.Value.AsNonNull().RequiredMods.Select(m => new APIMod(m)).ToList() : Room.Settings.Mods,
AllowedMods = item.HasValue ? item.Value.AsNonNull().AllowedMods.Select(m => new APIMod(m)).ToList() : Room.Settings.AllowedMods
});
}
@ -502,6 +503,7 @@ private void updatePlaylist(MultiplayerRoomSettings settings, APIBeatmapSet onli
var ruleset = rulesets.GetRuleset(settings.RulesetID).CreateInstance();
var mods = settings.Mods.Select(m => m.ToMod(ruleset));
var allowedMods = settings.AllowedMods.Select(m => m.ToMod(ruleset));
PlaylistItem playlistItem = new PlaylistItem
{
@ -511,6 +513,7 @@ private void updatePlaylist(MultiplayerRoomSettings settings, APIBeatmapSet onli
};
playlistItem.RequiredMods.AddRange(mods);
playlistItem.AllowedMods.AddRange(allowedMods);
apiRoom.Playlist.Clear(); // Clearing should be unnecessary, but here for sanity.
apiRoom.Playlist.Add(playlistItem);