Reporting townspeople should send the guard to the player's last known location
This commit is contained in:
@@ -377,12 +377,27 @@ var AISprite = function(game, x, y, key, frame) {
|
||||
|
||||
this.action_chaseplayer = function()
|
||||
{
|
||||
if ( this.path.length > 1 &&
|
||||
this.path_index >= this.path.length &&
|
||||
hasState(this, STATE_RUNNINGTOREPORT) ) {
|
||||
delState(this, STATE_RUNNINGTOREPORT);
|
||||
this.target = player;
|
||||
}
|
||||
if ( hasState(this, STATE_RUNNINGTOREPORT) ) {
|
||||
this.chasetarget(this.target,
|
||||
STATE_ALERTED,
|
||||
STATE_MOVING | STATE_RUNNING,
|
||||
true,
|
||||
1000,
|
||||
false);
|
||||
} else {
|
||||
this.chasetarget(player,
|
||||
STATE_ALERTED,
|
||||
STATE_MOVING | STATE_RUNNING,
|
||||
true,
|
||||
undefined,
|
||||
false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -394,6 +409,10 @@ var AISprite = function(game, x, y, key, frame) {
|
||||
var aiSprites = game.state.states.game.aiSprites;
|
||||
this.target = nearestInGroup(this, aiSprites, "townsfolk-guard");
|
||||
} else if ( hasState(this, STATE_RUNNINGTOLIGHT) == false ) {
|
||||
this.target.setAwarenessState(STATE_ALERTED);
|
||||
this.target.target = this.lastSawPlayerAt
|
||||
addState(this.target, STATE_RUNNINGTOREPORT);
|
||||
|
||||
this.path_tween_stop();
|
||||
this.path_purge();
|
||||
var staticLights = game.state.states.game.staticLights;
|
||||
|
||||
@@ -21,6 +21,7 @@ STATE_FACE_DOWN = 1 << 9;
|
||||
STATE_MOVING = 1 << 10;
|
||||
|
||||
STATE_RUNNINGTOLIGHT = 1 << 11;
|
||||
STATE_RUNNINGTOREPORT = 1 << 12;
|
||||
|
||||
STATES_AWARENESS = (STATE_UNAWARE | STATE_CONCERNED | STATE_ALERTED | STATE_LOSTHIM);
|
||||
STATES_MOVEMENT = (STATE_MOVING | STATE_RUNNING);
|
||||
|
||||
Reference in New Issue
Block a user