Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | var g_Commands = { | ||||
{ | { | ||||
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, cmd.queued); | ||||
}); | }); | ||||
}, | }, | ||||
"attack": function(player, cmd, data) | "attack": function(player, cmd, data) | ||||
{ | { | ||||
if (g_DebugCommands && !(IsOwnedByEnemyOfPlayer(player, cmd.target) || IsOwnedByNeutralOfPlayer(player, cmd.target))) | |||||
warn("Invalid command: attack target is not owned by enemy of player "+player+": "+uneval(cmd)); | |||||
let allowCapture = cmd.allowCapture || cmd.allowCapture == null; | 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, cmd.queued, allowCapture); | cmpUnitAI.Attack(cmd.target, cmd.queued, allowCapture); | ||||
}); | }); | ||||
}, | }, | ||||
"patrol": function(player, cmd, data) | "patrol": function(player, cmd, data) | ||||
{ | { | ||||
GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => | GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => | ||||
▲ Show 20 Lines • Show All 1,498 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator