Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -6,11 +6,12 @@ namespace Content.Shared.Alert;
|
||||
/// Handles the icons on the right side of the screen.
|
||||
/// Should only be used for player-controlled entities.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
||||
public sealed partial class AlertsComponent : Component
|
||||
{
|
||||
[ViewVariables] public Dictionary<AlertKey, AlertState> Alerts = new();
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField]
|
||||
public Dictionary<AlertKey, AlertState> Alerts = new();
|
||||
|
||||
public override bool SendOnlyToOwner => true;
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Alert;
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class AlertsComponentState : ComponentState
|
||||
{
|
||||
public Dictionary<AlertKey, AlertState> Alerts;
|
||||
|
||||
public AlertsComponentState(Dictionary<AlertKey, AlertState> alerts)
|
||||
{
|
||||
Alerts = alerts;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Alert;
|
||||
@@ -170,7 +169,6 @@ public abstract class AlertsSystem : EntitySystem
|
||||
SubscribeLocalEvent<AlertsComponent, ComponentStartup>(HandleComponentStartup);
|
||||
SubscribeLocalEvent<AlertsComponent, ComponentShutdown>(HandleComponentShutdown);
|
||||
|
||||
SubscribeLocalEvent<AlertsComponent, ComponentGetState>(ClientAlertsGetState);
|
||||
SubscribeNetworkEvent<ClickAlertEvent>(HandleClickAlert);
|
||||
|
||||
LoadPrototypes();
|
||||
@@ -243,9 +241,4 @@ public abstract class AlertsSystem : EntitySystem
|
||||
|
||||
alert.OnClick?.AlertClicked(player.Value);
|
||||
}
|
||||
|
||||
private static void ClientAlertsGetState(EntityUid uid, AlertsComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new AlertsComponentState(component.Alerts);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user