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:
@@ -32,6 +32,7 @@ namespace Content.Client.Input
|
||||
common.AddFunction(ContentKeyFunctions.ToggleFullscreen);
|
||||
common.AddFunction(ContentKeyFunctions.MoveStoredItem);
|
||||
common.AddFunction(ContentKeyFunctions.RotateStoredItem);
|
||||
common.AddFunction(ContentKeyFunctions.SaveItemLocation);
|
||||
common.AddFunction(ContentKeyFunctions.Point);
|
||||
common.AddFunction(ContentKeyFunctions.ZoomOut);
|
||||
common.AddFunction(ContentKeyFunctions.ZoomIn);
|
||||
|
||||
@@ -183,6 +183,7 @@ namespace Content.Client.Options.UI.Tabs
|
||||
AddButton(ContentKeyFunctions.SwapHands);
|
||||
AddButton(ContentKeyFunctions.MoveStoredItem);
|
||||
AddButton(ContentKeyFunctions.RotateStoredItem);
|
||||
AddButton(ContentKeyFunctions.SaveItemLocation);
|
||||
|
||||
AddHeader("ui-options-header-interaction-adv");
|
||||
AddButton(ContentKeyFunctions.SmartEquipBackpack);
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -240,6 +240,16 @@ public sealed class StorageUIController : UIController, IOnSystemChanged<Storage
|
||||
|
||||
args.Handle();
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.SaveItemLocation)
|
||||
{
|
||||
if (_container?.StorageEntity is not {} storage)
|
||||
return;
|
||||
|
||||
_entity.RaisePredictiveEvent(new StorageSaveItemLocationEvent(
|
||||
_entity.GetNetEntity(control.Entity),
|
||||
_entity.GetNetEntity(storage)));
|
||||
args.Handle();
|
||||
}
|
||||
else if (args.Function == ContentKeyFunctions.ExamineEntity)
|
||||
{
|
||||
_entity.System<ExamineSystem>().DoExamine(control.Entity);
|
||||
|
||||
Reference in New Issue
Block a user