Resolves AirlockVisualizer is Obsolete (#13884)

This commit is contained in:
TemporalOroboros
2023-04-22 02:18:16 -07:00
committed by GitHub
parent 8f8b71f75b
commit 7523ed4c17
16 changed files with 444 additions and 325 deletions

View File

@@ -1,4 +1,6 @@
using System.Runtime.InteropServices;
using Content.Shared.Damage;
using Content.Shared.Doors.Systems;
using Content.Shared.Tools;
using JetBrains.Annotations;
using Robust.Shared.Audio;
@@ -13,16 +15,17 @@ namespace Content.Shared.Doors.Components;
[NetworkedComponent]
[RegisterComponent]
public sealed class DoorComponent : Component, ISerializationHooks
public sealed class DoorComponent : Component
{
/// <summary>
/// The current state of the door -- whether it is open, closed, opening, or closing.
/// </summary>
/// <remarks>
/// This should never be set directly.
/// This should never be set directly, use <see cref="SharedDoorSystem.SetState(EntityUid, DoorState, DoorComponent?)"/> instead.
/// </remarks>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("state")]
[Access(typeof(SharedDoorSystem))]
public DoorState State = DoorState.Closed;
#region Timing
@@ -139,6 +142,97 @@ public sealed class DoorComponent : Component, ISerializationHooks
public HashSet<EntityUid> CurrentlyCrushing = new();
#endregion
#region Graphics
/// <summary>
/// The key used when playing door opening/closing/emagging/deny animations.
/// </summary>
public const string AnimationKey = "door_animation";
/// <summary>
/// The sprite state used for the door when it's open.
/// </summary>
[DataField("openSpriteState")]
[ViewVariables(VVAccess.ReadWrite)]
public string OpenSpriteState = "open";
/// <summary>
/// The sprite states used for the door while it's open.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public List<(DoorVisualLayers, string)> OpenSpriteStates = default!;
/// <summary>
/// The sprite state used for the door when it's closed.
/// </summary>
[DataField("closedSpriteState")]
[ViewVariables(VVAccess.ReadWrite)]
public string ClosedSpriteState = "closed";
/// <summary>
/// The sprite states used for the door while it's closed.
/// </summary>
[ViewVariables(VVAccess.ReadOnly)]
public List<(DoorVisualLayers, string)> ClosedSpriteStates = default!;
/// <summary>
/// The sprite state used for the door when it's opening.
/// </summary>
[DataField("openingSpriteState")]
public string OpeningSpriteState = "opening";
/// <summary>
/// The sprite state used for the door when it's closing.
/// </summary>
[DataField("closingSpriteState")]
public string ClosingSpriteState = "closing";
/// <summary>
/// The sprite state used for the door when it's being emagged.
/// </summary>
[DataField("emaggingSpriteState")]
public string EmaggingSpriteState = "emagging";
/// <summary>
/// The sprite state used for the door when it's open.
/// </summary>
[DataField("openingAnimationTime")]
public float OpeningAnimationTime = 0.8f;
/// <summary>
/// The sprite state used for the door when it's open.
/// </summary>
[DataField("closingAnimationTime")]
public float ClosingAnimationTime = 0.8f;
/// <summary>
/// The sprite state used for the door when it's open.
/// </summary>
[DataField("emaggingAnimationTime")]
public float EmaggingAnimationTime = 1.5f;
/// <summary>
/// The animation used when the door opens.
/// </summary>
public object OpeningAnimation = default!;
/// <summary>
/// The animation used when the door closes.
/// </summary>
public object ClosingAnimation = default!;
/// <summary>
/// The animation used when the door denies access.
/// </summary>
public object DenyingAnimation = default!;
/// <summary>
/// The animation used when the door is emagged.
/// </summary>
public object EmaggingAnimation = default!;
#endregion Graphics
#region Serialization
/// <summary>
/// Time until next state change. Because apparently <see cref="IGameTiming.CurTime"/> might not get saved/restored.
@@ -209,7 +303,7 @@ public sealed class DoorComponent : Component, ISerializationHooks
}
[Serializable, NetSerializable]
public enum DoorState
public enum DoorState : byte
{
Closed,
Closing,
@@ -221,7 +315,7 @@ public enum DoorState
}
[Serializable, NetSerializable]
public enum DoorVisuals
public enum DoorVisuals : byte
{
State,
Powered,
@@ -231,6 +325,14 @@ public enum DoorVisuals
BaseRSI,
}
public enum DoorVisualLayers : byte
{
Base,
BaseUnlit,
BaseBolted,
BaseEmergencyAccess,
}
[Serializable, NetSerializable]
public sealed class DoorComponentState : ComponentState
{