v2.0.0: fixed ignoreSoftSolid rarely overriding stopTarget or stopChars

This commit is contained in:
Evan Debenham
2022-11-15 15:25:46 -05:00
parent 607cdb7d4e
commit 56f34f9c76

View File

@@ -116,7 +116,8 @@ public class Ballistica {
//if we're in solid terrain, and there's no char there, collide with the previous cell.
// we don't use solid here because we don't want to stop short of closed doors.
if (stopTerrain
if (collisionPos == null
&& stopTerrain
&& cell != sourcePos
&& !Dungeon.level.passable[cell]
&& !Dungeon.level.avoid[cell]
@@ -126,15 +127,17 @@ public class Ballistica {
path.add(cell);
if (stopTerrain && cell != sourcePos && Dungeon.level.solid[cell]) {
if (collisionPos == null && stopTerrain && cell != sourcePos && Dungeon.level.solid[cell]) {
if (ignoreSoftSolid && (Dungeon.level.passable[cell] || Dungeon.level.avoid[cell])) {
//do nothing
} else {
collide(cell);
}
} else if (cell != sourcePos && stopChars && Actor.findChar( cell ) != null) {
}
if (collisionPos == null && cell != sourcePos && stopChars && Actor.findChar( cell ) != null) {
collide(cell);
} else if (cell == to && stopTarget){
}
if (collisionPos == null && cell == to && stopTarget){
collide(cell);
}
@@ -150,8 +153,9 @@ public class Ballistica {
//we only want to record the first position collision occurs at.
private void collide(int cell){
if (collisionPos == null)
if (collisionPos == null) {
collisionPos = cell;
}
}
//returns a segment of the path from start to end, inclusive.