mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-08-03 00:19:44 +07:00
Fixed liquid blocks not accepting liquids
This commit is contained in:
@ -48,6 +48,7 @@ public class Minimap extends Container<Element>{
|
||||
margin(margin);
|
||||
|
||||
addListener(new InputListener(){
|
||||
|
||||
@Override
|
||||
public boolean scrolled(InputEvent event, float x, float y, float amountx, float amounty){
|
||||
renderer.minimap.zoomBy(amounty);
|
||||
@ -68,15 +69,30 @@ public class Minimap extends Container<Element>{
|
||||
});
|
||||
|
||||
addListener(new ClickListener(){
|
||||
{
|
||||
tapSquareSize = Unit.dp.scl(11f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchUp(InputEvent event, float x, float y, int pointer, KeyCode button){
|
||||
float tapSquareSize = Unit.dp.scl(14f);
|
||||
if(Math.abs(x - touchDownX) < tapSquareSize && Math.abs(y - touchDownY) < tapSquareSize){
|
||||
if(inTapSquare()){
|
||||
super.touchUp(event, x, y, pointer, button);
|
||||
}else{
|
||||
pressed = false;
|
||||
pressedPointer = -1;
|
||||
pressedButton = null;
|
||||
cancelled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void touchDragged(InputEvent event, float x, float y, int pointer){
|
||||
if(!inTapSquare(x, y)){
|
||||
invalidateTapSquare();
|
||||
}
|
||||
super.touchDragged(event, x, y, pointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clicked(InputEvent event, float x, float y){
|
||||
ui.minimap.show();
|
||||
|
@ -108,7 +108,7 @@ public class Conduit extends LiquidBlock{
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
tile.entity.noSleep();
|
||||
return super.acceptLiquid(tile, source, liquid, amount) && ((2 + source.relativeTo(tile.x, tile.y)) % 4 != tile.getRotation());
|
||||
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f) && ((2 + source.relativeTo(tile.x, tile.y)) % 4 != tile.getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,6 +56,11 @@ public class LiquidBridge extends ItemBridge{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDumpLiquid(Tile tile, Tile to, Liquid liquid){
|
||||
ItemBridgeEntity entity = tile.entity();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.world.blocks.distribution;
|
||||
|
||||
import io.anuke.mindustry.type.Liquid;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.LiquidBlock;
|
||||
|
||||
@ -17,4 +18,8 @@ public class LiquidRouter extends LiquidBlock{
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptLiquid(Tile tile, Tile source, Liquid liquid, float amount){
|
||||
return tile.entity.liquids.get(liquid) + amount < liquidCapacity && (tile.entity.liquids.current() == liquid || tile.entity.liquids.get(tile.entity.liquids.current()) < 0.2f);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class Fracker extends SolidPump{
|
||||
public void update(Tile tile){
|
||||
FrackerEntity entity = tile.entity();
|
||||
|
||||
if(entity.cons.valid() && entity.accumulator < itemUseTime){
|
||||
if(entity.cons.valid()){
|
||||
if(entity.accumulator >= itemUseTime){
|
||||
entity.cons.trigger();
|
||||
entity.accumulator -= itemUseTime;
|
||||
|
Reference in New Issue
Block a user