mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
* Implement gridinv, 1500 squashed commits :elp: * Me when * Linter errors * Fix katana belts
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;
|
|
}
|
|
};
|