Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 157 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, allowCapture, cmd.queued); | cmpUnitAI.WalkAndFight( | ||||
cmd.x, | |||||
cmd.z, | |||||
cmd.targetClasses, | |||||
cmd.ignoreAttackEffects || {}, | |||||
cmd.prefAttackTypes || [], | |||||
cmd.rangeFactor !== undefined ? cmd.rangeFactor : 1, | |||||
cmd.queued); | |||||
}); | }); | ||||
}, | }, | ||||
"attack-walk-custom": function(player, cmd, data) | "attack-walk-custom": function(player, cmd, data) | ||||
{ | { | ||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | |||||
for (let ent in data.entities) | for (let ent in data.entities) | ||||
GetFormationUnitAIs([data.entities[ent]], player).forEach(cmpUnitAI => { | GetFormationUnitAIs([data.entities[ent]], player).forEach(cmpUnitAI => { | ||||
cmpUnitAI.WalkAndFight(cmd.targetPositions[ent].x, cmd.targetPositions[ent].y, cmd.targetClasses, allowCapture, cmd.queued); | cmpUnitAI.WalkAndFight( | ||||
cmd.targetPositions[ent].x, | |||||
cmd.targetPositions[ent].y, | |||||
cmd.targetClasses, | |||||
cmd.ignoreAttackEffects || {}, | |||||
cmd.prefAttackTypes || [], | |||||
cmd.projectile || undefined, | |||||
cmd.queued); | |||||
}); | }); | ||||
}, | }, | ||||
"attack": function(player, cmd, data) | "attack": function(player, cmd, data) | ||||
{ | { | ||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | |||||
if (g_DebugCommands && !allowCapture && | |||||
!(IsOwnedByEnemyOfPlayer(player, cmd.target) || IsOwnedByNeutralOfPlayer(player, cmd.target))) | |||||
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, allowCapture, cmd.queued); | cmpUnitAI.Attack( | ||||
cmd.target, | |||||
cmd.ignoreAttackEffects || {}, | |||||
cmd.prefAttackTypes || [], | |||||
cmd.projectile || undefined, | |||||
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, allowCapture, cmd.queued) | cmpUnitAI.Patrol( | ||||
cmd.x, | |||||
cmd.z, | |||||
cmd.targetClasses, | |||||
cmd.ignoreAttackEffects || {}, | |||||
cmd.prefAttackTypes || [], | |||||
cmd.projectile || undefined, | |||||
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,551 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator