Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
Show First 20 Lines • Show All 742 Lines • ▼ Show 20 Lines | "attack-request": function(player, cmd, data) | ||||
}); | }); | ||||
// And send an attackRequest event to the AIs | // And send an attackRequest event to the AIs | ||||
let cmpAIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIInterface); | let cmpAIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_AIInterface); | ||||
if (cmpAIInterface) | if (cmpAIInterface) | ||||
cmpAIInterface.PushEvent("AttackRequest", cmd); | cmpAIInterface.PushEvent("AttackRequest", cmd); | ||||
}, | }, | ||||
"spy-request": function(player, cmd, data) | |||||
{ | |||||
let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); | |||||
let ents = cmpRangeManager.GetEntitiesByPlayer(cmd.player).filter(ent => { | |||||
let cmpVisionSharing = Engine.QueryInterface(ent, IID_VisionSharing); | |||||
return cmpVisionSharing && cmpVisionSharing.IsBribable() && !cmpVisionSharing.ShareVisionWith(player); | |||||
}); | |||||
let ent = pickRandom(ents); | |||||
if (ent) | |||||
Engine.QueryInterface(ent, IID_VisionSharing).AddSpy(cmd.source); | |||||
else | |||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface).PushNotification({ | |||||
"type": "text", | |||||
"players": [player], | |||||
"message": markForTranslation("There are no bribable units"), | |||||
"translateMessage": true | |||||
}); | |||||
}, | |||||
"dialog-answer": function(player, cmd, data) | "dialog-answer": function(player, cmd, data) | ||||
{ | { | ||||
// Currently nothing. Triggers can read it anyway, and send this | // Currently nothing. Triggers can read it anyway, and send this | ||||
// message to any component you like. | // message to any component you like. | ||||
}, | }, | ||||
"set-dropsite-sharing": function(player, cmd, data) | "set-dropsite-sharing": function(player, cmd, data) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 873 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator