mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-31 23:19:43 +07:00
Clear Selection with Double Click (#1958)
* add onConfigureTileTapped method * code cleanup * Update ItemSource.java Co-authored-by: Anuken <arnukren@gmail.com>
This commit is contained in:
@ -143,6 +143,17 @@ public class Sorter extends Block{
|
||||
ItemSelection.buildTable(table, content.items(), () -> sortItem, item -> tile.configure(lastItem = item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
tile.configure(lastItem = null);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item config(){
|
||||
return sortItem;
|
||||
|
@ -12,7 +12,7 @@ import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.content;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ItemSource extends Block{
|
||||
private static Item lastItem;
|
||||
@ -79,6 +79,17 @@ public class ItemSource extends Block{
|
||||
ItemSelection.buildTable(table, content.items(), () -> outputItem, item -> tile.configure(lastItem = item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
tile.configure(lastItem = null);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptItem(Tilec source, Item item){
|
||||
return false;
|
||||
|
@ -13,7 +13,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import static mindustry.Vars.content;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class LiquidSource extends Block{
|
||||
public static Liquid lastLiquid;
|
||||
@ -71,6 +71,17 @@ public class LiquidSource extends Block{
|
||||
ItemSelection.buildTable(table, content.liquids(), () -> source, liquid -> tile.configure(lastLiquid = liquid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
tile.configure(lastLiquid = null);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playerPlaced(){
|
||||
if(lastLiquid != null){
|
||||
|
@ -11,7 +11,7 @@ import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
import static mindustry.Vars.content;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Unloader extends Block{
|
||||
public float speed = 1f;
|
||||
@ -104,6 +104,17 @@ public class Unloader extends Block{
|
||||
ItemSelection.buildTable(table, content.items(), () -> tile.<UnloaderEntity>ent().sortItem, item -> tile.configure(lastItem = item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onConfigureTileTapped(Tilec other){
|
||||
if(this == other){
|
||||
control.input.frag.config.hideConfig();
|
||||
tile.configure(lastItem = null);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDump(Tilec to, Item item){
|
||||
return !(to.block() instanceof StorageBlock);
|
||||
|
Reference in New Issue
Block a user