Some commands, such as CMD.ATTACK, if given without the shift modifier, will overwrite the units current order queue. Others, such as CMD.ONOFF, won't. Is there a way for a custom command to decide which of these behaviours it wants? If not, feature request please - the default is the first case and I haven't found a clean way to get second.
(The reason: since custom commands are implemented in lua anyway, one can hackily workaround the issue by returning false in gadget:AllowCommand for the custom command; the order queue is then preserved but it has the unwanted side effect that then in some cases LuaUI & elsewhere sees it as though the command was never given. For example, see BAs CMD.PASSIVE with a factory and note that widget:UnitCommand is not called because gadget:AllowCommand returned false.)
custom commands that don't erase the order queue when given without shift?
Moderator: Moderators
- Silentwings
- Moderator
- Posts: 3718
- Joined: 25 Oct 2008, 00:23
Re: custom commands that don't erase the order queue when given without shift?
Nope, the set of non-queueing commands (which are those that toggle state) is hardcoded.Is there a way
- Silentwings
- Moderator
- Posts: 3718
- Joined: 25 Oct 2008, 00:23
Re: custom commands that don't erase the order queue when given without shift?
Ah well, thanks, low priority feature request :)
-
- Moderator
- Posts: 2463
- Joined: 12 Oct 2007, 09:24
Re: custom commands that don't erase the order queue when given without shift?
Just return false in gadget:AllowCommand. This is always how I have implemented state toggles and I never noticed a problem. I have not used widget:UnitCommand for toggles but if you need it to trigger then send the UnitCommand to LuaUI directly. For example: https://github.com/ZeroK-RTS/Zero-K/blo ... events.lua
- Silentwings
- Moderator
- Posts: 3718
- Joined: 25 Oct 2008, 00:23
Re: custom commands that don't erase the order queue when given without shift?
I appreciate that's possible but I'm not going to start artificially forwarding the native callins to LuaUI, allowing it looks like a first step down the slippery slope of hackiness. Prefer to just wait.
- Silentwings
- Moderator
- Posts: 3718
- Joined: 25 Oct 2008, 00:23