From: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:19:32 +0000 (-0700) Subject: Set default PDA uplink and music visibility to false (#28373) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=71d92c9f8a2c5c58bbc8611304b51741cafe6c75;p=space-station-14.git Set default PDA uplink and music visibility to false (#28373) * Set PDA uplink and music default visibility to false #27376 seems to be the PDA receiving state before first PDA UI open * Log error on PDA state received before first open * Fix logging * Fix error message --------- Co-authored-by: metalgearsloth --- diff --git a/Content.Client/PDA/PdaBoundUserInterface.cs b/Content.Client/PDA/PdaBoundUserInterface.cs index 37ce9c4280..2d4033390c 100644 --- a/Content.Client/PDA/PdaBoundUserInterface.cs +++ b/Content.Client/PDA/PdaBoundUserInterface.cs @@ -4,18 +4,20 @@ using Content.Shared.Containers.ItemSlots; using Content.Shared.PDA; using JetBrains.Annotations; using Robust.Client.UserInterface; -using Robust.Shared.Configuration; namespace Content.Client.PDA { [UsedImplicitly] public sealed class PdaBoundUserInterface : CartridgeLoaderBoundUserInterface { + private readonly PdaSystem _pdaSystem; + [ViewVariables] private PdaMenu? _menu; public PdaBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { + _pdaSystem = EntMan.System(); } protected override void Open() @@ -92,7 +94,13 @@ namespace Content.Client.PDA if (state is not PdaUpdateState updateState) return; - _menu?.UpdateState(updateState); + if (_menu == null) + { + _pdaSystem.Log.Error("PDA state received before menu was created."); + return; + } + + _menu.UpdateState(updateState); } protected override void AttachCartridgeUI(Control cartridgeUIFragment, string? title) diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml index 8b26860332..8c9b4ae2ee 100644 --- a/Content.Client/PDA/PdaMenu.xaml +++ b/Content.Client/PDA/PdaMenu.xaml @@ -67,14 +67,17 @@ Description="{Loc 'comp-pda-ui-ringtone-button-description'}"/>