Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show All 39 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "walk", | "type": "walk", | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"x": target.x, | |||||
"z": target.z, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_walk", | "name": "order_walk", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 24 Lines | "execute": function(target, action, selection, queued) | ||||
"type": "attack-walk", | "type": "attack-walk", | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"targetClasses": targetClasses, | "targetClasses": targetClasses, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"x": target.x, | |||||
"z": target.z, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_walk", | "name": "order_walk", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 22 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "attack", | "type": "attack", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"allowCapture": true, | "allowCapture": true, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_attack", | "name": "order_attack", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 30 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "attack", | "type": "attack", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued, | "queued": queued, | ||||
"allowCapture": false | "allowCapture": false | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", | |||||
{ | |||||
"entities": selection, | |||||
"x": target.x, | |||||
"z": target.z, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_attack", | "name": "order_attack", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | "execute": function(target, action, selection, queued) | ||||
"entities": selection, | "entities": selection, | ||||
"x": target.x, | "x": target.x, | ||||
"z": target.z, | "z": target.z, | ||||
"target": action.target, | "target": action.target, | ||||
"targetClasses": { "attack": g_PatrolTargets }, | "targetClasses": { "attack": g_PatrolTargets }, | ||||
"queued": queued, | "queued": queued, | ||||
"allowCapture": false | "allowCapture": false | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"x": target.x, | |||||
"z": target.z, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { "name": "order_patrol", "entity": selection[0] }); | Engine.GuiInterfaceCall("PlaySound", { "name": "order_patrol", "entity": selection[0] }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
{ | { | ||||
if (!entState.unitAI || !entState.unitAI.canPatrol) | if (!entState.unitAI || !entState.unitAI.canPatrol) | ||||
return false; | return false; | ||||
return { "possible": true }; | return { "possible": true }; | ||||
}, | }, | ||||
"hotkeyActionCheck": function(target, selection) | "hotkeyActionCheck": function(target, selection) | ||||
{ | { | ||||
if (!someCanPatrol(selection) || | if (!someCanPatrol(selection) || | ||||
!Engine.HotkeyIsPressed("session.patrol") || | !Engine.HotkeyIsPressed("session.patrol") || | ||||
!getActionInfo("patrol", target).possible) | !getActionInfo("patrol", target).possible) | ||||
return false; | return false; | ||||
return { | return { | ||||
"type": "patrol", | "type": "patrol", | ||||
"cursor": "action-patrol", | "cursor": "action-patrol", | ||||
"target": target | "x": target.x, | ||||
"z": target.z, | |||||
}; | }; | ||||
}, | }, | ||||
"preSelectedActionCheck" : function(target) | "preSelectedActionCheck" : function(target) | ||||
{ | { | ||||
if (preSelectedAction != ACTION_PATROL || !getActionInfo("patrol", target).possible) | if (preSelectedAction != ACTION_PATROL || !getActionInfo("patrol", target).possible) | ||||
return false; | return false; | ||||
return { | return { | ||||
"type": "patrol", | "type": "patrol", | ||||
Show All 10 Lines | "heal": | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "heal", | "type": "heal", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_heal", | "name": "order_heal", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 35 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "repair", | "type": "repair", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"autocontinue": true, | "autocontinue": true, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_repair", | "name": "order_repair", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 25 Lines | "execute": function(target, action, selection, queued) | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "repair", | "type": "repair", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"autocontinue": true, | "autocontinue": true, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_repair", | "name": "order_repair", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | "gather": | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "gather", | "type": "gather", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_gather", | "name": "order_gather", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
Show All 32 Lines | "returnresource": | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "returnresource", | "type": "returnresource", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_gather", | "name": "order_gather", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | "execute": function(target, action, selection, queued) | ||||
"type": "setup-trade-route", | "type": "setup-trade-route", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"source": null, | "source": null, | ||||
"route": null, | "route": null, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_trade", | "name": "order_trade", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | "garrison": | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "garrison", | "type": "garrison", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("DisplayWayPoint", { | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_garrison", | "name": "order_garrison", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
▲ Show 20 Lines • Show All 829 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator