]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Set default PDA uplink and music visibility to false (#28373)
authorShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Fri, 13 Sep 2024 14:19:32 +0000 (07:19 -0700)
committerGitHub <noreply@github.com>
Fri, 13 Sep 2024 14:19:32 +0000 (00:19 +1000)
* 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 <comedian_vs_clown@hotmail.com>
Content.Client/PDA/PdaBoundUserInterface.cs
Content.Client/PDA/PdaMenu.xaml

index 37ce9c4280f2a06017d0f1ed0b6fb8711d4db234..2d4033390c3aaae7f95f67fec872673c118e7e3f 100644 (file)
@@ -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<PdaSystem>();
         }
 
         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)
index 8b26860332dd8eaa3cc2c47127640dcd4a3b8456..8c9b4ae2ee6b4d36634c18b6fdf40e0bfc64c6eb 100644 (file)
                                        Description="{Loc 'comp-pda-ui-ringtone-button-description'}"/>
                 <pda:PdaSettingsButton Name="ActivateMusicButton"
                                        Access="Public"
+                                       Visible="False"
                                        Text="{Loc 'pda-bound-user-interface-music-button'}"
                                        Description="{Loc 'pda-bound-user-interface-music-button-description'}"/>
                 <pda:PdaSettingsButton Name="ShowUplinkButton"
                                        Access="Public"
+                                       Visible="False"
                                        Text="{Loc 'pda-bound-user-interface-show-uplink-title'}"
                                        Description="{Loc 'pda-bound-user-interface-show-uplink-description'}"/>
                 <pda:PdaSettingsButton Name="LockUplinkButton"
                                        Access="Public"
+                                       Visible="False"
                                        Text="{Loc 'pda-bound-user-interface-lock-uplink-title'}"
                                        Description="{Loc 'pda-bound-user-interface-lock-uplink-description'}"/>
             </BoxContainer>