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,5 +1,4 @@
using System.Numerics;
using Robust.Shared.GameStates;
using Robust.Shared.Map;
namespace Content.Shared.Gravity;
@@ -18,8 +17,6 @@ public abstract class SharedFloatingVisualizerSystem : EntitySystem
SubscribeLocalEvent<FloatingVisualsComponent, ComponentStartup>(OnComponentStartup);
SubscribeLocalEvent<GravityChangedEvent>(OnGravityChanged);
SubscribeLocalEvent<FloatingVisualsComponent, EntParentChangedMessage>(OnEntParentChanged);
SubscribeLocalEvent<FloatingVisualsComponent, ComponentGetState>(OnComponentGetState);
SubscribeLocalEvent<FloatingVisualsComponent, ComponentHandleState>(OnComponentHandleState);
}
/// <summary>
@@ -71,19 +68,4 @@ public abstract class SharedFloatingVisualizerSystem : EntitySystem
if (CanFloat(uid, component, transform))
FloatAnimation(uid, component.Offset, component.AnimationKey, component.AnimationTime);
}
private void OnComponentGetState(EntityUid uid, FloatingVisualsComponent component, ref ComponentGetState args)
{
args.State = new SharedFloatingVisualsComponentState(component.AnimationTime, component.Offset, component.CanFloat);
}
private void OnComponentHandleState(EntityUid uid, FloatingVisualsComponent component, ref ComponentHandleState args)
{
if (args.Current is not SharedFloatingVisualsComponentState state)
return;
component.AnimationTime = state.AnimationTime;
component.Offset = state.Offset;
component.CanFloat = state.HasGravity;
}
}