Page 1 of 1

[SOLVED]Wiki pages about callins

Posted: 18 May 2014, 22:42
by malric
In page: http://springrts.com/wiki/Lua_Scripting there is a link to http://springrts.com/wiki/Lua:Callins. There, you can find for example: "addon.UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID)"

On page http://springrts.com/wiki/LuaCallinReturn there is "UnitEnteredLos() --> "unitID, teamID" "

By looking at the source I found:

Code: Select all

cont/base/springcontent/LuaGadgets/gadgets.lua:function gadgetHandler:UnitEnteredLos(unitID, unitTeam, allyTeam, unitDefID)
and

Code: Select all

cont/LuaUI/widgets.lua:function widgetHandler:UnitEnteredLos(unitID, unitTeam)
Now, the questions:
- is Lua:Callins wiki page about gadgets only?
- is the list on LuaCallinReturn page about widgets only?
- are the above pages generated automatically or based on a specific version? (if it would be a specific version, it would be nice to be mentioned)
- is there a reason why for similar calls gadgets and widgets have different set of parameters? (for the above example does not seem to be anything that should be hidden). Is it performance?

Re: Wiki pages about callins

Posted: 18 May 2014, 23:05
by FLOZi
Lua:Callins is mainly based on gadgets, but it is future looking to unified widget/gadget aka addon handler, which may be some way off.

LuaCallinReturn is a horrible mess, it isn't widget specific.

Neither are auto-generated.

Those functions which may differ between (synced) gadget land and widgets are those in the http://springrts.com/wiki/Lua:Callins#S ... ced_Shared section. Basically the reason is that all information should be available to synced (game logic controlling) gadgets, but restricted to unsynced gadget/widget (e.g. information about a enemy unit only detected via radar and not yet in LOS). In such cases I documented the full (synced) param list.

Re: Wiki pages about callins

Posted: 18 May 2014, 23:56
by malric
Thanks for the answers. Maybe you could put a warning on Lua:Callins page so that people don't get the wrong idea (would do it myself, but you are the page creator and you edited the most).

Regarding the callin that got me into this problem: is unitdefid considered not available information for UnitEnteredLos? I understand UnitEnteredRadar not to have the unitdefid, but I am interested in UnitEnteredLos. Is there any way to get the unitdefid for an enemy unit in los?

Re: Wiki pages about callins

Posted: 19 May 2014, 00:18
by FLOZi
I will do.

You get the unitID, so just use Spring.GetUnitDefID(unitID) ? Not sure why it isn't passed... old handlers have many inconsistencies.

Re: Wiki pages about callins

Posted: 19 May 2014, 11:45
by malric
Thanks that is what I needed. I now found the reference page containing it (http://springrts.com/wiki/Lua_SyncedRead), seems it will be usefull in the future.