Stealing from foos but done properly

This commit is contained in:
Anuken
2026-09-02 09:48:58 -04:00
parent 667907009d
commit ccae400bcf
4 changed files with 7 additions and 11 deletions
@@ -2015,7 +2015,6 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
consumed = true; consumed = true;
}else if(build.interactable(player.team()) && build.block.synthetic() && (!consumed || build.block.allowConfigInventory)){ }else if(build.interactable(player.team()) && build.block.synthetic() && (!consumed || build.block.allowConfigInventory)){
if(build.block.hasItems && build.items.total() > 0){ if(build.block.hasItems && build.items.total() > 0){
inv.swap = build.block.swapConfigInventory;
inv.showFor(build); inv.showFor(build);
consumed = true; consumed = true;
showedInventory = true; showedInventory = true;
@@ -26,12 +26,11 @@ import static mindustry.Vars.*;
public class BlockInventoryFragment{ public class BlockInventoryFragment{
private static final float holdWithdraw = 20f; private static final float holdWithdraw = 20f;
private static final float holdShrink = 120f; private static final float holdShrink = 120f;
public boolean swap;
Table table = new Table(); Table table = new Table();
Building build; Building build;
float holdTime = 0f, emptyTime; float holdTime = 0f, emptyTime;
boolean holding, held, swapped; boolean holding, held;
float[] shrinkHoldTimes = new float[content.items().size]; float[] shrinkHoldTimes = new float[content.items().size];
Item lastItem; Item lastItem;
@@ -56,7 +55,6 @@ public class BlockInventoryFragment{
if(build == null || !build.block.isAccessible() || build.items == null || build.items.total() == 0){ if(build == null || !build.block.isAccessible() || build.items == null || build.items.total() == 0){
return; return;
} }
swapped = !swapped && swap;
rebuild(true); rebuild(true);
} }
@@ -233,10 +231,9 @@ public class BlockInventoryFragment{
} }
private void updateTablePosition(){ private void updateTablePosition(){
Vec2 v = Core.input.mouseScreen(build.x + (swapped ? -build.block.size : build.block.size) * tilesize / 2f, build.y + build.block.size * tilesize / 2f); Vec2 v = Core.input.mouseScreen(build.x + build.block.size * tilesize / 2f, build.y + build.block.size * tilesize / 2f);
table.pack(); table.pack();
var alignment = swapped ? Align.topRight : Align.topLeft; table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, build.block.diagonalConfigInventory ? Align.bottomLeft : Align.topLeft);
table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, alignment);
} }
private Element itemImage(TextureRegion region, Prov<CharSequence> text){ private Element itemImage(TextureRegion region, Prov<CharSequence> text){
+2 -2
View File
@@ -264,8 +264,8 @@ public class Block extends UnlockableContent implements Senseable{
public boolean commandable; public boolean commandable;
/** If true, the building inventory can be shown with the config. */ /** If true, the building inventory can be shown with the config. */
public boolean allowConfigInventory = true; public boolean allowConfigInventory = true;
/** If true, the building inventory will swap sides on the x axis each time it is tapped */ /** If true, the building inventory will be placed diagonally on the top right. */
public boolean swapConfigInventory = false; public boolean diagonalConfigInventory = false;
/** Defines how large selection menus, such as that of sorters, should be. */ /** Defines how large selection menus, such as that of sorters, should be. */
public int selectionRows = 5, selectionColumns = 4; public int selectionRows = 5, selectionColumns = 4;
/** If true, this block can be configured by logic. */ /** If true, this block can be configured by logic. */
@@ -58,7 +58,7 @@ public class ItemBridge extends Block{
allowDiagonal = false; allowDiagonal = false;
copyConfig = false; copyConfig = false;
ignoreResizeConfig = true; ignoreResizeConfig = true;
swapConfigInventory = true; diagonalConfigInventory = true;
priority = TargetPriority.transport; priority = TargetPriority.transport;
delayLandingConfig = true; delayLandingConfig = true;
@@ -156,7 +156,7 @@ public class ItemBridge extends Block{
if(!(tile.block().hasItems && other.block().hasItems) && !(tile.block().hasLiquids && other.block().hasLiquids)) return false; if(!(tile.block().hasItems && other.block().hasItems) && !(tile.block().hasLiquids && other.block().hasLiquids)) return false;
} }
return ((linkSameType ? other.block() == tile.block() && tile.block() == this : (other.block() instanceof ItemBridge && tile.block() instanceof ItemBridge)) return ((linkSameType ? other.block() == tile.block() && tile.block() == this : (other.block() instanceof ItemBridge && tile.block() instanceof ItemBridge))
|| (!(tile.block() instanceof ItemBridge) && other.block() == this)) || (!(tile.block() instanceof ItemBridge) && other.block() == this))
&& (other.team() == tile.team() || tile.block() != this) && (other.team() == tile.team() || tile.block() != this)
&& (!checkDouble || ((ItemBridgeBuild)other.build).link != tile.pos()); && (!checkDouble || ((ItemBridgeBuild)other.build).link != tile.pos());