Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Movement.Components
|
||||
namespace Content.Shared.Movement.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Changes footstep sound
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class FootstepModifierComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes footstep sound
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed partial class FootstepModifierComponent : Component
|
||||
{
|
||||
[DataField("footstepSoundCollection", required: true)]
|
||||
public SoundSpecifier Sound = default!;
|
||||
}
|
||||
[DataField(required: true), AutoNetworkedField]
|
||||
public SoundSpecifier FootstepSoundCollection = default!;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@ namespace Content.Shared.Movement.Components;
|
||||
/// <summary>
|
||||
/// Added to someone using a jetpack for movement purposes
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class JetpackUserComponent : Component
|
||||
{
|
||||
[AutoNetworkedField]
|
||||
public EntityUid Jetpack;
|
||||
}
|
||||
|
||||
@@ -6,14 +6,13 @@ namespace Content.Shared.Movement.Components
|
||||
/// <summary>
|
||||
/// Has additional movement data such as footsteps and weightless grab range for an entity.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent()]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
public sealed partial class MobMoverComponent : Component
|
||||
{
|
||||
private float _stepSoundDistance;
|
||||
[DataField("grabRange")] public float GrabRange = 1.0f;
|
||||
[DataField] public float GrabRange = 1.0f;
|
||||
|
||||
[DataField("pushStrength")] public float PushStrength = 600f;
|
||||
[DataField] public float PushStrength = 600f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public EntityCoordinates LastPosition { get; set; }
|
||||
@@ -32,7 +31,7 @@ namespace Content.Shared.Movement.Components
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
||||
public float GrabRangeVV
|
||||
{
|
||||
get => GrabRange;
|
||||
@@ -44,7 +43,7 @@ namespace Content.Shared.Movement.Components
|
||||
}
|
||||
}
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
|
||||
public float PushStrengthVV
|
||||
{
|
||||
get => PushStrength;
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Content.Shared.Movement.Components
|
||||
/// Applies basic movement speed and movement modifiers for an entity.
|
||||
/// If this is not present on the entity then they will use defaults for movement.
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
[NetworkedComponent, Access(typeof(MovementSpeedModifierSystem))]
|
||||
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||
[Access(typeof(MovementSpeedModifierSystem))]
|
||||
public sealed partial class MovementSpeedModifierComponent : Component
|
||||
{
|
||||
// Weightless
|
||||
@@ -25,10 +25,10 @@ namespace Content.Shared.Movement.Components
|
||||
public const float DefaultBaseWalkSpeed = 2.5f;
|
||||
public const float DefaultBaseSprintSpeed = 4.5f;
|
||||
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public float WalkSpeedModifier = 1.0f;
|
||||
|
||||
[ViewVariables]
|
||||
[AutoNetworkedField, ViewVariables]
|
||||
public float SprintSpeedModifier = 1.0f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -56,55 +56,56 @@ namespace Content.Shared.Movement.Components
|
||||
/// <summary>
|
||||
/// Minimum speed a mob has to be moving before applying movement friction.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("minimumFrictionSpeed")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float MinimumFrictionSpeed = DefaultMinimumFrictionSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// The negative velocity applied for friction when weightless and providing inputs.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("weightlessFriction")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float WeightlessFriction = DefaultWeightlessFriction;
|
||||
|
||||
/// <summary>
|
||||
/// The negative velocity applied for friction when weightless and not providing inputs.
|
||||
/// This is essentially how much their speed decreases per second.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("weightlessFrictionNoInput")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float WeightlessFrictionNoInput = DefaultWeightlessFrictionNoInput;
|
||||
|
||||
/// <summary>
|
||||
/// The movement speed modifier applied to a mob's total input velocity when weightless.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("weightlessModifier")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float WeightlessModifier = DefaultWeightlessModifier;
|
||||
|
||||
/// <summary>
|
||||
/// The acceleration applied to mobs when moving and weightless.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("weightlessAcceleration")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float WeightlessAcceleration = DefaultWeightlessAcceleration;
|
||||
|
||||
/// <summary>
|
||||
/// The acceleration applied to mobs when moving.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("acceleration")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float Acceleration = DefaultAcceleration;
|
||||
|
||||
/// <summary>
|
||||
/// The negative velocity applied for friction.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("friction")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float Friction = DefaultFriction;
|
||||
|
||||
/// <summary>
|
||||
/// The negative velocity applied for friction.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("frictionNoInput")] public float? FrictionNoInput = null;
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField]
|
||||
public float? FrictionNoInput;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("baseWalkSpeed")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
public float BaseWalkSpeed { get; set; } = DefaultBaseWalkSpeed;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("baseSprintSpeed")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField, AutoNetworkedField]
|
||||
public float BaseSprintSpeed { get; set; } = DefaultBaseSprintSpeed;
|
||||
|
||||
[ViewVariables]
|
||||
|
||||
Reference in New Issue
Block a user