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,5 @@
using Content.Shared.Shuttles.Components;
using JetBrains.Annotations;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Shuttles.Systems;
@@ -11,12 +9,6 @@ public abstract partial class SharedShuttleSystem
* Handles the label visibility on radar controls. This can be hiding the label or applying other effects.
*/
private void InitializeIFF()
{
SubscribeLocalEvent<IFFComponent, ComponentGetState>(OnIFFGetState);
SubscribeLocalEvent<IFFComponent, ComponentHandleState>(OnIFFHandleState);
}
protected virtual void UpdateIFFInterfaces(EntityUid gridUid, IFFComponent component) {}
/// <summary>
@@ -61,29 +53,4 @@ public abstract partial class SharedShuttleSystem
Dirty(component);
UpdateIFFInterfaces(gridUid, component);
}
private void OnIFFHandleState(EntityUid uid, IFFComponent component, ref ComponentHandleState args)
{
if (args.Current is not IFFComponentState state)
return;
component.Flags = state.Flags;
component.Color = state.Color;
}
private void OnIFFGetState(EntityUid uid, IFFComponent component, ref ComponentGetState args)
{
args.State = new IFFComponentState()
{
Flags = component.Flags,
Color = component.Color,
};
}
[Serializable, NetSerializable]
private sealed class IFFComponentState : ComponentState
{
public IFFFlags Flags;
public Color Color;
}
}