Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 539 Lines • ▼ Show 20 Lines | "actionCheck": function(target, selection) | ||||
"target": target | "target": target | ||||
}; | }; | ||||
}, | }, | ||||
"specificness": 2, | "specificness": 2, | ||||
}, | }, | ||||
"cancel-setup-trade-route": | "cancel-setup-trade-route": | ||||
{ | { | ||||
"execute":function(target, action, selection, queued) | "execute":function(target, action, selection, queued) | ||||
Lint: ESLintBear (key-spacing): `Missing space before value for key 'execute'.` | |||||
{ | { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "cancel-setup-trade-route", | "type": "cancel-setup-trade-route", | ||||
"entities": selection, | "entities": selection, | ||||
"target": action.target, | "target": action.target, | ||||
"queued": queued | "queued": queued | ||||
}); | }); | ||||
Show All 28 Lines | "actionCheck": function(target, selection) | ||||
if (!actionInfo.possible) | if (!actionInfo.possible) | ||||
return false; | return false; | ||||
return { | return { | ||||
"type": "cancel-setup-trade-route", | "type": "cancel-setup-trade-route", | ||||
"cursor": "action-cancel-setup-trade-route", | "cursor": "action-cancel-setup-trade-route", | ||||
"tooltip": actionInfo.tooltip, | "tooltip": actionInfo.tooltip, | ||||
"target": target | "target": target | ||||
} | } | ||||
Lint: ESLintBear (semi) Missing semicolon. Lint: ESLintBear (semi): `Missing semicolon.` | |||||
Lint: JSHintBear Missing semicolon. Lint: JSHintBear: `Missing semicolon.` | |||||
}, | }, | ||||
"specificness": 2, | "specificness": 2, | ||||
}, | }, | ||||
"setup-trade-route": | "setup-trade-route": | ||||
{ | { | ||||
"execute": function(target, action, selection, queued) | "execute": function(target, action, selection, queued) | ||||
{ | { | ||||
Show All 25 Lines | "getActionInfo": function(entState, targetState) | ||||
"trader": entState.id, | "trader": entState.id, | ||||
"target": targetState.id | "target": targetState.id | ||||
}); | }); | ||||
if (!tradingDetails) | if (!tradingDetails) | ||||
return false; | return false; | ||||
let tooltip; | let tooltip; | ||||
switch (tradingDetails.type) | switch (tradingDetails.type) | ||||
Lint: ESLintBear (default-case) Expected a default case. Lint: ESLintBear (default-case): `Expected a default case.` | |||||
{ | { | ||||
case "is first": | case "is first": | ||||
tooltip = translate("Origin trade market.") + "\n"; | tooltip = translate("Origin trade market.") + "\n"; | ||||
if (tradingDetails.hasBothMarkets) | if (tradingDetails.hasBothMarkets) | ||||
tooltip += sprintf(translate("Gain: %(gain)s"), { | tooltip += sprintf(translate("Gain: %(gain)s"), { | ||||
"gain": getTradingTooltip(tradingDetails.gain) | "gain": getTradingTooltip(tradingDetails.gain) | ||||
}); | }); | ||||
else | else | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | "execute": function(target, action, selection, queued) | ||||
"name": "order_garrison", | "name": "order_garrison", | ||||
"entity": selection[0] | "entity": selection[0] | ||||
}); | }); | ||||
return true; | return true; | ||||
}, | }, | ||||
"getActionInfo": function(entState, targetState) | "getActionInfo": function(entState, targetState) | ||||
{ | { | ||||
if (!entState.canGarrison || !targetState.garrisonHolder || | if (!entState.garrisonable || !targetState.garrisonHolder || | ||||
!playerCheck(entState, targetState, ["Player", "MutualAlly"])) | !playerCheck(entState, targetState, ["Player", "MutualAlly"])) | ||||
return false; | return false; | ||||
let tooltip = sprintf(translate("Current garrison: %(garrisoned)s/%(capacity)s"), { | let tooltip = sprintf(translate("Current garrison: %(garrisoned)s/%(capacity)s"), { | ||||
"garrisoned": targetState.garrisonHolder.garrisonedEntitiesCount, | "garrisoned": targetState.garrisonHolder.garrisonedEntitiesCount, | ||||
"capacity": targetState.garrisonHolder.capacity | "capacity": targetState.garrisonHolder.capacity | ||||
}); | }); | ||||
▲ Show 20 Lines • Show All 500 Lines • ▼ Show 20 Lines | "execute": function() | ||||
preSelectedAction = ACTION_GARRISON; | preSelectedAction = ACTION_GARRISON; | ||||
}, | }, | ||||
}, | }, | ||||
"unload": { | "unload": { | ||||
"getInfo": function(entStates) | "getInfo": function(entStates) | ||||
{ | { | ||||
if (entStates.every(entState => { | if (entStates.every(entState => { | ||||
if (!entState.unitAI || !entState.turretParent) | if (!entState.unitAI || | ||||
!entState.garrisonable || | |||||
entState.garrisonable.garrisonHolder == INVALID_ENTITY) | |||||
Done Inline ActionsUse it here as well. Freagarach: Use it here as well. | |||||
return true; | return true; | ||||
let parent = GetEntityState(entState.turretParent); | let parent = GetEntityState(entState.turretParent); | ||||
return !parent || !parent.garrisonHolder || parent.garrisonHolder.entities.indexOf(entState.id) == -1; | return !parent || !parent.garrisonHolder || parent.garrisonHolder.entities.indexOf(entState.id) == -1; | ||||
})) | })) | ||||
return false; | return false; | ||||
return { | return { | ||||
"tooltip": translate("Unload"), | "tooltip": translate("Unload"), | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Missing space before value for key 'execute'.