v2.0.0: fixed ignoreSoftSolid rarely overriding stopTarget or stopChars
This commit is contained in:
+9
-5
@@ -116,7 +116,8 @@ public class Ballistica {
|
|||||||
|
|
||||||
//if we're in solid terrain, and there's no char there, collide with the previous cell.
|
//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.
|
// 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
|
&& cell != sourcePos
|
||||||
&& !Dungeon.level.passable[cell]
|
&& !Dungeon.level.passable[cell]
|
||||||
&& !Dungeon.level.avoid[cell]
|
&& !Dungeon.level.avoid[cell]
|
||||||
@@ -126,15 +127,17 @@ public class Ballistica {
|
|||||||
|
|
||||||
path.add(cell);
|
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])) {
|
if (ignoreSoftSolid && (Dungeon.level.passable[cell] || Dungeon.level.avoid[cell])) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} else {
|
} else {
|
||||||
collide(cell);
|
collide(cell);
|
||||||
}
|
}
|
||||||
} else if (cell != sourcePos && stopChars && Actor.findChar( cell ) != null) {
|
}
|
||||||
|
if (collisionPos == null && cell != sourcePos && stopChars && Actor.findChar( cell ) != null) {
|
||||||
collide(cell);
|
collide(cell);
|
||||||
} else if (cell == to && stopTarget){
|
}
|
||||||
|
if (collisionPos == null && cell == to && stopTarget){
|
||||||
collide(cell);
|
collide(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -150,8 +153,9 @@ public class Ballistica {
|
|||||||
|
|
||||||
//we only want to record the first position collision occurs at.
|
//we only want to record the first position collision occurs at.
|
||||||
private void collide(int cell){
|
private void collide(int cell){
|
||||||
if (collisionPos == null)
|
if (collisionPos == null) {
|
||||||
collisionPos = cell;
|
collisionPos = cell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns a segment of the path from start to end, inclusive.
|
//returns a segment of the path from start to end, inclusive.
|
||||||
|
|||||||
Reference in New Issue
Block a user