Send mods in spectator frame headers

This commit is contained in:
Bartłomiej Dach 2024-10-07 12:38:29 +02:00
parent 6596d30fb9
commit ec5f5a2336
No known key found for this signature in database

View File

@ -3,8 +3,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using MessagePack; using MessagePack;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Game.Online.API;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
@ -56,6 +58,17 @@ namespace osu.Game.Online.Spectator
[Key(6)] [Key(6)]
public DateTimeOffset ReceivedTime { get; set; } public DateTimeOffset ReceivedTime { get; set; }
/// <summary>
/// The set of mods currently active.
/// </summary>
/// <remarks>
/// Nullable for backwards compatibility with older clients
/// (these structures are also used server-side, and <see langword="null"/> will be used as marker that the data isn't there).
/// can be made non-nullable 20250407
/// </remarks>
[Key(7)]
public APIMod[]? Mods { get; set; }
/// <summary> /// <summary>
/// Construct header summary information from a point-in-time reference to a score which is actively being played. /// Construct header summary information from a point-in-time reference to a score which is actively being played.
/// </summary> /// </summary>
@ -69,6 +82,7 @@ namespace osu.Game.Online.Spectator
MaxCombo = score.MaxCombo; MaxCombo = score.MaxCombo;
// copy for safety // copy for safety
Statistics = new Dictionary<HitResult, int>(score.Statistics); Statistics = new Dictionary<HitResult, int>(score.Statistics);
Mods = score.APIMods.ToArray();
ScoreProcessorStatistics = statistics; ScoreProcessorStatistics = statistics;
} }