Unify duplicate patrol target types hardcodings. Reviewed by fatherbushido long ago, refs #4253.

This was SVN commit r18983.
This commit is contained in:
elexis 2016-11-22 12:46:46 +00:00
parent c390dee14c
commit 0b03713b3b
3 changed files with 9 additions and 4 deletions

View File

@ -210,7 +210,7 @@ function getActionInfo(action, target)
else if (Engine.HotkeyIsPressed("session.patrol"))
{
data.command = "patrol";
data.targetClasses = { "attack": ["Unit"] };
data.targetClasses = { "attack": g_PatrolTargets };
cursor = "action-patrol";
}
return { "possible": true, "data": data, "cursor": cursor };

View File

@ -1,3 +1,8 @@
/**
* Which enemy entity types will be attacked on sight when patroling.
*/
var g_PatrolTargets = ["Unit"];
/**
* List of different actions units can execute,
* this is mostly used to determine which actions can be executed
@ -218,7 +223,7 @@ var unitActions =
"x": target.x,
"z": target.z,
"target": action.target,
"targetClasses": { "attack": ["Unit"] }, // patrol should only attack units
"targetClasses": { "attack": g_PatrolTargets },
"queued": queued,
"allowCapture": false
});

View File

@ -1115,7 +1115,7 @@ UnitAI.prototype.UnitFsmSpec = {
if (!this.patrolStartPosOrder)
{
this.patrolStartPosOrder = cmpPosition.GetPosition();
this.patrolStartPosOrder.targetClasses = { "attack": ["Unit"] };
this.patrolStartPosOrder.targetClasses = this.order.data.targetClasses;
}
this.StartTimer(0, 1000);
@ -1645,7 +1645,7 @@ UnitAI.prototype.UnitFsmSpec = {
if (!this.patrolStartPosOrder)
{
this.patrolStartPosOrder = cmpPosition.GetPosition();
this.patrolStartPosOrder.targetClasses = { "attack": ["Unit"] };
this.patrolStartPosOrder.targetClasses = this.order.data.targetClasses;
}
this.StartTimer(0, 1000);