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

@@ -6,8 +6,7 @@ using Robust.Shared.Timing;
namespace Content.Shared.Movement.Components
{
[RegisterComponent]
[NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
public sealed partial class InputMoverComponent : Component
{
// This class has to be able to handle server TPS being lower than client FPS.
@@ -41,36 +40,40 @@ namespace Content.Shared.Movement.Components
public Vector2 CurTickWalkMovement;
public Vector2 CurTickSprintMovement;
[AutoNetworkedField]
public MoveButtons HeldMoveButtons = MoveButtons.None;
/// <summary>
/// Entity our movement is relative to.
/// </summary>
[AutoNetworkedField]
public EntityUid? RelativeEntity;
/// <summary>
/// Although our movement might be relative to a particular entity we may have an additional relative rotation
/// e.g. if we've snapped to a different cardinal direction
/// </summary>
[ViewVariables]
[ViewVariables, AutoNetworkedField]
public Angle TargetRelativeRotation = Angle.Zero;
/// <summary>
/// The current relative rotation. This will lerp towards the <see cref="TargetRelativeRotation"/>.
/// </summary>
[ViewVariables] public Angle RelativeRotation;
[ViewVariables, AutoNetworkedField]
public Angle RelativeRotation;
/// <summary>
/// If we traverse on / off a grid then set a timer to update our relative inputs.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("lerpTarget", customTypeSerializer: typeof(TimeOffsetSerializer))]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
[ViewVariables(VVAccess.ReadWrite)]
public TimeSpan LerpTarget;
public const float LerpTime = 1.0f;
public bool Sprinting => (HeldMoveButtons & MoveButtons.Walk) == 0x0;
[ViewVariables(VVAccess.ReadWrite)]
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public bool CanMove { get; set; } = true;
}
}