Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 159 Lines • ▼ Show 20 Lines | for (let ent of data.entities) | ||||
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
cmpUnitAI.WalkToPointRange(cmd.x, cmd.z, cmd.min, cmd.max, cmd.queued); | cmpUnitAI.WalkToPointRange(cmd.x, cmd.z, cmd.min, cmd.max, cmd.queued); | ||||
} | } | ||||
}, | }, | ||||
"attack-walk": function(player, cmd, data) | "attack-walk": function(player, cmd, data) | ||||
{ | { | ||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | |||||
GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | ||||
cmpUnitAI.WalkAndFight(cmd.x, cmd.z, cmd.targetClasses, cmd.queued); | cmpUnitAI.WalkAndFight(cmd.x, cmd.z, cmd.targetClasses, allowCapture, cmd.queued); | ||||
}); | }); | ||||
}, | }, | ||||
"attack": function(player, cmd, data) | "attack": function(player, cmd, data) | ||||
{ | { | ||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | ||||
if (g_DebugCommands && !allowCapture && | if (g_DebugCommands && !allowCapture && | ||||
!(IsOwnedByEnemyOfPlayer(player, cmd.target) || IsOwnedByNeutralOfPlayer(player, cmd.target))) | !(IsOwnedByEnemyOfPlayer(player, cmd.target) || IsOwnedByNeutralOfPlayer(player, cmd.target))) | ||||
warn("Invalid command: attack target is not owned by enemy of player "+player+": "+uneval(cmd)); | warn("Invalid command: attack target is not owned by enemy of player "+player+": "+uneval(cmd)); | ||||
GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | ||||
cmpUnitAI.Attack(cmd.target, cmd.queued, allowCapture); | cmpUnitAI.Attack(cmd.target, allowCapture, cmd.queued); | ||||
}); | }); | ||||
}, | }, | ||||
"patrol": function(player, cmd, data) | "patrol": function(player, cmd, data) | ||||
{ | { | ||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | |||||
GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => | GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => | ||||
cmpUnitAI.Patrol(cmd.x, cmd.z, cmd.targetClasses, cmd.queued) | cmpUnitAI.Patrol(cmd.x, cmd.z, cmd.targetClasses, allowCapture, cmd.queued) | ||||
); | ); | ||||
}, | }, | ||||
"heal": function(player, cmd, data) | "heal": function(player, cmd, data) | ||||
{ | { | ||||
if (g_DebugCommands && !(IsOwnedByPlayer(player, cmd.target) || IsOwnedByAllyOfPlayer(player, cmd.target))) | if (g_DebugCommands && !(IsOwnedByPlayer(player, cmd.target) || IsOwnedByAllyOfPlayer(player, cmd.target))) | ||||
warn("Invalid command: heal target is not owned by player "+player+" or their ally: "+uneval(cmd)); | warn("Invalid command: heal target is not owned by player "+player+" or their ally: "+uneval(cmd)); | ||||
▲ Show 20 Lines • Show All 1,524 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator