mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Pathfinding tweak / Doors now update pathfinding
This commit is contained in:
parent
fce69005a9
commit
0b49bd1985
@ -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;
|
||||
|
@ -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{
|
||||
|
Loading…
Reference in New Issue
Block a user