gateway changes (#20304)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-09-18 02:09:21 +01:00
committed by GitHub
parent 84495c3d52
commit fc6638d7e0
6 changed files with 121 additions and 40 deletions

View File

@@ -11,10 +11,25 @@ namespace Content.Server.Gateway.Components;
public sealed partial class GatewayComponent : Component
{
/// <summary>
/// Sound to play when opening or closing the portal.
/// Sound to play when opening the portal.
/// </summary>
/// <remarks>
/// Originally named PortalSound as it was used for opening and closing.
/// </remarks>
[DataField("portalSound")]
public SoundSpecifier PortalSound = new SoundPathSpecifier("/Audio/Effects/Lightning/lightningbolt.ogg");
public SoundSpecifier OpenSound = new SoundPathSpecifier("/Audio/Effects/Lightning/lightningbolt.ogg");
/// <summary>
/// Sound to play when closing the portal.
/// </summary>
[DataField]
public SoundSpecifier CloseSound = new SoundPathSpecifier("/Audio/Effects/Lightning/lightningbolt.ogg");
/// <summary>
/// Sound to play when trying to open or close the portal and missing access.
/// </summary>
[DataField]
public SoundSpecifier AccessDeniedSound = new SoundPathSpecifier("/Audio/Machines/custom_deny.ogg");
/// <summary>
/// Every other gateway destination on the server.
@@ -22,19 +37,19 @@ public sealed partial class GatewayComponent : Component
/// <remarks>
/// Added on startup and when a new destination portal is created.
/// </remarks>
[ViewVariables]
[DataField]
public HashSet<EntityUid> Destinations = new();
/// <summary>
/// The time at which the portal will be closed.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextClose", customTypeSerializer:typeof(TimeOffsetSerializer))]
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextClose;
/// <summary>
/// The time at which the portal was last opened.
/// Only used for UI.
/// </summary>
[ViewVariables]
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan LastOpen;
}

View File

@@ -13,30 +13,36 @@ public sealed partial class GatewayDestinationComponent : Component
/// Whether this destination is shown in the gateway ui.
/// If you are making a gateway for an admeme set this once you are ready for players to select it.
/// </summary>
[DataField("enabled"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Enabled;
/// <summary>
/// Name as it shows up on the ui of station gateways.
/// </summary>
[DataField("name"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public string Name = string.Empty;
/// <summary>
/// Time at which this destination is ready to be linked to.
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("nextReady", customTypeSerializer:typeof(TimeOffsetSerializer))]
[ViewVariables(VVAccess.ReadWrite), DataField(customTypeSerializer:typeof(TimeOffsetSerializer))]
public TimeSpan NextReady;
/// <summary>
/// How long the portal will be open for after linking.
/// </summary>
[DataField("openTime"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan OpenTime = TimeSpan.FromSeconds(600);
/// <summary>
/// How long the destination is not ready for after the portal closes.
/// </summary>
[DataField("cooldown"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public TimeSpan Cooldown = TimeSpan.FromSeconds(60);
/// <summary>
/// If true, the portal can be closed by alt clicking it.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Closeable;
}