GetUnitCOBValue, SetUnitCOBValue

GetUnitCOBValue, SetUnitCOBValue

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

GetUnitCOBValue, SetUnitCOBValue

Post by Tobi »

GetUnitCOBValue and SetUnitCOBValue were moved to Spring.UnitScript table in master.

Forgot to make a post about this earlier.

If you are lazy and use these functions, you can add the following lines to your gadgetHandler (or specific gadgets) to keep your Lua working in both current Spring and next Spring:

Code: Select all

if (not Spring.GetUnitCOBValue) then
  Spring.GetUnitCOBValue = Spring.UnitScript.GetUnitCOBValue
  Spring.SetUnitCOBValue = Spring.UnitScript.SetUnitCOBValue
end
If you are not lazy and use these functions, you can just replace them where they are used.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: GetUnitCOBValue, SetUnitCOBValue

Post by KDR_11k »

Wow, I think that's the first time Fibre will need a fix for a new Spring...
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: GetUnitCOBValue, SetUnitCOBValue

Post by Tobi »

Ok, ignore this thread, I've made it backwards compatible after all.

To clear up, it's like this now:

Code: Select all

Spring.GetUnitCOBValue == Spring.UnitScript.GetUnitValue
Spring.SetUnitCOBValue == Spring.UnitScript.SetUnitValue
The name to the right is recommended to use in Lua unit scripts. (They have not much to do with COB after all.)
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: GetUnitCOBValue, SetUnitCOBValue

Post by zwzsg »

I had already made KP compatible, but yeah, keep retro-compatibility when it's easy to, is a good approach. Image
Post Reply

Return to “Engine”