Moved rotation to Building

This commit is contained in:
Anuken 2020-07-29 10:19:07 -04:00
parent 749b9f5b30
commit 8729410cd8
49 changed files with 154 additions and 202 deletions

View file

@ -167,11 +167,11 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
@Remote(targets = Loc.both, called = Loc.server, forward = true, unreliable = true)
public static void rotateBlock(Player player, Building tile, boolean direction){
if(net.server() && (!Units.canInteract(player, tile) ||
!netServer.admins.allowAction(player, ActionType.rotate, tile.tile(), action -> action.rotation = Mathf.mod(tile.rotation() + Mathf.sign(direction), 4)))){
!netServer.admins.allowAction(player, ActionType.rotate, tile.tile(), action -> action.rotation = Mathf.mod(tile.rotation + Mathf.sign(direction), 4)))){
throw new ValidateException(player, "Player cannot rotate a block.");
}
tile.rotation(Mathf.mod(tile.rotation() + Mathf.sign(direction), 4));
tile.rotation = Mathf.mod(tile.rotation + Mathf.sign(direction), 4);
tile.updateProximity();
tile.noSleep();
}
@ -532,7 +532,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
for(int x = dresult.x; x <= dresult.x2; x++){
for(int y = dresult.y; y <= dresult.y2; y++){
Tile tile = world.Building(x, y);
Tile tile = world.tileBuilding(x, y);
if(tile == null || !validBreak(tile.x, tile.y)) continue;
drawBreaking(tile.x, tile.y);
@ -648,7 +648,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
int wx = x1 + x * Mathf.sign(x2 - x1);
int wy = y1 + y * Mathf.sign(y2 - y1);
Tile tile = world.Building(wx, wy);
Tile tile = world.tileBuilding(wx, wy);
if(tile == null) continue;