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;
}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;
@@ -26,12 +26,11 @@ 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, swapped;
boolean holding, held;
float[] shrinkHoldTimes = new float[content.items().size];
Item lastItem;
@@ -56,7 +55,6 @@ public class BlockInventoryFragment{
if(build == null || !build.block.isAccessible() || build.items == null || build.items.total() == 0){
return;
}
swapped = !swapped && swap;
rebuild(true);
}
@@ -233,10 +231,9 @@ public class BlockInventoryFragment{
}
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();
var alignment = swapped ? Align.topRight : Align.topLeft;
table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, alignment);
table.setPosition(v.x - Core.scene.marginLeft, v.y - Core.scene.marginBottom, build.block.diagonalConfigInventory ? Align.bottomLeft : Align.topLeft);
}
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;
/** 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;
/** If true, the building inventory will be placed diagonally on the top right. */
public boolean diagonalConfigInventory = 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. */
@@ -58,7 +58,7 @@ public class ItemBridge extends Block{
allowDiagonal = false;
copyConfig = false;
ignoreResizeConfig = true;
swapConfigInventory = true;
diagonalConfigInventory = true;
priority = TargetPriority.transport;
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;
}
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))
&& (other.team() == tile.team() || tile.block() != this)
&& (!checkDouble || ((ItemBridgeBuild)other.build).link != tile.pos());