fa icon indicating copy to clipboard operation
fa copied to clipboard

Integrate Advanced Key Actions

Open 4z0t opened this issue 2 years ago • 9 comments

Allows you to create key actions based on selected units' category.

CategoryMatcher("Enter OC mode / Transport / Toggle repeat build")
{
    CategoryAction(), -- do nothing if no selection
    CategoryAction(categories.TRANSPORTATION)
        :Action "StartCommandMode order RULEUCC_Transport",
    CategoryAction(categories.COMMAND + categories.SUBCOMMANDER)
        :Action(import('/lua/ui/game/orders.lua').EnterOverchargeMode),
    CategoryAction(categories.FACTORY * categories.STRUCTURE)
        :Action(import("/lua/keymap/misckeyactions.lua").ToggleRepeatBuild)
}

4z0t avatar Dec 17 '23 16:12 4z0t

@4z0t there's a hiccup in this implementation, if you rename the actions then the old actions 'linger' in the key actions menu:

image

Wouldn't it be better to support the standard syntax instead?

Garanas avatar Dec 22 '23 12:12 Garanas

@Garanas this is because old ones are still present in your prefs file.

4z0t avatar Dec 22 '23 12:12 4z0t

I understand that, but that is because we manually add the key. If it is present in the 'standard way' then this behavior does not happen.

Garanas avatar Dec 22 '23 12:12 Garanas

The key is made of description, there is no point in adding second string that will represent key in this table, it will only make it more complex for modders to use.

4z0t avatar Dec 22 '23 12:12 4z0t

And this also happens when mod adds it's own keyactions and then being removed, so, combined actions add nothing new in this behaviour.

4z0t avatar Dec 22 '23 12:12 4z0t

What is new is that it is now in the repository. If we'd, for example, update one of the combined actions with one more additional action we'll also need to update the description. At that point, all players will have a lingering, not functioning hotkey in their preference file.

Garanas avatar Dec 22 '23 13:12 Garanas

@Garanas I think this should keep simplicity and at the same time be strict enough for main repo

4z0t avatar Dec 22 '23 13:12 4z0t

You're not addressing the issue. A lingering, not-functioning hotkey is confusing for everyone involved.

Garanas avatar Dec 22 '23 13:12 Garanas

How are you going to fix it? Clear all of them from prefs file? What if there are custom ones and people wanna keep them? And I'm not gonna fix it in this PR either.

4z0t avatar Dec 22 '23 13:12 4z0t