Less terrible logic UI / Unary operations

This commit is contained in:
Anuken
2020-08-08 20:36:45 -04:00
parent 2042dafb73
commit 4dc90d4074
10 changed files with 156 additions and 31 deletions

View File

@@ -59,7 +59,7 @@ public class PayloadAcceptor extends Block{
@Override
public void handlePayload(Building source, Payload payload){
this.payload = (T)payload;
this.payVector.set(source).sub(this).clamp(-size * tilesize / 2f, size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f);
this.payVector.set(source).sub(this).clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
this.payRotation = source.angleTo(this);
updatePayload();
@@ -108,7 +108,7 @@ public class PayloadAcceptor extends Block{
payRotation = rotdeg();
if(payVector.len() >= size * tilesize/2f){
payVector.clamp(-size * tilesize / 2f, size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f);
payVector.clamp(-size * tilesize / 2f, -size * tilesize / 2f, size * tilesize / 2f, size * tilesize / 2f);
Building front = front();
if(front != null && front.block().outputsPayload){

View File

@@ -63,10 +63,8 @@ public class Pump extends LiquidBlock{
if(isMultiblock()){
Liquid last = null;
for(Tile other : tile.getLinkedTilesAs(this, tempTiles)){
if(other.floor().liquidDrop == null)
continue;
if(other.floor().liquidDrop != last && last != null)
return false;
if(other.floor().liquidDrop == null) continue;
if(other.floor().liquidDrop != last && last != null) return false;
last = other.floor().liquidDrop;
}
return last != null;
@@ -100,16 +98,11 @@ public class Pump extends LiquidBlock{
amount = 0f;
liquidDrop = null;
if(isMultiblock()){
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(canPump(other)){
liquidDrop = other.floor().liquidDrop;
amount += other.floor().liquidMultiplier;
}
for(Tile other : tile.getLinkedTiles(tempTiles)){
if(canPump(other)){
liquidDrop = other.floor().liquidDrop;
amount += other.floor().liquidMultiplier;
}
}else{
amount = tile.floor().liquidMultiplier;
liquidDrop = tile.floor().liquidDrop;
}
}