Conduit autotile, cleanup

This commit is contained in:
Anuken
2019-10-06 17:30:11 -04:00
parent 20462b91d4
commit 335c1779ef
7 changed files with 144 additions and 104 deletions

View File

@@ -141,6 +141,9 @@ public class DesktopInput extends InputHandler{
}
rotation = Mathf.mod(rotation + (int)Core.input.axisTap(Binding.rotate), 4);
if(Math.abs((int)Core.input.axisTap(Binding.rotate)) > 0 && isPlacing() && mode == placing){
updateLine(selectX, selectY);
}
Tile cursor = tileAt(Core.input.mouseX(), Core.input.mouseY());
@@ -225,7 +228,7 @@ public class DesktopInput extends InputHandler{
}
if(mode == placing && block != null){
if (!overrideLineRotation && !Core.input.keyDown(Binding.diagonal_placement) && (selectX != cursorX || selectY != cursorY) && ((int) Core.input.axisTap(Binding.rotate) != 0)){
if(!overrideLineRotation && !Core.input.keyDown(Binding.diagonal_placement) && (selectX != cursorX || selectY != cursorY) && ((int) Core.input.axisTap(Binding.rotate) != 0)){
rotation = ((int)((Angles.angle(selectX, selectY, cursorX, cursorY) + 45) / 90f)) % 4;
overrideLineRotation = true;
}

View File

@@ -475,7 +475,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
float angle = Angles.angle(startX, startY, endX, endY);
int baseRotation = rotation;
if (!overrideLineRotation || diagonal){
if(!overrideLineRotation || diagonal){
baseRotation = (startX == endX && startY == endY) ? rotation : ((int)((angle + 45) / 90f)) % 4;
}
@@ -491,7 +491,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
Point2 next = i == points.size - 1 ? null : points.get(i + 1);
line.x = point.x;
line.y = point.y;
if (!overrideLineRotation || diagonal){
if(!overrideLineRotation || diagonal){
line.rotation = next != null ? Tile.relativeTo(point.x, point.y, next.x, next.y) : baseRotation;
}else{
line.rotation = rotation;