mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-10-01 18:50:27 +03:00
Ability to see and grab what's inside of bridge blocks (#11605)
* just this * swapConfigInventory * fixed
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<CharSequence> text){
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user