mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-06 08:57:45 +07:00
Add destination tile to block rotatedOutput
(#9949)
* Add destination to rotatedOutput * Apply to GenericCrafter for output directions. * Forgot to remove some logs
This commit is contained in:
parent
92df8f9507
commit
5c23abf2d8
@ -519,6 +519,10 @@ public class Block extends UnlockableContent implements Senseable{
|
|||||||
return rotate;
|
return rotate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean rotatedOutput(int fromX, int fromY, Tile destination){
|
||||||
|
return rotatedOutput(fromX, fromY);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean synthetic(){
|
public boolean synthetic(){
|
||||||
return update || destructible;
|
return update || destructible;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ public interface Autotiler{
|
|||||||
//block is facing the other
|
//block is facing the other
|
||||||
Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) ||
|
Point2.equals(tile.x + Geometry.d4(rotation).x, tile.y + Geometry.d4(rotation).y, otherx, othery) ||
|
||||||
//does not output to rotated direction
|
//does not output to rotated direction
|
||||||
!otherblock.rotatedOutput(otherx, othery) ||
|
!otherblock.rotatedOutput(otherx, othery, tile) ||
|
||||||
//other block is facing this one
|
//other block is facing this one
|
||||||
Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y);
|
Point2.equals(otherx + Geometry.d4(otherrot).x, othery + Geometry.d4(otherrot).y, tile.x, tile.y);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ import mindustry.gen.*;
|
|||||||
import mindustry.logic.*;
|
import mindustry.logic.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.liquid.Conduit.*;
|
||||||
import mindustry.world.draw.*;
|
import mindustry.world.draw.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
@ -91,8 +92,17 @@ public class GenericCrafter extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rotatedOutput(int x, int y){
|
public boolean rotatedOutput(int fromX, int fromY, Tile destination){
|
||||||
return false;
|
if(!(destination.build instanceof ConduitBuild)) return false;
|
||||||
|
|
||||||
|
Building crafter = world.build(fromX, fromY);
|
||||||
|
if(crafter == null) return false;
|
||||||
|
int relative = Mathf.mod(crafter.relativeTo(destination) - crafter.rotation, 4);
|
||||||
|
for(int dir : liquidOutputDirections){
|
||||||
|
if(dir == -1 || dir == relative) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user