mirror of https://github.com/ppy/osu
Remove `IApplicableToDifficulty.ReadFromDifficulty`
This was added specifically for `ModDifficultyAdjust`, but turned out to be more of a headache than we expected. We have since removed usage and would hope that this is not required by any other mods. Opting for complete removal rather than obsoletion, as we discovered this was already broken in multiple cases, with fixes being quite logically complex. If you happen to be a ruleset developer relying on this, open an issue and we'll talk you through a better approach (or check what `ModDifficultyAdjust` is doing now for an example).
This commit is contained in:
parent
48d5a3f94f
commit
ed29646291
|
@ -525,16 +525,11 @@ public override Task Import(params ImportTask[] imports)
|
||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
beatmap.OldValue?.CancelAsyncLoad();
|
beatmap.OldValue?.CancelAsyncLoad();
|
||||||
|
|
||||||
updateModDefaults();
|
|
||||||
|
|
||||||
beatmap.NewValue?.BeginAsyncLoad();
|
beatmap.NewValue?.BeginAsyncLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||||
{
|
{
|
||||||
updateModDefaults();
|
|
||||||
|
|
||||||
// a lease may be taken on the mods bindable, at which point we can't really ensure valid mods.
|
// a lease may be taken on the mods bindable, at which point we can't really ensure valid mods.
|
||||||
if (SelectedMods.Disabled)
|
if (SelectedMods.Disabled)
|
||||||
return;
|
return;
|
||||||
|
@ -546,19 +541,6 @@ private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateModDefaults()
|
|
||||||
{
|
|
||||||
BeatmapDifficulty baseDifficulty = Beatmap.Value.BeatmapInfo.BaseDifficulty;
|
|
||||||
|
|
||||||
if (baseDifficulty != null && SelectedMods.Value.Any(m => m is IApplicableToDifficulty))
|
|
||||||
{
|
|
||||||
var adjustedDifficulty = baseDifficulty.Clone();
|
|
||||||
|
|
||||||
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDifficulty>())
|
|
||||||
mod.ReadFromDifficulty(adjustedDifficulty);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private PerformFromMenuRunner performFromMainMenuTask;
|
private PerformFromMenuRunner performFromMainMenuTask;
|
||||||
|
|
|
@ -10,13 +10,6 @@ namespace osu.Game.Rulesets.Mods
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicableToDifficulty : IApplicableMod
|
public interface IApplicableToDifficulty : IApplicableMod
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Called when a beatmap is changed. Can be used to read default values.
|
|
||||||
/// Any changes made will not be preserved.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="difficulty">The difficulty to read from.</param>
|
|
||||||
void ReadFromDifficulty(BeatmapDifficulty difficulty);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
|
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue