Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 273 Lines • ▼ Show 20 Lines | "back-to-work": function(player, cmd, data) | ||||
for (let ent of data.entities) | for (let ent of data.entities) | ||||
{ | { | ||||
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | ||||
if(!cmpUnitAI || !cmpUnitAI.BackToWork()) | if(!cmpUnitAI || !cmpUnitAI.BackToWork()) | ||||
notifyBackToWorkFailure(player); | notifyBackToWorkFailure(player); | ||||
} | } | ||||
}, | }, | ||||
"call-to-arms": function(player, cmd, data) | |||||
{ | |||||
const unitsToMove = data.entities.filter(ent => | |||||
MatchesClassList(Engine.QueryInterface(ent, IID_Identity).GetClassesList(), | |||||
["Soldier", "Warship", "Siege", "Healer"]) | |||||
); | |||||
GetFormationUnitAIs(unitsToMove, player, cmd, data.formation).forEach(cmpUnitAI => { | |||||
const target = cmd.target; | |||||
if (cmd.pushFront) | |||||
{ | |||||
cmpUnitAI.WalkAndFight(target.x, target.z, cmd.targetClasses, cmd.allowCapture, false, cmd.pushFront); | |||||
cmpUnitAI.DropAtNearestDropSite(false, cmd.pushFront); | |||||
} | |||||
else | |||||
{ | |||||
cmpUnitAI.DropAtNearestDropSite(cmd.queued, false) | |||||
cmpUnitAI.WalkAndFight(target.x, target.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) | ||||
{ | { | ||||
var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | var cmpUnitAI = Engine.QueryInterface(ent, IID_UnitAI); | ||||
if (cmpUnitAI) | if (cmpUnitAI) | ||||
cmpUnitAI.RemoveGuard(); | cmpUnitAI.RemoveGuard(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,557 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator