Page MenuHomeWildfire Games

Add an idle unit hotkey
ClosedPublic

Authored by temple on Nov 23 2017, 7:40 PM.

Details

Summary

We have an idle worker hotkey and an idle warrior hotkey, but this isn't always ideal. For example, I usually use the idle worker hotkey but when I play as Briton that omits the dog, which means I sometimes completely forget about him. I could use the idle warrior hotkey, but then I'd miss women, so I'd have to alternate between using both hotkeys. (Setting both to the same key doesn't really work.) And both hotkeys miss some units, like healers. So it'd be nice if there was a hotkey to select idle units regardless of type.

Test Plan

We could define g_UnitTypes = ["!Domestic"] instead, not sure if that would be preferred.

var g_WorkerTypes = ["FemaleCitizen", "Trader", "FishingBoat", "CitizenSoldier"];
var g_MilitaryTypes = ["Melee", "Ranged"];

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

temple created this revision.Nov 23 2017, 7:40 PM
elexis added a subscriber: elexis.Nov 23 2017, 8:23 PM

Eventually simulation templates could have one or more hotkey identifiers, so that users can do whatever.
Everyone should be able to type something like S->W to select a woman and B->H to build a house - without creation of a second place that stores information about templates.
Might still need the default.cfg entries (and json descriptions for hotkey files once I have committed those), but that shouldn't really hurt.

So ok for me to add a variety of hotkeys. We shouldn't needlessly restrict the user.
(Unless we have a different hotkey that already does exactly the same. I didn't check if Imaroks hotkey mentioned in D1056 is similar or equal)

We can also always add hotkeys that are by default UNUSED if we run into key assignment issues as the hotkeys will be fully configurable (...once I committed that).

wraitii accepted this revision.Dec 3 2017, 6:41 PM
wraitii added a subscriber: wraitii.

Agreed, hotkeys can always be left unused.

This revision is now accepted and ready to land.Dec 3 2017, 6:41 PM
elexis added a comment.Dec 3 2017, 6:43 PM

Intro.txt needs a change as well, after the comit the Hotkeys

elexis added a comment.Dec 3 2017, 6:45 PM

Is it only me, my config or can't we add one idle unit to the current selection?

Is it only me, my config or can't we add one idle unit to the current selection?

What do you mean?

temple updated this revision to Diff 4516.Dec 3 2017, 11:22 PM

Added intro.txt changes.
BackSlash currently isn't used as a hotkey, so I think it's okay.

Owners added a subscriber: Restricted Owners Package.Dec 3 2017, 11:22 PM
Vulcan added a subscriber: Vulcan.Dec 4 2017, 12:35 AM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (308 tests)....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
elexis accepted this revision.Dec 4 2017, 3:53 AM

Tested, works as advertized, including excluding animals.
Thanks for the patch.
As a reward you may edit the wiki page on your own ;)

binaries/data/mods/public/gui/session/hotkeys/misc.xml
94 ↗(On Diff #4516)

bit confusing to have two idle worker hotkeys in this file and one idle worker hotkey in the minimap_panel.xml.
But this is the file with all hotkeys except special cases, and the idleWorker hotkey is a special case due to the funky button (that code there should be moved to JS too)

This revision was automatically updated to reflect the committed changes.

(Maybe instead of 3 "next idle unit" hotkeys, we could also have only one and rely on the military / non-military / other existing unit filters. Maybe not, because it's easier to assign the variants if there are more hotkeys.)