Ground units: Avoid stepping onto dangerous/deep floor
This commit is contained in:
@@ -292,7 +292,7 @@ public class Pathfinder implements Runnable{
|
||||
}
|
||||
}
|
||||
|
||||
if(current == null || tl == impassable) return tile;
|
||||
if(current == null || tl == impassable || (path.cost == costTypes.items[costGround] && current.dangerous() && !tile.dangerous())) return tile;
|
||||
|
||||
return current;
|
||||
}
|
||||
|
||||
@@ -378,6 +378,11 @@ public class Tile implements Position, QuadTreeObject, Displayable{
|
||||
return block.destructible || block.breakable || block.update;
|
||||
}
|
||||
|
||||
/** @return whether the floor on this tile deals damage or can be drowned on. */
|
||||
public boolean dangerous(){
|
||||
return !block.solid && (floor.isDeep() || floor.damageTaken > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates through the list of all tiles linked to this multiblock, or just itself if it's not a multiblock.
|
||||
* The result contains all linked tiles, including this tile itself.
|
||||
|
||||
Reference in New Issue
Block a user