Fixed #6148
This commit is contained in:
@@ -13,6 +13,7 @@ import mindustry.game.EventType.*;
|
|||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.gen.*;
|
import mindustry.gen.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
import mindustry.world.blocks.environment.*;
|
||||||
import mindustry.world.blocks.storage.*;
|
import mindustry.world.blocks.storage.*;
|
||||||
import mindustry.world.meta.*;
|
import mindustry.world.meta.*;
|
||||||
|
|
||||||
@@ -40,7 +41,7 @@ public class Pathfinder implements Runnable{
|
|||||||
|
|
||||||
public static final Seq<PathCost> costTypes = Seq.with(
|
public static final Seq<PathCost> costTypes = Seq.with(
|
||||||
//ground
|
//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.health(tile) * 5 +
|
||||||
(PathTile.nearSolid(tile) ? 2 : 0) +
|
(PathTile.nearSolid(tile) ? 2 : 0) +
|
||||||
(PathTile.nearLiquid(tile) ? 6 : 0) +
|
(PathTile.nearLiquid(tile) ? 6 : 0) +
|
||||||
@@ -108,14 +109,16 @@ public class Pathfinder implements Runnable{
|
|||||||
|
|
||||||
/** Packs a tile into its internal representation. */
|
/** Packs a tile into its internal representation. */
|
||||||
private int packTile(Tile tile){
|
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++){
|
for(int i = 0; i < 4; i++){
|
||||||
Tile other = tile.nearby(i);
|
Tile other = tile.nearby(i);
|
||||||
if(other != null){
|
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.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,
|
nearGround,
|
||||||
nearSolid,
|
nearSolid,
|
||||||
tile.floor().isDeep(),
|
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;
|
boolean deep;
|
||||||
//whether the floor damages
|
//whether the floor damages
|
||||||
boolean damages;
|
boolean damages;
|
||||||
|
//whether all tiles nearby are deep
|
||||||
|
boolean allDeep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user