* Grid Inventory * oh boy we keep cracking on * auto insertion is kinda working? gross, too! * pieces and proper layouts * fix the sprites * mousing over grid pieces... finally * dragging deez nuts all over the screen * eek! * dragging is 90% less horrendous * auto-rotating * flatten * Rotation at last * fix rotation and change keybind for removing items. * rebinding and keybinding * wow! look at that! configurable with a button! cool! * dragging is a bit cooler, eh? * hover insert, my beloved * add some grids for storage, fix 1x1 storages, fix multiple inputs at once * el navigation * oh yeah some stuff i forgor * more fixes and QOL stuff * the griddening * the last of it (yippee) * sloth review :)
41 lines
980 B
C#
41 lines
980 B
C#
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Shared.Storage;
|
|
|
|
[DataDefinition, Serializable, NetSerializable]
|
|
public partial record struct ItemStorageLocation
|
|
{
|
|
/// <summary>
|
|
/// The rotation, stored a cardinal direction in order to reduce rounding errors.
|
|
/// </summary>
|
|
[DataField]
|
|
private Direction _rotation;
|
|
|
|
/// <summary>
|
|
/// The rotation of the piece in storage.
|
|
/// </summary>
|
|
public Angle Rotation
|
|
{
|
|
get => _rotation.ToAngle();
|
|
set => _rotation = value.GetCardinalDir();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Where the item is located in storage.
|
|
/// </summary>
|
|
[DataField]
|
|
public Vector2i Position;
|
|
|
|
public ItemStorageLocation(Angle rotation, Vector2i position)
|
|
{
|
|
Rotation = rotation;
|
|
Position = position;
|
|
}
|
|
|
|
public bool Equals(ItemStorageLocation? other)
|
|
{
|
|
return Rotation == other?.Rotation &&
|
|
Position == other.Value.Position;
|
|
}
|
|
};
|