Animation-CobLuaDifferences
From Spring
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.)