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,66 +1,49 @@
using Content.Shared.DeviceLinking;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Conveyor;
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ConveyorComponent : Component
{
/// <summary>
/// The angle to move entities by in relation to the owner's rotation.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("angle")]
[DataField, AutoNetworkedField]
public Angle Angle = Angle.Zero;
/// <summary>
/// The amount of units to move the entity by per second.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("speed")]
[DataField, AutoNetworkedField]
public float Speed = 2f;
/// <summary>
/// The current state of this conveyor
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[ViewVariables(VVAccess.ReadWrite), AutoNetworkedField]
public ConveyorState State;
[ViewVariables]
[ViewVariables, AutoNetworkedField]
public bool Powered;
[DataField("forwardPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string ForwardPort = "Forward";
[DataField]
public ProtoId<SinkPortPrototype> ForwardPort = "Forward";
[DataField("reversePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string ReversePort = "Reverse";
[DataField]
public ProtoId<SinkPortPrototype> ReversePort = "Reverse";
[DataField("offPort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string OffPort = "Off";
[DataField]
public ProtoId<SinkPortPrototype> OffPort = "Off";
[ViewVariables]
public readonly HashSet<EntityUid> Intersecting = new();
}
[Serializable, NetSerializable]
public sealed class ConveyorComponentState : ComponentState
{
public bool Powered;
public Angle Angle;
public float Speed;
public ConveyorState State;
public ConveyorComponentState(Angle angle, float speed, ConveyorState state, bool powered)
{
Angle = angle;
Speed = speed;
State = state;
Powered = powered;
}
}
[Serializable, NetSerializable]
public enum ConveyorVisuals : byte
{