Update trivial components to use auto comp states (#20539)

This commit is contained in:
DrSmugleaf
2023-09-28 16:20:29 -07:00
committed by GitHub
parent 14cfe44ece
commit a44fa86b68
158 changed files with 806 additions and 2866 deletions

View File

@@ -1,7 +1,6 @@
using Content.Shared.FixedPoint;
using Robust.Shared.GameStates;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared.Points;
@@ -9,32 +8,19 @@ namespace Content.Shared.Points;
/// <summary>
/// This is a component that generically stores points for all players.
/// </summary>
[RegisterComponent, NetworkedComponent, Access(typeof(SharedPointSystem))]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
[Access(typeof(SharedPointSystem))]
public sealed partial class PointManagerComponent : Component
{
/// <summary>
/// A dictionary of a player's netuserID to the amount of points they have.
/// </summary>
[DataField("points")]
[DataField, AutoNetworkedField(true)]
public Dictionary<NetUserId, FixedPoint2> Points = new();
/// <summary>
/// A text-only version of the scoreboard used by the client.
/// </summary>
[DataField("scoreboard")]
[DataField, AutoNetworkedField]
public FormattedMessage Scoreboard = new();
}
[Serializable, NetSerializable]
public sealed class PointManagerComponentState : ComponentState
{
public Dictionary<NetUserId, FixedPoint2> Points;
public FormattedMessage Scoreboard;
public PointManagerComponentState(Dictionary<NetUserId, FixedPoint2> points, FormattedMessage scoreboard)
{
Points = points;
Scoreboard = scoreboard;
}
}