Animation-CobLuaDifferences: Difference between revisions
From Spring
Jump to navigationJump to search
| Line 1: | Line 1: | ||
== Overview of differences between COB unit scripts and Lua unit scripts == | == Overview of differences between COB unit scripts and Lua unit scripts == | ||
* Units of measurement: Lua uses elmos and radians consistently. | * Units of measurement: Lua uses elmos and radians consistently. | ||
* Coordinate system: In Lua, coordinate system is same as world coordinate system, with all rotations right-handed. In COB, the moves along the x-axis and rotations around the z-axis have a different sign. | * Coordinate system: In Lua, coordinate system is same as world coordinate system, with all rotations right-handed. In COB, the moves along the x-axis and rotations around the z-axis have a different sign. | ||
| Line 11: | Line 10: | ||
* Where COB uses ''SetSpeed'' and ''SetDirection'', Lua uses ''WindChanged'' and ''ExtractionRateChanged''. | * Where COB uses ''SetSpeed'' and ''SetDirection'', Lua uses ''WindChanged'' and ''ExtractionRateChanged''. | ||
* Lua does not have ''Go'' (this is called for activated extractors immediately after each ''SetSpeed'' call.) | * Lua does not have ''Go'' (this is called for activated extractors immediately after each ''SetSpeed'' call.) | ||
==Hints== | |||
* COB & LUS (LuaUnitScripts) can be reloaded ingame via <code>/reloadcob %unitdefname</code>, also LUS get reloaded with <code>/luarules reload</code>, too. | |||
[[Category:Unit_development]] | [[Category:Unit_development]] | ||
[[Category:Animation]] | [[Category:Animation]] | ||
[[Category:Lua]] | [[Category:Lua]] | ||
Revision as of 12:13, 11 September 2010
Overview of differences between COB unit scripts and Lua unit scripts
- Units of measurement: Lua uses elmos and radians consistently.
- Coordinate system: In Lua, coordinate system is same as world coordinate system, with all rotations right-handed. In COB, the moves along the x-axis and rotations around the z-axis have a different sign.
- In Lua, Killed gets recentDamage and maxHealth as separate arguments. In COB, you get only the ratio recentDamage/maxHealth*100.
- Where COB uses SetMaxReloadTime, Lua uses GetMaxReloadTime.
- Where COB uses QueryLandingPadCount and QueryLandingPad, Lua uses QueryLandingPads
- The x and z arguments to HitByWeapon, HitByWeaponId and RockUnit are given in (x, z) order in Lua, and the opposite order in COB.
- BeginTransport and EndTransport take the height of the unit in COB and the unitID in Lua. (Use 'local height = Spring.GetUnitHeight(unitID)' to get the height.)
- TransportDrop gets PACKXZ(x,z) in COB; in Lua, it gets the entire vector (x, y, z) as three arguments.
- Where COB uses SetSpeed and SetDirection, Lua uses WindChanged and ExtractionRateChanged.
- Lua does not have Go (this is called for activated extractors immediately after each SetSpeed call.)
Hints
- COB & LUS (LuaUnitScripts) can be reloaded ingame via
/reloadcob %unitdefname, also LUS get reloaded with/luarules reload, too.