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:
Dean Herbert 2021-07-14 12:32:14 +09:00
parent 48d5a3f94f
commit ed29646291
2 changed files with 0 additions and 25 deletions

View File

@ -525,16 +525,11 @@ public override Task Import(params ImportTask[] imports)
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
{
beatmap.OldValue?.CancelAsyncLoad();
updateModDefaults();
beatmap.NewValue?.BeginAsyncLoad();
}
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.
if (SelectedMods.Disabled)
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
private PerformFromMenuRunner performFromMainMenuTask;

View File

@ -10,13 +10,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
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>
/// Called post beatmap conversion. Can be used to apply changes to difficulty attributes.
/// </summary>