Guards don't contact the player anymore and people continue chasing the guards
This commit is contained in:
@@ -224,7 +224,8 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
this.path_index = 0;
|
this.path_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.path_set = function(target, force, maxsteps) {
|
this.path_set = function(target, force, maxsteps, useNearestWalkable) {
|
||||||
|
useNearestWalkable = (typeof useNearestWalkable == 'undefined' ? true : useNearestWalkable);
|
||||||
maxsteps = (typeof maxsteps == undefined ? maxsteps : this.path_maximum_steps);
|
maxsteps = (typeof maxsteps == undefined ? maxsteps : this.path_maximum_steps);
|
||||||
force = ( typeof force == undefined ? false : force );
|
force = ( typeof force == undefined ? false : force );
|
||||||
if ( force == false &&
|
if ( force == false &&
|
||||||
@@ -233,7 +234,11 @@ var AISprite = function(game, x, y, key, frame) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.path_purge();
|
this.path_purge();
|
||||||
|
if ( useNearestWalkable == true ) {
|
||||||
var pos = nearestWalkableTile(target);
|
var pos = nearestWalkableTile(target);
|
||||||
|
} else {
|
||||||
|
var pos = [parseInt(target.x/32), parseInt(target.y/32)];
|
||||||
|
}
|
||||||
tpath = pathfinder.findPath(
|
tpath = pathfinder.findPath(
|
||||||
parseInt(this.x/32),
|
parseInt(this.x/32),
|
||||||
parseInt(this.y/32),
|
parseInt(this.y/32),
|
||||||
|
|||||||
Reference in New Issue
Block a user