From 86e633be6e38e104dcc7d41ec0ec3f4b3a57d890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=81da?= Date: Tue, 22 Sep 2026 08:55:54 +0000 Subject: [PATCH] Disposal Units tag their contents + UI comp state (#45613) * commit * also flipped * oops * fuck it added to the UI * fix micro annoyance * Unify components also doesn't work yet * reuse the existing UI also clean up the UI also applying state headache * cheat code * flippy * More interface changes * yaml ;p * private tagger * betterer tagger * private unit window * limit tagger window * access blocked * typo * validate --------- Co-authored-by: iaada --- .../DisposalTaggerBoundUserInterface.cs | 32 ++---- .../Disposal/Tagger/DisposalTaggerWindow.xaml | 5 +- .../Tagger/DisposalTaggerWindow.xaml.cs | 22 +++- .../Unit/DisposalUnitBoundUserInterface.cs | 104 +++++++++--------- .../Disposal/Unit/DisposalUnitWindow.xaml | 24 ++-- .../Disposal/Unit/DisposalUnitWindow.xaml.cs | 68 +++++++++++- .../Tagger/DisposalTaggerComponent.cs | 21 ++-- .../Disposal/Tagger/DisposalTaggerSystem.cs | 23 +++- .../Disposal/Unit/DisposalUnitComponent.cs | 6 - .../SharedDisposalUnitSystem.VisualsAndUi.cs | 5 +- .../components/disposal-tagger-window.ftl | 1 - .../components/disposal-unit-component.ftl | 2 + Resources/Locale/en-US/generic.ftl | 3 + .../Structures/Piping/Disposal/pipes.yml | 24 ++++ .../Structures/Piping/Disposal/units.yml | 6 + 15 files changed, 226 insertions(+), 120 deletions(-) diff --git a/Content.Client/Disposal/Tagger/DisposalTaggerBoundUserInterface.cs b/Content.Client/Disposal/Tagger/DisposalTaggerBoundUserInterface.cs index d5f7408df5..3a67718224 100644 --- a/Content.Client/Disposal/Tagger/DisposalTaggerBoundUserInterface.cs +++ b/Content.Client/Disposal/Tagger/DisposalTaggerBoundUserInterface.cs @@ -8,48 +8,36 @@ namespace Content.Client.Disposal.Tagger /// Initializes a and updates it when new server messages are received. /// [UsedImplicitly] - public sealed class DisposalTaggerBoundUserInterface : BoundUserInterface + public sealed class DisposalTaggerBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey) { private DisposalTaggerWindow? _window; - private const int TagLimit = 30; - - public DisposalTaggerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - } + public const int TagLimit = 30; protected override void Open() { base.Open(); _window = this.CreateWindow(); + _window.OnRouteChanged += NewRoute; - _window.Confirm.OnPressed += _ => AcceptButtonPressed(_window.TagInput.Text); - _window.TagInput.OnTextEntered += args => AcceptButtonPressed(args.Text); - - if (EntMan.TryGetComponent(Owner, out var tagger) && - tagger.Tag != string.Empty) - { - _window.TagInput.Text = tagger.Tag; - } + Update(); } - private void AcceptButtonPressed(string tag) + private void NewRoute(string route) { - SendMessage(new DisposalTaggerUiActionMessage(tag, TagLimit)); + SendMessage(new DisposalTaggerUiActionMessage(route, TagLimit)); Close(); } - protected override void UpdateState(BoundUserInterfaceState state) + public override void Update() { - base.UpdateState(state); + base.Update(); - if (state is not DisposalTaggerUserInterfaceState cast) - { + if (_window == null || !EntMan.TryGetComponent(Owner, out var tagger)) return; - } - _window?.UpdateState(cast); + _window.Populate(tagger.Tag, tagger.Editable); } } } diff --git a/Content.Client/Disposal/Tagger/DisposalTaggerWindow.xaml b/Content.Client/Disposal/Tagger/DisposalTaggerWindow.xaml index 68cb049184..5c524bf9c2 100644 --- a/Content.Client/Disposal/Tagger/DisposalTaggerWindow.xaml +++ b/Content.Client/Disposal/Tagger/DisposalTaggerWindow.xaml @@ -7,13 +7,10 @@ -