mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-02 16:09:38 +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));
|
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
|
@Override
|
||||||
public Item config(){
|
public Item config(){
|
||||||
return sortItem;
|
return sortItem;
|
||||||
|
@ -12,7 +12,7 @@ import mindustry.world.*;
|
|||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
import static mindustry.Vars.content;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class ItemSource extends Block{
|
public class ItemSource extends Block{
|
||||||
private static Item lastItem;
|
private static Item lastItem;
|
||||||
@ -79,6 +79,17 @@ public class ItemSource extends Block{
|
|||||||
ItemSelection.buildTable(table, content.items(), () -> outputItem, item -> tile.configure(lastItem = item));
|
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
|
@Override
|
||||||
public boolean acceptItem(Tilec source, Item item){
|
public boolean acceptItem(Tilec source, Item item){
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,7 +13,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
|
|
||||||
import static mindustry.Vars.content;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class LiquidSource extends Block{
|
public class LiquidSource extends Block{
|
||||||
public static Liquid lastLiquid;
|
public static Liquid lastLiquid;
|
||||||
@ -71,6 +71,17 @@ public class LiquidSource extends Block{
|
|||||||
ItemSelection.buildTable(table, content.liquids(), () -> source, liquid -> tile.configure(lastLiquid = liquid));
|
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
|
@Override
|
||||||
public void playerPlaced(){
|
public void playerPlaced(){
|
||||||
if(lastLiquid != null){
|
if(lastLiquid != null){
|
||||||
|
@ -11,7 +11,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
import mindustry.world.blocks.*;
|
import mindustry.world.blocks.*;
|
||||||
|
|
||||||
import static mindustry.Vars.content;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class Unloader extends Block{
|
public class Unloader extends Block{
|
||||||
public float speed = 1f;
|
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));
|
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
|
@Override
|
||||||
public boolean canDump(Tilec to, Item item){
|
public boolean canDump(Tilec to, Item item){
|
||||||
return !(to.block() instanceof StorageBlock);
|
return !(to.block() instanceof StorageBlock);
|
||||||
|
Reference in New Issue
Block a user