]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Storage sidebar fix (#34680)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 27 Jan 2025 23:09:52 +0000 (10:09 +1100)
committerGitHub <noreply@github.com>
Mon, 27 Jan 2025 23:09:52 +0000 (10:09 +1100)
Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs
Content.Shared/Storage/EntitySystems/SharedStorageSystem.cs

index 4527ffd59a901e89fe095abc9d7f75cf16c8529c..88b4c06d72c01664d7d7d938ada94653e409c271 100644 (file)
@@ -201,7 +201,8 @@ public sealed class StorageWindow : BaseWindow
 
         #region Sidebar
         _sidebar.Children.Clear();
-        _sidebar.Rows = boundingGrid.Height + 1;
+        var rows = boundingGrid.Height + 1;
+        _sidebar.Rows = rows;
 
         var exitButton = new TextureButton
         {
@@ -243,12 +244,10 @@ public sealed class StorageWindow : BaseWindow
         };
 
         _sidebar.AddChild(exitContainer);
-        var offset = 1;
+        var offset = 2;
 
-        if (_entity.System<StorageSystem>().NestedStorage && boundingGrid.Height > 0)
+        if (_entity.System<StorageSystem>().NestedStorage && rows > 0)
         {
-            offset += 1;
-
             _backButton = new TextureButton
             {
                 TextureNormal = _backTexture,
@@ -280,7 +279,7 @@ public sealed class StorageWindow : BaseWindow
                 {
                     new TextureRect
                     {
-                        Texture = boundingGrid.Height > 2 ? _sidebarMiddleTexture : _sidebarBottomTexture,
+                        Texture = rows > 2 ? _sidebarMiddleTexture : _sidebarBottomTexture,
                         TextureScale = new Vector2(2, 2),
                         Children =
                         {
@@ -293,22 +292,13 @@ public sealed class StorageWindow : BaseWindow
             _sidebar.AddChild(backContainer);
         }
 
-        var rows = boundingGrid.Height - offset;
-
-        for (var i = 0; i < rows; i++)
-        {
-            _sidebar.AddChild(new TextureRect
-            {
-                Texture = _sidebarMiddleTexture,
-                TextureScale = new Vector2(2, 2),
-            });
-        }
+        var fillerRows = rows - offset;
 
-        if (rows > 0)
+        for (var i = 0; i < fillerRows; i++)
         {
             _sidebar.AddChild(new TextureRect
             {
-                Texture = _sidebarBottomTexture,
+                Texture = i != (fillerRows - 1) ? _sidebarMiddleTexture : _sidebarBottomTexture,
                 TextureScale = new Vector2(2, 2),
             });
         }
index f156db506ad0cc875da6bc34d97c25397f5487a9..7bf6d74c60b4d52ebc7de8772aeeda0c49de04f5 100644 (file)
@@ -1314,6 +1314,7 @@ public abstract class SharedStorageSystem : EntitySystem
         }
 
         Dirty(ent, ent.Comp);
+        UpdateUI((ent.Owner, ent.Comp));
     }
 
     /// <summary>