1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-28 03:15:08 +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> /// <remarks>
/// <list type="bullet"> /// <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 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.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.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.MultiplayerPerPlayer"/> for mods that affect the gameplay duration (e.g. <see cref="ModRateAdjust"/> and <see cref="ModTimeRamp"/>).</item>
/// </list> /// </list>
/// </remarks> /// </remarks>
/// <param name="usage">The mod usage.</param> /// <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 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; } 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")] [SettingSource("Adjust pitch", "Should pitch be adjusted with speed")]
public abstract BindableBool AdjustPitch { get; } 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) }; public override Type[] IncompatibleMods => new[] { typeof(ModRateAdjust), typeof(ModAdaptiveSpeed) };

View File

@ -9,18 +9,20 @@ namespace osu.Game.Rulesets.Mods
public enum ModUsage public enum ModUsage
{ {
/// <summary> /// <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> /// </summary>
User, User,
/// <summary> /// <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> /// </summary>
MultiplayerRequired, MultiplayerRoomWide,
/// <summary> /// <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> /// </summary>
MultiplayerFree, MultiplayerPerPlayer,
} }
} }

View File

@ -117,8 +117,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea(); 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> /// <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> /// <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) 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> /// <summary>
/// Check the provided combination of mods are valid as "free mods" in a multiplayer match session. /// 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> /// <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> /// <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) 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) private static bool checkValid(IEnumerable<Mod> mods, Predicate<Mod> valid, [NotNullWhen(false)] out List<Mod>? invalidMods)
{ {