@@ -1,53 +1,58 @@
|
|||||||
using Content.Shared.DeviceLinking;
|
using Content.Shared.DeviceLinking;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
||||||
|
|
||||||
namespace Content.Server.DeviceLinking.Components;
|
namespace Content.Server.DeviceLinking.Components;
|
||||||
|
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class SignalTimerComponent : Component
|
public sealed partial class SignalTimerComponent : Component
|
||||||
{
|
{
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public double Delay = 5;
|
public double Delay = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This shows the Label: text box in the UI.
|
/// This shows the Label: text box in the UI.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public bool CanEditLabel = true;
|
public bool CanEditLabel = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The label, used for TextScreen visuals currently.
|
/// The label, used for TextScreen visuals currently.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public string Label = string.Empty;
|
public string Label = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default max width of a label (how many letters can this render?)
|
/// Default max width of a label (how many letters can this render?)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public int MaxLength = 5;
|
public int MaxLength = 5;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The port that gets signaled when the timer triggers.
|
/// The port that gets signaled when the timer triggers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public ProtoId<SourcePortPrototype> TriggerPort = "Timer";
|
public ProtoId<SourcePortPrototype> TriggerPort = "Timer";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The port that gets signaled when the timer starts.
|
/// The port that gets signaled when the timer starts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public ProtoId<SourcePortPrototype> StartPort = "Start";
|
public ProtoId<SourcePortPrototype> StartPort = "Start";
|
||||||
|
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public ProtoId<SinkPortPrototype> Trigger = "Trigger";
|
public ProtoId<SinkPortPrototype> Trigger = "Trigger";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If not null, this timer will play this sound when done.
|
/// If not null, this timer will play this sound when done.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
[DataField]
|
||||||
public SoundSpecifier? DoneSound;
|
public SoundSpecifier? DoneSound;
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum duration in seconds
|
||||||
|
/// When a larger number is in the input box, the display will start counting down from this one instead
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public Double MaxDuration = 3599; // 59m 59s
|
||||||
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public sealed class SignalTimerSystem : EntitySystem
|
|||||||
if (!IsMessageValid(uid, args))
|
if (!IsMessageValid(uid, args))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
component.Delay = args.Delay.TotalSeconds;
|
component.Delay = Math.Min(args.Delay.TotalSeconds, component.MaxDuration);
|
||||||
_appearanceSystem.SetData(uid, TextScreenVisuals.TargetTime, component.Delay);
|
_appearanceSystem.SetData(uid, TextScreenVisuals.TargetTime, component.Delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user