Files
wwdpublic/Content.Shared/Storage/ItemStorageLocation.cs
Debug 18f0af1f68 Implement gridinv, proper (#703)
* Implement gridinv, 1500 squashed commits :elp:

* Me when

* Linter errors

* Fix katana belts
2024-01-21 19:58:28 +01:00

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;
}
};