var storageBounding = storageEnt.Comp.Grid.GetBoundingBox();
+ Angle startAngle;
+ if (storageEnt.Comp.DefaultStorageOrientation == null)
+ {
+ startAngle = Angle.FromDegrees(-itemEnt.Comp.StoredRotation);
+ }
+ else
+ {
+ if (storageBounding.Width < storageBounding.Height)
+ {
+ startAngle = storageEnt.Comp.DefaultStorageOrientation == StorageDefaultOrientation.Horizontal
+ ? Angle.Zero
+ : Angle.FromDegrees(90);
+ }
+ else
+ {
+ startAngle = storageEnt.Comp.DefaultStorageOrientation == StorageDefaultOrientation.Vertical
+ ? Angle.Zero
+ : Angle.FromDegrees(90);
+ }
+ }
+
for (var y = storageBounding.Bottom; y <= storageBounding.Top; y++)
{
for (var x = storageBounding.Left; x <= storageBounding.Right; x++)
{
- for (var angle = Angle.FromDegrees(-itemEnt.Comp.StoredRotation); angle <= Angle.FromDegrees(360 - itemEnt.Comp.StoredRotation); angle += Math.PI / 2f)
+ for (var angle = startAngle; angle <= Angle.FromDegrees(360 - startAngle); angle += Math.PI / 2f)
{
var location = new ItemStorageLocation(angle, (x, y));
if (ItemFitsInGridLocation(itemEnt, storageEnt, location))
[DataField("storageCloseSound")]
public SoundSpecifier? StorageCloseSound;
+ /// <summary>
+ /// If not null, ensures that all inserted items are of the same orientation
+ /// Horizontal - items are stored laying down
+ /// Vertical - items are stored standing up
+ /// </summary>
+ [DataField, ViewVariables(VVAccess.ReadWrite)]
+ public StorageDefaultOrientation? DefaultStorageOrientation;
+
[Serializable, NetSerializable]
public enum StorageUiKey
{
StorageUsed,
Capacity
}
+
+ [Serializable, NetSerializable]
+ public enum StorageDefaultOrientation : byte
+ {
+ Horizontal,
+ Vertical
+ }
}