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,6 +1,4 @@
using Content.Shared.Shuttles.Components;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Shuttles.Systems;
@@ -9,29 +7,6 @@ public abstract class SharedRadarConsoleSystem : EntitySystem
public const float DefaultMinRange = 64f;
public const float DefaultMaxRange = 256f;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RadarConsoleComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<RadarConsoleComponent, ComponentHandleState>(OnHandleState);
}
private void OnHandleState(EntityUid uid, RadarConsoleComponent component, ref ComponentHandleState args)
{
if (args.Current is not RadarConsoleComponentState state)
return;
component.MaxRange = state.Range;
}
private void OnGetState(EntityUid uid, RadarConsoleComponent component, ref ComponentGetState args)
{
args.State = new RadarConsoleComponentState()
{
Range = component.MaxRange
};
}
protected virtual void UpdateState(EntityUid uid, RadarConsoleComponent component)
{
}
@@ -45,10 +20,4 @@ public abstract class SharedRadarConsoleSystem : EntitySystem
Dirty(uid, component);
UpdateState(uid, component);
}
[Serializable, NetSerializable]
protected sealed class RadarConsoleComponentState : ComponentState
{
public float Range;
}
}