mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Fix walkthrough
This commit is contained in:
parent
f42959fd4d
commit
62610a0a5f
@ -273,6 +273,8 @@ public class RoomLayout {
|
||||
List<RoomTile> closedList = new LinkedList<>();
|
||||
openList.add(oldTile.copy());
|
||||
|
||||
RoomTile doorTile = this.room.getLayout().getDoorTile();
|
||||
|
||||
while (!openList.isEmpty()) {
|
||||
RoomTile current = this.lowestFInOpen(openList);
|
||||
if (current.x == newTile.x && current.y == newTile.y) {
|
||||
@ -301,9 +303,14 @@ public class RoomLayout {
|
||||
}
|
||||
|
||||
double height = currentAdj.getStackHeight() - current.getStackHeight();
|
||||
if (!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) continue;
|
||||
if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue;
|
||||
if (currentAdj.hasUnits() && ((!isWalktroughRetry && !this.room.isAllowWalkthrough()) || currentAdj.equals(goalLocation))) {
|
||||
|
||||
if ((!ALLOW_FALLING && height < -MAXIMUM_STEP_HEIGHT) || (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT)) {
|
||||
closedList.add(currentAdj);
|
||||
openList.remove(currentAdj);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (currentAdj.hasUnits() && doorTile.distance(currentAdj) > 2 && (!isWalktroughRetry || !this.room.isAllowWalkthrough() || currentAdj.equals(goalLocation))) {
|
||||
closedList.add(currentAdj);
|
||||
openList.remove(currentAdj);
|
||||
continue;
|
||||
@ -321,7 +328,7 @@ public class RoomLayout {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.room.isAllowWalkthrough() && isWalktroughRetry) {
|
||||
if (this.room.isAllowWalkthrough() && !isWalktroughRetry) {
|
||||
return this.findPath(oldTile, newTile, goalLocation, roomUnit, true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user