Pass template to gather-near-position. Fixes #1454.
Add order_trade sound. This was SVN commit r11921.
This commit is contained in:
parent
f2e6194440
commit
636896dd7f
@ -195,22 +195,22 @@ function getActionInfo(action, target)
|
||||
// Check if any entities in the selection can gather the requested resource,
|
||||
// can return to the dropsite, can build the foundation, or can attack the enemy
|
||||
var simState = Engine.GuiInterfaceCall("GetSimulationState");
|
||||
|
||||
|
||||
// Look to see what type of command units going to the rally point should use
|
||||
if (haveRallyPoints && action == "set-rallypoint")
|
||||
{
|
||||
// haveRallyPoints ensures all selected entities can have rally points.
|
||||
// We assume that all entities are owned by the same player.
|
||||
var entState = GetEntityState(selection[0]);
|
||||
|
||||
|
||||
var playerState = simState.players[entState.player];
|
||||
var playerOwned = (targetState.player == entState.player);
|
||||
var allyOwned = playerState.isAlly[targetState.player];
|
||||
var enemyOwned = playerState.isEnemy[targetState.player];
|
||||
var gaiaOwned = (targetState.player == 0);
|
||||
|
||||
|
||||
var cursor = "";
|
||||
|
||||
|
||||
// default to walking there
|
||||
var data = {command: "walk"};
|
||||
if (targetState.garrisonHolder && playerOwned)
|
||||
@ -240,6 +240,7 @@ function getActionInfo(action, target)
|
||||
}
|
||||
data.command = "gather";
|
||||
data.resourceType = resourceType;
|
||||
data.resourceTemplate = targetState.template;
|
||||
}
|
||||
else if (targetState.foundation && entState.buildEntities)
|
||||
{
|
||||
@ -1293,6 +1294,7 @@ function doAction(action, ev)
|
||||
|
||||
case "setup-trade-route":
|
||||
Engine.PostNetworkCommand({"type": "setup-trade-route", "entities": selection, "target": action.target});
|
||||
Engine.GuiInterfaceCall("PlaySound", { "name": "order_trade", "entity": selection[0] });
|
||||
return true;
|
||||
|
||||
case "garrison":
|
||||
|
@ -2875,9 +2875,9 @@ UnitAI.prototype.PerformGather = function(target, queued, force)
|
||||
* Adds gather-near-position order to the queue, not forced, so it can be
|
||||
* interrupted by attacks.
|
||||
*/
|
||||
UnitAI.prototype.GatherNearPosition = function(x, z, type, queued)
|
||||
UnitAI.prototype.GatherNearPosition = function(x, z, type, template, queued)
|
||||
{
|
||||
this.AddOrder("GatherNearPosition", { "type": type, "x": x, "z": z, "force": false }, queued);
|
||||
this.AddOrder("GatherNearPosition", { "type": type, "template": template, "x": x, "z": z, "force": false }, queued);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ function ProcessCommand(player, cmd)
|
||||
case "gather-near-position":
|
||||
var entities = FilterEntityList(cmd.entities, player, controlAllUnits);
|
||||
GetFormationUnitAIs(entities, player).forEach(function(cmpUnitAI) {
|
||||
cmpUnitAI.GatherNearPosition(cmd.x, cmd.z, cmd.resourceType, cmd.queued);
|
||||
cmpUnitAI.GatherNearPosition(cmd.x, cmd.z, cmd.resourceType, cmd.resourceTemplate, cmd.queued);
|
||||
});
|
||||
break;
|
||||
|
||||
|
@ -38,6 +38,7 @@ function GetRallyPointCommands(cmpRallyPoint, spawnedEnts)
|
||||
"x": rallyPos[i].x,
|
||||
"z": rallyPos[i].z,
|
||||
"resourceType": data[i].resourceType,
|
||||
"resourceTemplate": data[i].resourceTemplate,
|
||||
"queued": true
|
||||
});
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user