Various fixes
This commit is contained in:
@@ -305,7 +305,7 @@ public class Block extends UnlockableContent{
|
||||
return hasItems;
|
||||
}
|
||||
|
||||
/** Returns whether ot not this block can be place on the specified */
|
||||
/** Returns whether or not this block can be place on the specified */
|
||||
public boolean canPlaceOn(Tile tile, Team team){
|
||||
return true;
|
||||
}
|
||||
@@ -365,7 +365,7 @@ public class Block extends UnlockableContent{
|
||||
float capacity = cons.capacity;
|
||||
|
||||
bars.add("power", entity -> new Bar(() -> buffered ? Core.bundle.format("bar.poweramount", Float.isNaN(entity.power.status * capacity) ? "<ERROR>" : (int)(entity.power.status * capacity)) :
|
||||
Core.bundle.get("bar.power"), () -> Pal.powerBar, () -> Mathf.zero(cons.requestedPower(entity)) && entity.power.graph.getPowerProduced() + entity.power.graph.getBatteryStored() > 0f ? 1f : entity.power.status));
|
||||
Core.bundle.get("bar.power"), () -> Pal.powerBar, () -> Mathf.zero(cons.requestedPower(entity)) && entity.power.graph.getPowerProduced() + entity.power.graph.getBatteryStored() > 0f ? 1f : entity.power.status));
|
||||
}
|
||||
|
||||
if(hasItems && configurable){
|
||||
|
||||
@@ -27,23 +27,27 @@ public class PayloadAcceptor extends Block{
|
||||
sync = true;
|
||||
}
|
||||
|
||||
public static boolean blends(Building tile, int direction){
|
||||
int size = tile.block.size;
|
||||
Building accept = tile.nearby(Geometry.d4(direction).x * size, Geometry.d4(direction).y * size);
|
||||
public static boolean blends(Building build, int direction){
|
||||
int size = build.block.size;
|
||||
int trns = build.block.size/2 + 1;
|
||||
Building accept = build.nearby(Geometry.d4(direction).x * trns, Geometry.d4(direction).y * trns);
|
||||
return accept != null &&
|
||||
accept.block.outputsPayload &&
|
||||
|
||||
//if size is the same, block must either be facing this one, or not be rotating
|
||||
((accept.block.size == size &&
|
||||
((accept.tileX() + Geometry.d4(accept.rotation).x * size == tile.tileX() && accept.tileY() + Geometry.d4(accept.rotation).y * size == tile.tileY())
|
||||
|| !accept.block.rotate || (accept.block.rotate && !accept.block.outputFacing))) ||
|
||||
((accept.block.size == size
|
||||
&& Math.abs(accept.tileX() - build.tileX()) % size == 0 //check alignment
|
||||
&& Math.abs(accept.tileY() - build.tileY()) % size == 0
|
||||
&& ((accept.block.rotate && accept.tileX() + Geometry.d4(accept.rotation).x * size == build.tileX() && accept.tileY() + Geometry.d4(accept.rotation).y * size == build.tileY())
|
||||
|| !accept.block.rotate
|
||||
|| !accept.block.outputFacing)) ||
|
||||
|
||||
//if the other block is smaller, check alignment
|
||||
(accept.block.size < size &&
|
||||
(accept.rotation % 2 == 0 ? //check orientation; make sure it's aligned properly with this block.
|
||||
Math.abs(accept.y - tile.y) <= (size * tilesize - accept.block.size * tilesize)/2f : //check Y alignment
|
||||
Math.abs(accept.x - tile.x) <= (size * tilesize - accept.block.size * tilesize)/2f //check X alignment
|
||||
)) && (!accept.block.rotate || accept.front() == tile || !accept.block.outputFacing) //make sure it's facing this block
|
||||
Math.abs(accept.y - build.y) <= (size * tilesize - accept.block.size * tilesize)/2f : //check Y alignment
|
||||
Math.abs(accept.x - build.x) <= (size * tilesize - accept.block.size * tilesize)/2f //check X alignment
|
||||
)) && (!accept.block.rotate || accept.front() == build || !accept.block.outputFacing) //make sure it's facing this block
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user