Pathfinding tweak / Doors now update pathfinding

This commit is contained in:
Anuken 2019-06-04 17:10:45 -04:00
parent fce69005a9
commit 0b49bd1985
2 changed files with 11 additions and 0 deletions

View File

@ -39,6 +39,10 @@ public class Pathfinder{
});
}
public void updateSolid(Tile tile){
update(tile, tile.getTeam());
}
public void update(){
if(Net.client() || paths == null) return;
@ -94,6 +98,10 @@ public class Pathfinder{
if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
PathData path = paths[team.ordinal()];
if(!path.frontier.isEmpty()){
return;
}
//impassable tiles have a weight of float.max
if(!passable(tile, team)){
path.weights[tile.x][tile.y] = Float.MAX_VALUE;

View File

@ -16,6 +16,8 @@ import io.anuke.mindustry.world.Tile;
import java.io.*;
import static io.anuke.mindustry.Vars.world;
public class Door extends Wall{
protected final Rectangle rect = new Rectangle();
@ -68,6 +70,7 @@ public class Door extends Wall{
}
entity.open = !entity.open;
world.pathfinder.updateSolid(tile);
if(!entity.open){
Effects.effect(closefx, tile.drawx(), tile.drawy());
}else{