Various fixes
This commit is contained in:
@@ -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