1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Rename multiplayer mod usages to make more sense

This commit is contained in:
Salman Ahmed 2022-03-20 13:12:24 +03:00
parent 820a672940
commit add9f3ec91
6 changed files with 15 additions and 13 deletions

View File

@ -39,8 +39,8 @@ namespace osu.Game.Rulesets.Mods
/// <remarks>
/// <list type="bullet">
/// <item>Should be always <c>false</c> for cases where the user is not interacting with the game.</item>
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerRequired"/> for mods that make gameplay duration dependent on user input (e.g. <see cref="ModAdaptiveSpeed"/>).</item>
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerFree"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item>
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerRoomWide"/> for mods that make gameplay duration dependent on user input (e.g. <see cref="ModAdaptiveSpeed"/>).</item>
/// <item>Should be <c>false</c> in <see cref="ModUsage.MultiplayerPerPlayer"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item>
/// </list>
/// </remarks>
/// <param name="usage">The mod usage.</param>

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Mods
{
public abstract class ModRateAdjust : Mod, IApplicableToRate
{
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree;
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer;
public abstract BindableNumber<double> SpeedChange { get; }

View File

@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Mods
[SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
public abstract BindableBool AdjustPitch { get; }
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerFree;
public override bool IsPlayable(ModUsage usage) => usage != ModUsage.MultiplayerPerPlayer;
public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) };

View File

@ -9,18 +9,20 @@ namespace osu.Game.Rulesets.Mods
public enum ModUsage
{
/// <summary>
/// Used for a per-user gameplay session. Determines whether the mod is playable by an end user.
/// Used for a per-user gameplay session.
/// Determines whether the mod is playable by an end user.
/// </summary>
User,
/// <summary>
/// Used as a "required mod" for a multiplayer match.
/// Used in multiplayer but must be applied to all users.
/// This is generally the case for mods which affect the length of gameplay.
/// </summary>
MultiplayerRequired,
MultiplayerRoomWide,
/// <summary>
/// Used as a "free mod" for a multiplayer match.
/// Used in multiplayer either at a room or per-player level (i.e. "free mod").
/// </summary>
MultiplayerFree,
MultiplayerPerPlayer,
}
}

View File

@ -117,8 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRequired);
protected override bool IsValidMod(Mod mod) => base.IsValidMod(mod) && mod.IsPlayable(ModUsage.MultiplayerRoomWide);
protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerFree);
protected override bool IsValidFreeMod(Mod mod) => base.IsValidFreeMod(mod) && mod.IsPlayable(ModUsage.MultiplayerPerPlayer);
}
}

View File

@ -121,7 +121,7 @@ namespace osu.Game.Utils
/// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param>
/// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns>
public static bool CheckValidRequiredModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods)
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRequired), out invalidMods);
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerRoomWide), out invalidMods);
/// <summary>
/// Check the provided combination of mods are valid as "free mods" in a multiplayer match session.
@ -130,7 +130,7 @@ namespace osu.Game.Utils
/// <param name="invalidMods">Invalid mods, if any were found. Will be null if all mods were valid.</param>
/// <returns>Whether the input mods were all valid. If false, <paramref name="invalidMods"/> will contain all invalid entries.</returns>
public static bool CheckValidFreeModsForMultiplayer(IEnumerable<Mod> mods, [NotNullWhen(false)] out List<Mod>? invalidMods)
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerFree), out invalidMods);
=> checkValid(mods, m => m.IsPlayable(ModUsage.MultiplayerPerPlayer), out invalidMods);
private static bool checkValid(IEnumerable<Mod> mods, Predicate<Mod> valid, [NotNullWhen(false)] out List<Mod>? invalidMods)
{