mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-19 07:56:26 +01:00
Do not cancel navigation if overriding path is non-existent
This commit is contained in:
parent
4389d7e18f
commit
b87cbd398b
@ -317,7 +317,7 @@ public class RoomLayout {
|
|||||||
return this.findPath(oldTile, newTile, goalLocation, roomUnit, true);
|
return this.findPath(oldTile, newTile, goalLocation, roomUnit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LinkedList<>();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RoomTile findTile(List<RoomTile> tiles, short x, short y) {
|
private RoomTile findTile(List<RoomTile> tiles, short x, short y) {
|
||||||
|
@ -177,6 +177,9 @@ public class RoomUnit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Deque<RoomTile> peekPath = room.getLayout().findPath(this.currentLocation, this.path.peek(), this.goalLocation, this);
|
Deque<RoomTile> peekPath = room.getLayout().findPath(this.currentLocation, this.path.peek(), this.goalLocation, this);
|
||||||
|
|
||||||
|
if (peekPath == null) peekPath = new LinkedList<>();
|
||||||
|
|
||||||
if (peekPath.size() >= 3) {
|
if (peekPath.size() >= 3) {
|
||||||
if (path.isEmpty()) return true;
|
if (path.isEmpty()) return true;
|
||||||
|
|
||||||
@ -543,10 +546,9 @@ public class RoomUnit {
|
|||||||
|
|
||||||
public void findPath()
|
public void findPath()
|
||||||
{
|
{
|
||||||
if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation)))
|
if (this.room != null && this.room.getLayout() != null && this.goalLocation != null && (this.goalLocation.isWalkable() || this.room.canSitOrLayAt(this.goalLocation.x, this.goalLocation.y) || this.canOverrideTile(this.goalLocation))) {
|
||||||
{
|
Deque<RoomTile> path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation, this);
|
||||||
|
if (path != null) this.path = path;
|
||||||
this.path = this.room.getLayout().findPath(this.currentLocation, this.goalLocation, this.goalLocation, this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user