Fix 1x1 storage windows (#35985)
This commit is contained in:
@@ -42,6 +42,9 @@ public sealed class StorageWindow : BaseWindow
|
|||||||
private ValueList<EntityUid> _contained = new();
|
private ValueList<EntityUid> _contained = new();
|
||||||
private ValueList<EntityUid> _toRemove = new();
|
private ValueList<EntityUid> _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 TextureButton? _backButton;
|
||||||
|
|
||||||
private bool _isDirty;
|
private bool _isDirty;
|
||||||
@@ -408,11 +411,14 @@ public sealed class StorageWindow : BaseWindow
|
|||||||
_contained.Clear();
|
_contained.Clear();
|
||||||
_contained.AddRange(storageComp.Container.ContainedEntities.Reverse());
|
_contained.AddRange(storageComp.Container.ContainedEntities.Reverse());
|
||||||
|
|
||||||
|
var width = boundingGrid.Width + 1;
|
||||||
|
var height = boundingGrid.Height + 1;
|
||||||
|
|
||||||
// Build the grid representation
|
// 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.Rows = height;
|
||||||
_pieceGrid.Columns = boundingGrid.Width + 1;
|
_pieceGrid.Columns = width;
|
||||||
_controlGrid.Clear();
|
_controlGrid.Clear();
|
||||||
|
|
||||||
for (var y = boundingGrid.Bottom; y <= boundingGrid.Top; y++)
|
for (var y = boundingGrid.Bottom; y <= boundingGrid.Top; y++)
|
||||||
@@ -430,6 +436,7 @@ public sealed class StorageWindow : BaseWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_pieceGridSize = new(width, height);
|
||||||
_toRemove.Clear();
|
_toRemove.Clear();
|
||||||
|
|
||||||
// Remove entities no longer relevant / Update existing ones
|
// Remove entities no longer relevant / Update existing ones
|
||||||
|
|||||||
Reference in New Issue
Block a user