Page 1 of 1

custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 00:26
by Silentwings
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.)

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 00:42
by Kloot
Is there a way
Nope, the set of non-queueing commands (which are those that toggle state) is hardcoded.

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 09:04
by Silentwings
Ah well, thanks, low priority feature request :)

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 09:08
by Google_Frog
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

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 09:16
by Silentwings
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.

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 19:09
by FLOZi

Re: custom commands that don't erase the order queue when given without shift?

Posted: 04 Feb 2016, 22:20
by Silentwings
\o/