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,3 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Gravity;
public abstract partial class SharedGravitySystem
@@ -11,8 +8,6 @@ public abstract partial class SharedGravitySystem
private void InitializeShake()
{
SubscribeLocalEvent<GravityShakeComponent, EntityUnpausedEvent>(OnShakeUnpaused);
SubscribeLocalEvent<GravityShakeComponent, ComponentGetState>(OnShakeGetState);
SubscribeLocalEvent<GravityShakeComponent, ComponentHandleState>(OnShakeHandleState);
}
private void OnShakeUnpaused(EntityUid uid, GravityShakeComponent component, ref EntityUnpausedEvent args)
@@ -63,29 +58,4 @@ public abstract partial class SharedGravitySystem
}
protected virtual void ShakeGrid(EntityUid uid, GravityComponent? comp = null) {}
private void OnShakeHandleState(EntityUid uid, GravityShakeComponent component, ref ComponentHandleState args)
{
if (args.Current is not GravityShakeComponentState state)
return;
component.ShakeTimes = state.ShakeTimes;
component.NextShake = state.NextShake;
}
private void OnShakeGetState(EntityUid uid, GravityShakeComponent component, ref ComponentGetState args)
{
args.State = new GravityShakeComponentState()
{
ShakeTimes = component.ShakeTimes,
NextShake = component.NextShake,
};
}
[Serializable, NetSerializable]
protected sealed class GravityShakeComponentState : ComponentState
{
public int ShakeTimes;
public TimeSpan NextShake;
}
}