mirror of https://github.com/ppy/osu
Pass allowed mods and consume on server callback
This commit is contained in:
parent
b79d1c7b81
commit
ab9a3e6dd0
|
@ -192,7 +192,8 @@ public Task ChangeSettings(Optional<string> name = default, Optional<PlaylistIte
|
||||||
BeatmapID = item.GetOr(existingPlaylistItem).BeatmapID,
|
BeatmapID = item.GetOr(existingPlaylistItem).BeatmapID,
|
||||||
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
BeatmapChecksum = item.GetOr(existingPlaylistItem).Beatmap.Value.MD5Hash,
|
||||||
RulesetID = item.GetOr(existingPlaylistItem).RulesetID,
|
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 ruleset = rulesets.GetRuleset(settings.RulesetID).CreateInstance();
|
||||||
var mods = settings.Mods.Select(m => m.ToMod(ruleset));
|
var mods = settings.Mods.Select(m => m.ToMod(ruleset));
|
||||||
|
var allowedMods = settings.AllowedMods.Select(m => m.ToMod(ruleset));
|
||||||
|
|
||||||
PlaylistItem playlistItem = new PlaylistItem
|
PlaylistItem playlistItem = new PlaylistItem
|
||||||
{
|
{
|
||||||
|
@ -511,6 +513,7 @@ private void updatePlaylist(MultiplayerRoomSettings settings, APIBeatmapSet onli
|
||||||
};
|
};
|
||||||
|
|
||||||
playlistItem.RequiredMods.AddRange(mods);
|
playlistItem.RequiredMods.AddRange(mods);
|
||||||
|
playlistItem.AllowedMods.AddRange(allowedMods);
|
||||||
|
|
||||||
apiRoom.Playlist.Clear(); // Clearing should be unnecessary, but here for sanity.
|
apiRoom.Playlist.Clear(); // Clearing should be unnecessary, but here for sanity.
|
||||||
apiRoom.Playlist.Add(playlistItem);
|
apiRoom.Playlist.Add(playlistItem);
|
||||||
|
|
Loading…
Reference in New Issue