Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 280 Lines • ▼ Show 20 Lines | var g_Commands = { | ||||
"call-to-arms": function(player, cmd, data) | "call-to-arms": function(player, cmd, data) | ||||
{ | { | ||||
const unitsToMove = data.entities.filter(ent => | const unitsToMove = data.entities.filter(ent => | ||||
MatchesClassList(Engine.QueryInterface(ent, IID_Identity).GetClassesList(), | MatchesClassList(Engine.QueryInterface(ent, IID_Identity).GetClassesList(), | ||||
["Soldier", "Warship", "Siege", "Healer"]) | ["Soldier", "Warship", "Siege", "Healer"]) | ||||
); | ); | ||||
GetFormationUnitAIs(unitsToMove, player, cmd, data.formation).forEach(cmpUnitAI => { | GetFormationUnitAIs(unitsToMove, player, cmd, data.formation).forEach(cmpUnitAI => { | ||||
const target = cmd.target; | |||||
if (cmd.pushFront) | if (cmd.pushFront) | ||||
{ | { | ||||
cmpUnitAI.WalkAndFight(target.x, target.z, cmd.targetClasses, cmd.allowCapture, false, cmd.pushFront); | cmpUnitAI.WalkAndFight(cmd.position.x, cmd.position.z, cmd.targetClasses, cmd.allowCapture, false, cmd.pushFront); | ||||
cmpUnitAI.DropAtNearestDropSite(false, cmd.pushFront); | cmpUnitAI.DropAtNearestDropSite(false, cmd.pushFront); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
cmpUnitAI.DropAtNearestDropSite(cmd.queued, false) | cmpUnitAI.DropAtNearestDropSite(cmd.queued, false) | ||||
cmpUnitAI.WalkAndFight(target.x, target.z, cmd.targetClasses, cmd.allowCapture, true, false); | cmpUnitAI.WalkAndFight(cmd.position.x, cmd.position.z, cmd.targetClasses, cmd.allowCapture, true, false); | ||||
} | } | ||||
}); | }); | ||||
}, | }, | ||||
"remove-guard": function(player, cmd, data) | "remove-guard": function(player, cmd, data) | ||||
{ | { | ||||
for (let ent of data.entities) | for (let ent of data.entities) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 580 Lines • ▼ Show 20 Lines | var g_Commands = { | ||||
}, | }, | ||||
"map-flare": function(player, cmd, data) | "map-flare": function(player, cmd, data) | ||||
{ | { | ||||
let cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | let cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | ||||
cmpGuiInterface.PushNotification({ | cmpGuiInterface.PushNotification({ | ||||
"type": "map-flare", | "type": "map-flare", | ||||
"players": [player], | "players": [player], | ||||
"target": cmd.target | "position": cmd.position | ||||
}); | }); | ||||
}, | }, | ||||
"autoqueue-on": function(player, cmd, data) | "autoqueue-on": function(player, cmd, data) | ||||
{ | { | ||||
for (let ent of data.entities) | for (let ent of data.entities) | ||||
{ | { | ||||
let cmpProductionQueue = Engine.QueryInterface(ent, IID_ProductionQueue); | let cmpProductionQueue = Engine.QueryInterface(ent, IID_ProductionQueue); | ||||
▲ Show 20 Lines • Show All 945 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator