Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 797 Lines • ▼ Show 20 Lines | "actionCheck": function(target, selection) | ||||
"cursor": "action-guard", | "cursor": "action-guard", | ||||
"target": target, | "target": target, | ||||
"firstAbleEntity": actionInfo.entity | "firstAbleEntity": actionInfo.entity | ||||
}; | }; | ||||
}, | }, | ||||
"specificness": 40, | "specificness": 40, | ||||
}, | }, | ||||
"collect-treasure": | |||||
{ | |||||
"execute": function(target, action, selection, queued) | |||||
{ | |||||
Engine.PostNetworkCommand({ | |||||
"type": "collect-treasure", | |||||
"entities": selection, | |||||
"target": action.target, | |||||
"queued": queued, | |||||
"formation": g_AutoFormation.getNull() | |||||
}); | |||||
Engine.GuiInterfaceCall("PlaySound", { | |||||
"name": "order_collect_treasure", | |||||
"entity": action.firstAbleEntity | |||||
}); | |||||
return true; | |||||
}, | |||||
"getActionInfo": function(entState, targetState) | |||||
{ | |||||
if (!entState.treasureCollecter || | |||||
!targetState || !targetState.treasure) | |||||
return false; | |||||
return { | |||||
"possible": true, | |||||
"cursor": "action-collect-treasure" | |||||
}; | |||||
}, | |||||
"actionCheck": function(target, selection) | |||||
{ | |||||
let actionInfo = getActionInfo("collect-treasure", target, selection); | |||||
return actionInfo.possible && { | |||||
"type": "collect-treasure", | |||||
"cursor": actionInfo.cursor, | |||||
"target": target, | |||||
"firstAbleEntity": actionInfo.entity | |||||
}; | |||||
}, | |||||
"specificness": 1, | |||||
}, | |||||
"remove-guard": | "remove-guard": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "remove-guard", | "type": "remove-guard", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | "getActionInfo": function(entState, targetState) | ||||
if (targetState.garrisonHolder.garrisonedEntitiesCount >= | if (targetState.garrisonHolder.garrisonedEntitiesCount >= | ||||
targetState.garrisonHolder.capacity) | targetState.garrisonHolder.capacity) | ||||
tooltip = coloredText(tooltip, "orange"); | tooltip = coloredText(tooltip, "orange"); | ||||
} | } | ||||
else if (targetState && targetState.resourceSupply) | else if (targetState && targetState.resourceSupply) | ||||
{ | { | ||||
let resourceType = targetState.resourceSupply.type; | let resourceType = targetState.resourceSupply.type; | ||||
if (resourceType.generic == "treasure") | |||||
cursor = "action-gather-" + resourceType.generic; | |||||
else | |||||
cursor = "action-gather-" + resourceType.specific; | cursor = "action-gather-" + resourceType.specific; | ||||
data.command = "gather-near-position"; | data.command = "gather-near-position"; | ||||
data.resourceType = resourceType; | data.resourceType = resourceType; | ||||
data.resourceTemplate = targetState.template; | data.resourceTemplate = targetState.template; | ||||
if (!targetState.speed) | if (!targetState.speed) | ||||
{ | { | ||||
data.command = "gather"; | data.command = "gather"; | ||||
data.target = targetState.id; | data.target = targetState.id; | ||||
▲ Show 20 Lines • Show All 683 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator