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,7 +1,6 @@
using Content.Shared.DeviceLinking;
using Content.Shared.Doors.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Doors.Components;
@@ -9,16 +8,17 @@ namespace Content.Shared.Doors.Components;
/// <summary>
/// Companion component to DoorComponent that handles airlock-specific behavior -- wires, requiring power to operate, bolts, and allowing automatic closing.
/// </summary>
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(SharedAirlockSystem), Friend = AccessPermissions.ReadWriteExecute, Other = AccessPermissions.Read)]
public sealed partial class AirlockComponent : Component
{
// Need to network airlock safety state to avoid mis-predicts when a door auto-closes as the client walks through the door.
[ViewVariables(VVAccess.ReadWrite)]
[DataField("safety")]
[DataField, AutoNetworkedField]
public bool Safety = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("emergencyAccess")]
[DataField]
public bool EmergencyAccess = false;
/// <summary>
@@ -26,20 +26,20 @@ public sealed partial class AirlockComponent : Component
/// Most anything that can pry powered has a pry speed bonus,
/// so this default is closer to 6 effectively on e.g. jaws (9 seconds when applied to other default.)
/// </summary>
[DataField("poweredPryModifier")]
[DataField]
public float PoweredPryModifier = 9f;
/// <summary>
/// Whether the maintenance panel should be visible even if the airlock is opened.
/// </summary>
[DataField("openPanelVisible")]
[DataField]
public bool OpenPanelVisible = false;
/// <summary>
/// Whether the airlock should stay open if the airlock was clicked.
/// If the airlock was bumped into it will still auto close.
/// </summary>
[DataField("keepOpenIfClicked")]
[DataField]
public bool KeepOpenIfClicked = false;
/// <summary>
@@ -51,7 +51,7 @@ public sealed partial class AirlockComponent : Component
/// <summary>
/// Delay until an open door automatically closes.
/// </summary>
[DataField("autoCloseDelay")]
[DataField]
public TimeSpan AutoCloseDelay = TimeSpan.FromSeconds(5f);
/// <summary>
@@ -64,7 +64,7 @@ public sealed partial class AirlockComponent : Component
/// <summary>
/// The receiver port for turning off automatic closing.
/// </summary>
[DataField("autoClosePort", customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
[DataField(customTypeSerializer: typeof(PrototypeIdSerializer<SinkPortPrototype>))]
public string AutoClosePort = "AutoClose";
#region Graphics
@@ -72,79 +72,68 @@ public sealed partial class AirlockComponent : Component
/// <summary>
/// Whether the door lights should be visible.
/// </summary>
[DataField("openUnlitVisible")]
[DataField]
public bool OpenUnlitVisible = false;
/// <summary>
/// Whether the door should display emergency access lights.
/// </summary>
[DataField("emergencyAccessLayer")]
[DataField]
public bool EmergencyAccessLayer = true;
/// <summary>
/// Whether or not to animate the panel when the door opens or closes.
/// </summary>
[DataField("animatePanel")]
[DataField]
public bool AnimatePanel = true;
/// <summary>
/// The sprite state used to animate the airlock frame when the airlock opens.
/// </summary>
[DataField("openingSpriteState")]
[DataField]
public string OpeningSpriteState = "opening_unlit";
/// <summary>
/// The sprite state used to animate the airlock panel when the airlock opens.
/// </summary>
[DataField("openingPanelSpriteState")]
[DataField]
public string OpeningPanelSpriteState = "panel_opening";
/// <summary>
/// The sprite state used to animate the airlock frame when the airlock closes.
/// </summary>
[DataField("closingSpriteState")]
[DataField]
public string ClosingSpriteState = "closing_unlit";
/// <summary>
/// The sprite state used to animate the airlock panel when the airlock closes.
/// </summary>
[DataField("closingPanelSpriteState")]
[DataField]
public string ClosingPanelSpriteState = "panel_closing";
/// <summary>
/// The sprite state used for the open airlock lights.
/// </summary>
[DataField("openSpriteState")]
[DataField]
public string OpenSpriteState = "open_unlit";
/// <summary>
/// The sprite state used for the closed airlock lights.
/// </summary>
[DataField("closedSpriteState")]
[DataField]
public string ClosedSpriteState = "closed_unlit";
/// <summary>
/// The sprite state used for the 'access denied' lights animation.
/// </summary>
[DataField("denySpriteState")]
[DataField]
public string DenySpriteState = "deny_unlit";
/// <summary>
/// How long the animation played when the airlock denies access is in seconds.
/// </summary>
[DataField("denyAnimationTime")]
[DataField]
public float DenyAnimationTime = 0.3f;
#endregion Graphics
}
[Serializable, NetSerializable]
public sealed class AirlockComponentState : ComponentState
{
public readonly bool Safety;
public AirlockComponentState(bool safety)
{
Safety = safety;
}
}