Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user