1
0
forked from 0ad/0ad

complete 2f1d143dc2 for moveAttack in rallyPoint + some cleaning

This was SVN commit r15682.
This commit is contained in:
mimo 2014-08-26 19:35:43 +00:00
parent ea78d97989
commit b2d07d5e5a
5 changed files with 16 additions and 5 deletions

View File

@ -278,7 +278,7 @@ hotkey.session.kill = Delete ; Destroy selected units
hotkey.session.stop = "H" ; Stop the current action
hotkey.session.attack = "Ctrl+Alt" ; Modifier to force attack instead of another action
hotkey.session.attackmove = Ctrl ; Modifier to attackmove when clicking on a point
hotkey.session.attackmoveUnit = "Ctrl+Q" ; Modifier to attackmove targeting only units when clicking on a point
hotkey.session.attackmoveUnit = "Ctrl+Q" ; Modifier to attackmove targeting only units when clicking on a point (should contain the attackmove keys)
hotkey.session.garrison = Ctrl ; Modifier to garrison when clicking on building
hotkey.session.autorallypoint = Ctrl ; Modifier to set the rally point on the building itself
hotkey.session.guard = "G" ; Modifier to escort/guard when clicking on unit/building

View File

@ -207,7 +207,12 @@ function getActionInfo(action, target)
var data = {command: "walk"};
if (Engine.HotkeyIsPressed("session.attackmove"))
{
data = {command: "attack-walk"};
if (Engine.HotkeyIsPressed("session.attackmoveUnit"))
var targetClasses = { "attack": ["Unit"] };
else
var targetClasses = { "attack": ["Unit", "Structure"] };
data.command = "attack-walk";
data.targetClasses = targetClasses;
cursor = "action-attack-move";
}
return {"possible": true, "data": data, "cursor": cursor};

View File

@ -470,7 +470,12 @@ var unitActions =
var cursor = "";
if (Engine.HotkeyIsPressed("session.attackmove"))
{
data = {command: "attack-walk"};
if (Engine.HotkeyIsPressed("session.attackmoveUnit"))
var targetClasses = { "attack": ["Unit"] };
else
var targetClasses = { "attack": ["Unit", "Structure"] };
data.command = "attack-walk";
data.targetClasses = targetClasses;
cursor = "action-attack-move";
}

View File

@ -5337,10 +5337,10 @@ UnitAI.prototype.FindWalkAndFightTargets = function()
if (!cmpUnitAI.CanAttack(targ))
continue;
var cmpIdentity = Engine.QueryInterface(targ, IID_Identity);
if (cmpIdentity && this.order.data.targetClasses.attack
if (this.order.data.targetClasses.attack && cmpIdentity
&& !MatchesClassList(cmpIdentity.GetClassesList(), this.order.data.targetClasses.attack))
continue;
if (cmpIdentity && this.order.data.targetClasses.avoid
if (this.order.data.targetClasses.avoid && cmpIdentity
&& MatchesClassList(cmpIdentity.GetClassesList(), this.order.data.targetClasses.avoid))
continue;
this.PushOrderFront("Attack", { "target": targ, "force": true });

View File

@ -66,6 +66,7 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
"entities": spawnedEnts,
"x": rallyPos[i].x,
"z": rallyPos[i].z,
"targetClasses": data[i].targetClasses,
"queued": true
});
break;