mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Pathfinding tweak / Doors now update pathfinding
This commit is contained in:
@ -39,6 +39,10 @@ public class Pathfinder{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateSolid(Tile tile){
|
||||||
|
update(tile, tile.getTeam());
|
||||||
|
}
|
||||||
|
|
||||||
public void update(){
|
public void update(){
|
||||||
if(Net.client() || paths == null) return;
|
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){
|
if(paths != null && paths[team.ordinal()] != null && paths[team.ordinal()].weights != null){
|
||||||
PathData path = paths[team.ordinal()];
|
PathData path = paths[team.ordinal()];
|
||||||
|
|
||||||
|
if(!path.frontier.isEmpty()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//impassable tiles have a weight of float.max
|
//impassable tiles have a weight of float.max
|
||||||
if(!passable(tile, team)){
|
if(!passable(tile, team)){
|
||||||
path.weights[tile.x][tile.y] = Float.MAX_VALUE;
|
path.weights[tile.x][tile.y] = Float.MAX_VALUE;
|
||||||
|
@ -16,6 +16,8 @@ import io.anuke.mindustry.world.Tile;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
|
import static io.anuke.mindustry.Vars.world;
|
||||||
|
|
||||||
public class Door extends Wall{
|
public class Door extends Wall{
|
||||||
protected final Rectangle rect = new Rectangle();
|
protected final Rectangle rect = new Rectangle();
|
||||||
|
|
||||||
@ -68,6 +70,7 @@ public class Door extends Wall{
|
|||||||
}
|
}
|
||||||
|
|
||||||
entity.open = !entity.open;
|
entity.open = !entity.open;
|
||||||
|
world.pathfinder.updateSolid(tile);
|
||||||
if(!entity.open){
|
if(!entity.open){
|
||||||
Effects.effect(closefx, tile.drawx(), tile.drawy());
|
Effects.effect(closefx, tile.drawx(), tile.drawy());
|
||||||
}else{
|
}else{
|
||||||
|
Reference in New Issue
Block a user