Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/unit_actions.js
Show First 20 Lines • Show All 1,008 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/** | /** | ||||
* Info and actions for the entity commands | * Info and actions for the entity commands | ||||
* Currently displayed in the bottom of the central panel | * Currently displayed in the bottom of the central panel | ||||
*/ | */ | ||||
var g_EntityCommands = | var g_EntityCommands = | ||||
{ | { | ||||
"assign-idle-villager": { | |||||
"getInfo": function(entStates) | |||||
{ | |||||
if (entStates.every(entState => !entState.resourceSupply && | |||||
!entState.needsRepair && !entState.foundation)) | |||||
return false; | |||||
// This should return a tooltip explaining that one does not have any | |||||
// idle villies, with a disabled button. Like "delete". | |||||
if (!Engine.GuiInterfaceCall("HasIdleUnits", { | |||||
"viewedPlayer": g_ViewedPlayer, | |||||
elexis: -\t | |||||
"idleClasses": g_WorkerTypes, | |||||
"excludeUnits": [] | |||||
})) | |||||
return { | |||||
"tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.assignidlevillager") + | |||||
translate("There are no idle villagers to assign.."), | |||||
Done Inline Actions.. elexis: .. | |||||
"icon": "production.png", | |||||
"active": "false" | |||||
}; | |||||
return { | |||||
"tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.assignidlevillager") + | |||||
translate("Assign an idle villager to work on this entity."), | |||||
"icon": "production.png" | |||||
}; | |||||
}, | |||||
"execute": function(entStates) | |||||
{ | |||||
assignIdleVillager(entStates.map(entState => entState.id), Engine.HotkeyIsPressed("session.assignall")); | |||||
}, | |||||
}, | |||||
"unload-all": { | "unload-all": { | ||||
"getInfo": function(entStates) | "getInfo": function(entStates) | ||||
Not Done Inline Actions+/t Freagarach: +`/t` | |||||
{ | { | ||||
let count = 0; | let count = 0; | ||||
for (let entState of entStates) | for (let entState of entStates) | ||||
if (entState.garrisonHolder) | if (entState.garrisonHolder) | ||||
count += entState.garrisonHolder.entities.length; | count += entState.garrisonHolder.entities.length; | ||||
if (!count) | if (!count) | ||||
return false; | return false; | ||||
Not Done Inline ActionsReally should because now it just sends the lowest entity ID to attack and that is probably a civilian. Freagarach: Really should because now it just sends the lowest entity ID to attack and that is probably a… | |||||
return { | return { | ||||
"tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.unload") + | "tooltip": colorizeHotkey("%(hotkey)s" + " ", "session.unload") + | ||||
translate("Unload All."), | translate("Unload All."), | ||||
"icon": "garrison-out.png", | "icon": "garrison-out.png", | ||||
"count": count, | "count": count, | ||||
}; | }; | ||||
}, | }, | ||||
"execute": function() | "execute": function() | ||||
{ | { | ||||
unloadAll(); | unloadAll(); | ||||
}, | }, | ||||
}, | }, | ||||
"delete": { | "delete": { | ||||
Not Done Inline ActionsThis translation works for now, but is bad for the user. How could we reliably specify to the user which action is to be undertaken? Freagarach: This translation works for now, but is bad for the user. How could we reliably specify to the… | |||||
"getInfo": function(entStates) | "getInfo": function(entStates) | ||||
{ | { | ||||
return entStates.some(entState => !isUndeletable(entState)) ? | return entStates.some(entState => !isUndeletable(entState)) ? | ||||
{ | { | ||||
"tooltip": | "tooltip": | ||||
colorizeHotkey("%(hotkey)s" + " ", "session.kill") + | colorizeHotkey("%(hotkey)s" + " ", "session.kill") + | ||||
translate("Destroy the selected units or buildings.") + "\n" + | translate("Destroy the selected units or buildings.") + "\n" + | ||||
colorizeHotkey( | colorizeHotkey( | ||||
▲ Show 20 Lines • Show All 519 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
-\t