Skip to content

Commit

Permalink
Merge pull request ppy#30137 from bdach/send-mods-in-frame-headers
Browse files Browse the repository at this point in the history
Send mods in spectator frame headers
  • Loading branch information
peppy authored Oct 22, 2024
2 parents 84e08d9 + ec5f5a2 commit 3158338
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions osu.Game/Online/Spectator/FrameHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

using System;
using System.Collections.Generic;
using System.Linq;
using MessagePack;
using Newtonsoft.Json;
using osu.Game.Online.API;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;

Expand Down Expand Up @@ -56,6 +58,17 @@ public class FrameHeader
[Key(6)]
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>
/// Construct header summary information from a point-in-time reference to a score which is actively being played.
/// </summary>
Expand All @@ -69,6 +82,7 @@ public FrameHeader(ScoreInfo score, ScoreProcessorStatistics statistics)
MaxCombo = score.MaxCombo;
// copy for safety
Statistics = new Dictionary<HitResult, int>(score.Statistics);
Mods = score.APIMods.ToArray();

ScoreProcessorStatistics = statistics;
}
Expand Down

0 comments on commit 3158338

Please sign in to comment.