diff --git a/core/src/mindustry/input/InputHandler.java b/core/src/mindustry/input/InputHandler.java index fd9e1edaf4..d22215fddf 100644 --- a/core/src/mindustry/input/InputHandler.java +++ b/core/src/mindustry/input/InputHandler.java @@ -2015,6 +2015,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{ consumed = true; }else if(build.interactable(player.team()) && build.block.synthetic() && (!consumed || build.block.allowConfigInventory)){ if(build.block.hasItems && build.items.total() > 0){ + inv.swap = build.block.swapConfigInventory; inv.showFor(build); consumed = true; showedInventory = true; diff --git a/core/src/mindustry/ui/fragments/BlockInventoryFragment.java b/core/src/mindustry/ui/fragments/BlockInventoryFragment.java index f48a46d63d..cab6ba84ec 100644 --- a/core/src/mindustry/ui/fragments/BlockInventoryFragment.java +++ b/core/src/mindustry/ui/fragments/BlockInventoryFragment.java @@ -26,11 +26,12 @@ import static mindustry.Vars.*; public class BlockInventoryFragment{ private static final float holdWithdraw = 20f; private static final float holdShrink = 120f; + public boolean swap; Table table = new Table(); Building build; float holdTime = 0f, emptyTime; - boolean holding, held; + boolean holding, held, swapped; float[] shrinkHoldTimes = new float[content.items().size]; Item lastItem; @@ -55,6 +56,7 @@ public class BlockInventoryFragment{ if(build == null || !build.block.isAccessible() || build.items == null || build.items.total() == 0){ return; } + swapped = !swapped && swap; rebuild(true); } @@ -231,9 +233,10 @@ public class BlockInventoryFragment{ } private void updateTablePosition(){ - Vec2 v = Core.input.mouseScreen(build.x + build.block.size * tilesize / 2f, build.y + build.block.size * tilesize / 2f); + Vec2 v = Core.input.mouseScreen(build.x + (swapped ? -build.block.size : build.block.size) * tilesize / 2f, build.y + build.block.size * tilesize / 2f); table.pack(); - table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, Align.topLeft); + var alignment = swapped ? Align.topRight : Align.topLeft; + table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, alignment); } private Element itemImage(TextureRegion region, Prov text){ diff --git a/core/src/mindustry/world/Block.java b/core/src/mindustry/world/Block.java index f6b683f98e..2fb61fd4b7 100644 --- a/core/src/mindustry/world/Block.java +++ b/core/src/mindustry/world/Block.java @@ -264,6 +264,8 @@ public class Block extends UnlockableContent implements Senseable{ public boolean commandable; /** If true, the building inventory can be shown with the config. */ public boolean allowConfigInventory = true; + /** If true, the building inventory will swap sides on the x axis each time it is tapped */ + public boolean swapConfigInventory = false; /** Defines how large selection menus, such as that of sorters, should be. */ public int selectionRows = 5, selectionColumns = 4; /** If true, this block can be configured by logic. */ diff --git a/core/src/mindustry/world/blocks/distribution/ItemBridge.java b/core/src/mindustry/world/blocks/distribution/ItemBridge.java index 8de3443a64..92ad7e630f 100644 --- a/core/src/mindustry/world/blocks/distribution/ItemBridge.java +++ b/core/src/mindustry/world/blocks/distribution/ItemBridge.java @@ -57,9 +57,8 @@ public class ItemBridge extends Block{ noUpdateDisabled = true; allowDiagonal = false; copyConfig = false; - //disabled as to not be annoying - allowConfigInventory = false; ignoreResizeConfig = true; + swapConfigInventory = true; priority = TargetPriority.transport; delayLandingConfig = true;