Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 462 Lines • ▼ Show 20 Lines | var g_Commands = { | ||||
"resign": function(player, cmd, data) | "resign": function(player, cmd, data) | ||||
{ | { | ||||
data.cmpPlayer.SetState("defeated", markForTranslation("%(player)s has resigned.")); | data.cmpPlayer.SetState("defeated", markForTranslation("%(player)s has resigned.")); | ||||
}, | }, | ||||
"garrison": function(player, cmd, data) | "garrison": function(player, cmd, data) | ||||
{ | { | ||||
// Verify that the building can be controlled by the player or is mutualAlly | |||||
if (!CanControlUnitOrIsAlly(cmd.target, player, data.controlAllUnits)) | |||||
{ | |||||
if (g_DebugCommands) | |||||
warn("Invalid command: garrison target cannot be controlled by player "+player+" (or ally): "+uneval(cmd)); | |||||
return; | |||||
} | |||||
GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | GetFormationUnitAIs(data.entities, player).forEach(cmpUnitAI => { | ||||
cmpUnitAI.Garrison(cmd.target, cmd.queued); | cmpUnitAI.Garrison(cmd.target, cmd.queued); | ||||
}); | }); | ||||
}, | }, | ||||
"guard": function(player, cmd, data) | "guard": function(player, cmd, data) | ||||
{ | { | ||||
// Verify that the target can be controlled by the player or is mutualAlly | // Verify that the target can be controlled by the player or is mutualAlly | ||||
▲ Show 20 Lines • Show All 1,240 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator