Page 1 of 1

Custom formations 2 v3.0 - Relevant changes

Posted: 13 Apr 2010, 14:40
by Niobium
So I just updated custom formations2 to version 3.0, and there's a few changes that will influence current/future widgets/gadgets.

1) Custom formations now uses the correct option format in CommandNotify.

Previously, custom formations would call CommandNotify with options in array form i.e. {"alt", "shift"}. It now calls with the correct map form, i.e. {['alt']=true/false, ['coded']=32, ...}.

Note that with custom formations running even single-clicks were 'formations', and hence CommandNotify was sent (in the wrong format) by custom formations.

2) Custom formations no longer calls CommandNotify for multi-unit formations.

Previously if you issued a formation order custom formations would call CommandNotify with the command parameter being the first nodes position, despite only one of the many units having those parameters for its order. Custom formations would detect any widget handling this, and give an error message about a conflict.

What happens now with formations is that custom formations will look for a function 'UnitCommandNotify' in each widget, and call it with 'uID, cmdID, cmdParams, cmdOpts', i.e. the same arguments as you get for CommandNotify but prefixed with a unit ID.

This will be done for every unit in the formation (with cmdParams being the parameters relating to the specified unit), where a widget returning true will stop the command being issued (as well as further UnitCommandNotify calls for that unit).

3) Custom formations still calls CommandNotify for orders that have a single set of parameters for the entire selection (single-click, unit paths), and will abide by the return value.

---

So that's about it. If any of those changes breaks your lua, then the problem is in your lua. All the changes make custom formations more transparent, i.e. spring will behave the same with or without custom formations, so any problems you get are the same ones you'd get by simply disabling custom formations.

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 14 Apr 2010, 08:19
by manolo_
hiho,

im no lua-programmer, nor do i have a deeper knowledge of spring code and stuff. but why do u change that widget when there is a possibility that other widgets/gadgets wont work anymore. is there a speed increase, better compatibility,...?

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 14 Apr 2010, 09:30
by zwzsg
manolo_ wrote:why do u change that widget when there is a possibility that other widgets/gadgets wont work anymore
Didn't Niobium say the exact contrary?

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 14 Apr 2010, 16:33
by Niobium
manolo_ wrote:hiho,

im no lua-programmer, nor do i have a deeper knowledge of spring code and stuff. but why do u change that widget when there is a possibility that other widgets/gadgets wont work anymore. is there a speed increase, better compatibility,...?
What it does now is the correct way, so it is better for compatibility. However, previously it was consistently doing it the wrong way, and due to custom formations effecting pretty much everything (even a single-click move is a formation), it is possible someone saw the 'wrong' format so often they just assumed it was the right one and made their widgets accordingly.

So for any widgets that aren't compatible with v3.0, the fault lies in that widget for using the wrong format (which the author justifiably thought was correct at the time)

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 14 Apr 2010, 19:16
by KaiserJ
cool, good work dude!

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 18 Apr 2010, 22:11
by Gota
Link?
Where can I get this..

Re: Custom formations 2 v3.0 - Relevant changes

Posted: 19 Apr 2010, 00:53
by SirMaverick
Gota wrote:Link?
Where can I get this..
widget database