Custom formations 2 v3.0 - Relevant changes

Custom formations 2 v3.0 - Relevant changes

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Custom formations 2 v3.0 - Relevant changes

Post 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.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Custom formations 2 v3.0 - Relevant changes

Post 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,...?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Custom formations 2 v3.0 - Relevant changes

Post 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?
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Custom formations 2 v3.0 - Relevant changes

Post 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)
User avatar
KaiserJ
Community Representative
Posts: 3113
Joined: 08 Sep 2008, 22:59

Re: Custom formations 2 v3.0 - Relevant changes

Post by KaiserJ »

cool, good work dude!
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom formations 2 v3.0 - Relevant changes

Post by Gota »

Link?
Where can I get this..
SirMaverick
Posts: 834
Joined: 19 May 2009, 21:10

Re: Custom formations 2 v3.0 - Relevant changes

Post by SirMaverick »

Gota wrote:Link?
Where can I get this..
widget database
Post Reply

Return to “Lua Scripts”