mirror of
https://github.com/ppy/osu
synced 2024-12-15 19:36:34 +00:00
Merge pull request #16979 from smoogipoo/fix-playlists-partial-mod
Fix playlists not allowing entry with partial mods
This commit is contained in:
commit
d69446ff6e
@ -121,6 +121,17 @@ namespace osu.Game.Tests.Online
|
||||
Assert.That((deserialised?.Mods[0])?.Settings["speed_change"], Is.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAPIModDetachedFromSource()
|
||||
{
|
||||
var mod = new OsuModDoubleTime { SpeedChange = { Value = 1.01 } };
|
||||
var apiMod = new APIMod(mod);
|
||||
|
||||
mod.SpeedChange.Value = 1.5;
|
||||
|
||||
Assert.That(apiMod.Settings["speed_change"], Is.EqualTo(1.01d));
|
||||
}
|
||||
|
||||
private class TestRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[]
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Online.API
|
||||
var bindable = (IBindable)property.GetValue(mod);
|
||||
|
||||
if (!bindable.IsDefault)
|
||||
Settings.Add(property.Name.Underscore(), bindable);
|
||||
Settings.Add(property.Name.Underscore(), ModUtils.GetSettingUnderlyingValue(bindable));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Scoring;
|
||||
@ -40,8 +39,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
if (ruleset.Value.OnlineID != PlaylistItem.RulesetID)
|
||||
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
|
||||
|
||||
var localMods = Mods.Value.Select(m => new APIMod(m)).ToArray();
|
||||
if (!PlaylistItem.RequiredMods.All(m => localMods.Any(m.Equals)))
|
||||
var requiredLocalMods = PlaylistItem.RequiredMods.Select(m => m.ToMod(GameplayState.Ruleset));
|
||||
if (!requiredLocalMods.All(m => Mods.Value.Any(m.Equals)))
|
||||
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user