Fixed building relative rotations

This commit is contained in:
Anuken
2021-11-21 22:03:15 -05:00
parent 64efa599d0
commit 6edf0a27a4
2 changed files with 10 additions and 2 deletions

View File

@@ -307,8 +307,15 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
return relativeTo(tile.x, tile.y);
}
public byte relativeTo(Building tile){
return relativeTo(tile.tile);
public byte relativeTo(Building build){
if(Math.abs(x - build.x) > Math.abs(y - build.y)){
if(x <= build.x - 1) return 0;
if(x >= build.x + 1) return 2;
}else{
if(y <= build.y - 1) return 1;
if(y >= build.y + 1) return 3;
}
return -1;
}
public byte relativeToEdge(Tile other){