This commit is contained in:
Anuken
2021-10-13 19:35:04 -04:00
parent 1f1a5bde3e
commit a2f40a5565

View File

@@ -13,6 +13,7 @@ import mindustry.game.EventType.*;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
import mindustry.world.blocks.storage.*;
import mindustry.world.meta.*;
@@ -40,7 +41,7 @@ public class Pathfinder implements Runnable{
public static final Seq<PathCost> costTypes = Seq.with(
//ground
(team, tile) -> (PathTile.team(tile) == team.id || PathTile.team(tile) == 0) && PathTile.solid(tile) ? impassable : 1 +
(team, tile) -> (PathTile.allDeep(tile) || (PathTile.team(tile) == team.id || PathTile.team(tile) == 0) && PathTile.solid(tile)) ? impassable : 1 +
PathTile.health(tile) * 5 +
(PathTile.nearSolid(tile) ? 2 : 0) +
(PathTile.nearLiquid(tile) ? 6 : 0) +
@@ -108,14 +109,16 @@ public class Pathfinder implements Runnable{
/** Packs a tile into its internal representation. */
private int packTile(Tile tile){
boolean nearLiquid = false, nearSolid = false, nearGround = false, solid = tile.solid();
boolean nearLiquid = false, nearSolid = false, nearGround = false, solid = tile.solid(), allDeep = tile.floor().isDeep();
for(int i = 0; i < 4; i++){
Tile other = tile.nearby(i);
if(other != null){
if(other.floor().isLiquid) nearLiquid = true;
Floor floor = other.floor();
if(floor.isLiquid) nearLiquid = true;
if(other.solid()) nearSolid = true;
if(!other.floor().isLiquid) nearGround = true;
if(!floor.isLiquid) nearGround = true;
if(!floor.isDeep()) allDeep = false;
}
}
@@ -131,7 +134,8 @@ public class Pathfinder implements Runnable{
nearGround,
nearSolid,
tile.floor().isDeep(),
tile.floor().damageTaken > 0.00001f
tile.floor().damageTaken > 0.00001f,
allDeep
);
}
@@ -494,5 +498,7 @@ public class Pathfinder implements Runnable{
boolean deep;
//whether the floor damages
boolean damages;
//whether all tiles nearby are deep
boolean allDeep;
}
}