prefRotation for units

This commit is contained in:
Anuken
2020-11-08 17:50:27 -05:00
parent a35f62d181
commit cbfb703cfb
5 changed files with 29 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ import mindustry.world.*;
import static mindustry.Vars.*;
/** Class for storing build requests. Can be either a place or remove request. */
public class BuildPlan{
public class BuildPlan implements Position{
/** Position and rotation of this request. */
public int x, y, rotation;
/** Block being placed. If null, this is a breaking request.*/
@@ -127,11 +127,11 @@ public class BuildPlan{
}
public float drawx(){
return x*tilesize + block.offset;
return x*tilesize + (block == null ? 0 : block.offset);
}
public float drawy(){
return y*tilesize + block.offset;
return y*tilesize + (block == null ? 0 : block.offset);
}
public @Nullable Tile tile(){
@@ -142,6 +142,16 @@ public class BuildPlan{
return world.build(x, y);
}
@Override
public float getX(){
return drawx();
}
@Override
public float getY(){
return drawy();
}
@Override
public String toString(){
return "BuildRequest{" +