diff --git a/Content.Client/TextScreen/TextScreenSystem.cs b/Content.Client/TextScreen/TextScreenSystem.cs index b4d67f5f21..53a620bd46 100644 --- a/Content.Client/TextScreen/TextScreenSystem.cs +++ b/Content.Client/TextScreen/TextScreenSystem.cs @@ -112,17 +112,11 @@ public sealed class TextScreenSystem : VisualizerSystem + /// Default max width of a label (how many letters can this render?) + /// + [DataField, ViewVariables(VVAccess.ReadWrite)] + public int MaxLength = 5; + /// /// The port that gets signaled when the timer triggers. /// diff --git a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs index f9c2d3430e..0e214ee865 100644 --- a/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs +++ b/Content.Server/DeviceLinking/Systems/SignalTimerSystem.cs @@ -39,6 +39,7 @@ public sealed class SignalTimerSystem : EntitySystem private void OnInit(EntityUid uid, SignalTimerComponent component, ComponentInit args) { + _appearanceSystem.SetData(uid, TextScreenVisuals.DefaultText, component.Label); _appearanceSystem.SetData(uid, TextScreenVisuals.ScreenText, component.Label); _signalSystem.EnsureSinkPorts(uid, component.Trigger); } @@ -66,11 +67,6 @@ public sealed class SignalTimerSystem : EntitySystem { RemComp(uid); - if (TryComp(uid, out var appearance)) - { - _appearanceSystem.SetData(uid, TextScreenVisuals.ScreenText, signalTimer.Label, appearance); - } - _audio.PlayPvs(signalTimer.DoneSound, uid); _signalSystem.InvokePort(uid, signalTimer.TriggerPort); @@ -139,10 +135,15 @@ public sealed class SignalTimerSystem : EntitySystem if (!IsMessageValid(uid, args)) return; - component.Label = args.Text[..Math.Min(5, args.Text.Length)]; + component.Label = args.Text[..Math.Min(component.MaxLength, args.Text.Length)]; if (!HasComp(uid)) + { + // could maybe move the defaulttext update out of this block, + // if you delved deep into appearance update batching + _appearanceSystem.SetData(uid, TextScreenVisuals.DefaultText, component.Label); _appearanceSystem.SetData(uid, TextScreenVisuals.ScreenText, component.Label); + } } /// @@ -166,7 +167,15 @@ public sealed class SignalTimerSystem : EntitySystem { if (!IsMessageValid(uid, args)) return; - OnStartTimer(uid, component); + + // feedback received: pressing the timer button while a timer is running should cancel the timer. + if (HasComp(uid)) + { + _appearanceSystem.SetData(uid, TextScreenVisuals.TargetTime, _gameTiming.CurTime); + Trigger(uid, component); + } + else + OnStartTimer(uid, component); } private void OnSignalReceived(EntityUid uid, SignalTimerComponent component, ref SignalReceivedEvent args) diff --git a/Content.Server/Screens/Systems/ScreenSystem.cs b/Content.Server/Screens/Systems/ScreenSystem.cs index 19790f64d5..782fe38c88 100644 --- a/Content.Server/Screens/Systems/ScreenSystem.cs +++ b/Content.Server/Screens/Systems/ScreenSystem.cs @@ -56,6 +56,7 @@ public sealed class ScreenSystem : EntitySystem ) { _appearanceSystem.SetData(uid, TextScreenVisuals.DefaultText, text); + _appearanceSystem.SetData(uid, TextScreenVisuals.ScreenText, text); } }