Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | "execute": function(target, action, selection, queued) | ||||
"type": "repair", | "type": "repair", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"autocontinue": true, | "autocontinue": true, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Engine.GuiInterfaceCall("PlaySound", { | Engine.GuiInterfaceCall("PlaySound", { | ||||
"name": "order_repair", | "name": action.foundation ? "order_build" : "order_repair", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
{ | { | ||||
if (!entState.builder || | if (!entState.builder || | ||||
!targetState.needsRepair && !targetState.foundation || | !targetState.needsRepair && !targetState.foundation || | ||||
!playerCheck(entState, targetState, ["Player", "Ally"])) | !playerCheck(entState, targetState, ["Player", "Ally"])) | ||||
return false; | return false; | ||||
return { "possible": true }; | return { | ||||
"possible": true, | |||||
"foundation": targetState.foundation | |||||
}; | |||||
}, | }, | ||||
"preSelectedActionCheck": function(target, selection) | "preSelectedActionCheck": function(target, selection) | ||||
{ | { | ||||
if (preSelectedAction != ACTION_REPAIR) | if (preSelectedAction != ACTION_REPAIR) | ||||
return false; | return false; | ||||
if (getActionInfo("repair", target, selection).possible) | let actionInfo = getActionInfo("repair", target, selection); | ||||
if (actionInfo.possible) | |||||
return { | return { | ||||
"type": "repair", | "type": "repair", | ||||
"cursor": "action-repair", | "cursor": "action-repair", | ||||
"target": target | "target": target, | ||||
"foundation": actionInfo.foundation | |||||
}; | }; | ||||
return { | return { | ||||
"type": "none", | "type": "none", | ||||
"cursor": "action-repair-disabled", | "cursor": "action-repair-disabled", | ||||
"target": null | "target": null | ||||
}; | }; | ||||
}, | }, | ||||
"hotkeyActionCheck": function(target, selection) | "hotkeyActionCheck": function(target, selection) | ||||
{ | { | ||||
let actionInfo = getActionInfo("repair", target, selection); | |||||
if (!Engine.HotkeyIsPressed("session.repair") || | if (!Engine.HotkeyIsPressed("session.repair") || | ||||
!getActionInfo("repair", target, selection).possible) | !actionInfo.possible) | ||||
return false; | return false; | ||||
return { | return { | ||||
"type": "repair", | "type": "repair", | ||||
"cursor": "action-repair", | "cursor": "action-repair", | ||||
"target": target | "target": target, | ||||
"foundation": actionInfo.foundation | |||||
}; | }; | ||||
}, | }, | ||||
"actionCheck": function(target, selection) | "actionCheck": function(target, selection) | ||||
{ | { | ||||
if (!getActionInfo("repair", target, selection).possible) | let actionInfo = getActionInfo("repair", target, selection); | ||||
if (!actionInfo.possible) | |||||
return false; | return false; | ||||
return { | return { | ||||
"type": "repair", | "type": "repair", | ||||
"cursor": "action-repair", | "cursor": "action-repair", | ||||
"target": target | "target": target, | ||||
"foundation": actionInfo.foundation | |||||
}; | }; | ||||
}, | }, | ||||
"specificness": 11, | "specificness": 11, | ||||
}, | }, | ||||
"gather": | "gather": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
▲ Show 20 Lines • Show All 1,138 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator