1
0
forked from 0ad/0ad

Improves military-only-selection modifier, now filters fishing boat and merchant ship. Uses the same classes filter for find-idle-warrior. Reviewed by elexis. Fixes #4129.

This was SVN commit r18644.
This commit is contained in:
fatherbushido 2016-08-27 10:34:21 +00:00
parent 35f8061ef2
commit 737ede0f89
3 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@
<!-- Find idle warrior - TODO: Potentially move this to own UI button? -->
<object hotkey="selection.idlewarrior">
<action on="Press">findIdleUnit(["Hero", "Champion", "CitizenSoldier", "Siege", "Warship", "Dog"]);</action>
<action on="Press">findIdleUnit(g_MilitaryTypes);</action>
</object>
<object hotkey="selection.cancel">

View File

@ -449,13 +449,10 @@ var unitFilters = {
var entState = GetEntityState(entity);
return entState && hasClass(entState, "Defensive");
},
"isNotSupport": entity => {
"isMilitary": entity => {
var entState = GetEntityState(entity);
return entState &&
hasClass(entState, "Unit") &&
!hasClass(entState, "Support") &&
!hasClass(entState, "Domestic");
g_MilitaryTypes.some(c => hasClass(entState, c));
},
"isIdle": entity => {
var entState = GetEntityState(entity);
@ -480,7 +477,7 @@ function getPreferredEntities(ents)
// Handle hotkeys
if (Engine.HotkeyIsPressed("selection.milonly"))
filters = [unitFilters.isNotSupport];
filters = [unitFilters.isMilitary];
if (Engine.HotkeyIsPressed("selection.idleonly"))
filters = [unitFilters.isIdle];

View File

@ -145,7 +145,10 @@ var g_Heroes = [];
* Unit classes to be checked for the idle-worker-hotkey.
*/
var g_WorkerTypes = ["Female", "Trader", "FishingBoat", "CitizenSoldier"];
/**
* Unit classes to be checked for the military-only-selection modifier and for the idle-warrior-hotkey.
*/
var g_MilitaryTypes = ["Melee", "Ranged"];
/**
* Cache the idle worker status.
*/