biggest gridinv update OF ALL TIME (#25834)

* add SaveItemLocation keybind

* make item direction public to avoid having to change between Angle for no reason

* add item location saving

* show

* Added a better save keybind, made it draw saved positions, and trying to save in a position it has already been saved in removes that position.

* w

* code style

* Make taken spots appear blue

* style

* !

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
Co-authored-by: notquitehadouken <tripwiregamer@gmail.com>
Co-authored-by: I.K <45953835+notquitehadouken@users.noreply.github.com>
This commit is contained in:
deltanedas
2024-03-28 06:31:47 +00:00
committed by GitHub
parent 65fa3ae211
commit 6863a7cc26
10 changed files with 188 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.Systems.Storage.Controls;
@@ -355,6 +356,40 @@ public sealed class StorageContainer : BaseWindow
origin,
currentLocation.Rotation);
foreach (var locations in storageComponent.SavedLocations)
{
if (!_entity.TryGetComponent<MetaDataComponent>(currentEnt, out var meta) || meta.EntityName != locations.Key)
continue;
float spot = 0;
var marked = new List<Control>();
foreach (var location in locations.Value)
{
var shape = itemSystem.GetAdjustedItemShape(currentEnt, location);
var bound = shape.GetBoundingBox();
var spotFree = storageSystem.ItemFitsInGridLocation(currentEnt, StorageEntity.Value, location);
if (spotFree)
spot++;
for (var y = bound.Bottom; y <= bound.Top; y++)
{
for (var x = bound.Left; x <= bound.Right; x++)
{
if (TryGetBackgroundCell(x, y, out var cell) && shape.Contains(x, y) && !marked.Contains(cell))
{
marked.Add(cell);
cell.ModulateSelfOverride = spotFree
? Color.FromHsv((0.18f, 1 / spot, 0.5f / spot + 0.5f, 1f))
: Color.FromHex("#2222CC");
}
}
}
}
}
var validColor = usingInHand ? Color.Goldenrod : Color.FromHex("#1E8000");
for (var y = itemBounding.Bottom; y <= itemBounding.Top; y++)