From: Errant <35878406+Errant-4@users.noreply.github.com>
Date: Mon, 9 Dec 2024 03:41:11 +0000 (+0100)
Subject: Signal timer duration limit (#33781)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=d57e7316356890715b5a1c0ac749a6b211b9e951;p=space-station-14.git
Signal timer duration limit (#33781)
* max duration
* comment
---
diff --git a/Content.Server/DeviceLinking/Components/SignalTimerComponent.cs b/Content.Server/DeviceLinking/Components/SignalTimerComponent.cs
index b3535cde1f..3feb69c879 100644
--- a/Content.Server/DeviceLinking/Components/SignalTimerComponent.cs
+++ b/Content.Server/DeviceLinking/Components/SignalTimerComponent.cs
@@ -1,53 +1,58 @@
using Content.Shared.DeviceLinking;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.DeviceLinking.Components;
[RegisterComponent]
public sealed partial class SignalTimerComponent : Component
{
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public double Delay = 5;
///
/// This shows the Label: text box in the UI.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public bool CanEditLabel = true;
///
/// The label, used for TextScreen visuals currently.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public string Label = string.Empty;
///
/// Default max width of a label (how many letters can this render?)
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public int MaxLength = 5;
///
/// The port that gets signaled when the timer triggers.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public ProtoId TriggerPort = "Timer";
///
/// The port that gets signaled when the timer starts.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public ProtoId StartPort = "Start";
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public ProtoId Trigger = "Trigger";
///
/// If not null, this timer will play this sound when done.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public SoundSpecifier? DoneSound;
-}
+ ///
+ /// The maximum duration in seconds
+ /// When a larger number is in the input box, the display will start counting down from this one instead
+ ///
+ [DataField]
+ public Double MaxDuration = 3599; // 59m 59s
+}
diff --git a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs
index 14e0c75d96..b4ae1eb57a 100644
--- a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs
+++ b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs
@@ -152,7 +152,7 @@ public sealed class SignalTimerSystem : EntitySystem
if (!IsMessageValid(uid, args))
return;
- component.Delay = args.Delay.TotalSeconds;
+ component.Delay = Math.Min(args.Delay.TotalSeconds, component.MaxDuration);
_appearanceSystem.SetData(uid, TextScreenVisuals.TargetTime, component.Delay);
}