From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 29 Mar 2025 18:57:28 +0000 (+1100) Subject: Fix 1x1 storage windows (#35985) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=0c98ad8b387aaadedfebbfb3145ec091989a5155;p=space-station-14.git Fix 1x1 storage windows (#35985) --- diff --git a/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs b/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs index a4afebc217..39ffd883bb 100644 --- a/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs +++ b/Content.Client/UserInterface/Systems/Storage/Controls/StorageWindow.cs @@ -42,6 +42,9 @@ public sealed class StorageWindow : BaseWindow private ValueList _contained = new(); private ValueList _toRemove = new(); + // Manually store this because you can't have a 0x0 GridContainer but we still need to add child controls for 1x1 containers. + private Vector2i _pieceGridSize; + private TextureButton? _backButton; private bool _isDirty; @@ -408,11 +411,14 @@ public sealed class StorageWindow : BaseWindow _contained.Clear(); _contained.AddRange(storageComp.Container.ContainedEntities.Reverse()); + var width = boundingGrid.Width + 1; + var height = boundingGrid.Height + 1; + // Build the grid representation - if (_pieceGrid.Rows - 1 != boundingGrid.Height || _pieceGrid.Columns - 1 != boundingGrid.Width) + if (_pieceGrid.Rows != _pieceGridSize.Y || _pieceGrid.Columns != _pieceGridSize.X) { - _pieceGrid.Rows = boundingGrid.Height + 1; - _pieceGrid.Columns = boundingGrid.Width + 1; + _pieceGrid.Rows = height; + _pieceGrid.Columns = width; _controlGrid.Clear(); for (var y = boundingGrid.Bottom; y <= boundingGrid.Top; y++) @@ -430,6 +436,7 @@ public sealed class StorageWindow : BaseWindow } } + _pieceGridSize = new(width, height); _toRemove.Clear(); // Remove entities no longer relevant / Update existing ones