Power cleanup
This commit is contained in:
@@ -826,26 +826,22 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
|
|||||||
Array<Point2> skip = new Array<>();
|
Array<Point2> skip = new Array<>();
|
||||||
|
|
||||||
for(int i = 1; i < points.size; i++){
|
for(int i = 1; i < points.size; i++){
|
||||||
// check with how many powernodes the *next* tile will overlap
|
|
||||||
int overlaps = 0;
|
int overlaps = 0;
|
||||||
|
Point2 point = points.get(i);
|
||||||
|
|
||||||
|
//check with how many powernodes the *next* tile will overlap
|
||||||
for(int j = 0; j < i; j++){
|
for(int j = 0; j < i; j++){
|
||||||
// skip powernodes we have already crossed off as air
|
if(!skip.contains(points.get(j)) && ((PowerNode)block).overlaps(world.ltile(point.x, point.y), world.ltile(points.get(j).x, points.get(j).y))){
|
||||||
if(skip.contains(points.get(j))) continue;
|
|
||||||
|
|
||||||
Tile next = world.ltile(points.get(i).x, points.get(i).y);
|
|
||||||
Tile loop = world.ltile(points.get(j).x, points.get(j).y);
|
|
||||||
|
|
||||||
if(((PowerNode)block).overlaps(next, loop)){
|
|
||||||
overlaps++;
|
overlaps++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if its more than one it can bridge the gap
|
//if it's more than one, it can bridge the gap
|
||||||
if(overlaps > 1){
|
if(overlaps > 1){
|
||||||
skip.add(points.get(i-1));
|
skip.add(points.get(i-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove the skipped points outside the each
|
//remove skipped points
|
||||||
points.removeAll(skip);
|
points.removeAll(skip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import io.anuke.arc.graphics.g2d.*;
|
|||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
import io.anuke.arc.math.geom.*;
|
import io.anuke.arc.math.geom.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
|
import io.anuke.arc.util.ArcAnnotate.*;
|
||||||
import io.anuke.mindustry.entities.type.*;
|
import io.anuke.mindustry.entities.type.*;
|
||||||
import io.anuke.mindustry.graphics.*;
|
import io.anuke.mindustry.graphics.*;
|
||||||
import io.anuke.mindustry.ui.*;
|
import io.anuke.mindustry.ui.*;
|
||||||
@@ -302,7 +303,8 @@ public class PowerNode extends PowerBlock{
|
|||||||
return overlaps(src.drawx(), src.drawy(), other, range);
|
return overlaps(src.drawx(), src.drawy(), other, range);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean overlaps(Tile src, Tile other){
|
public boolean overlaps(@Nullable Tile src, @Nullable Tile other){
|
||||||
|
if(src == null || other == null) return true;
|
||||||
return overlaps(src.drawx(), src.drawy(), other, laserRange * tilesize);
|
return overlaps(src.drawx(), src.drawy(), other, laserRange * tilesize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user