Minor additions to existing functions

-added optional variable to mist.utils.getDir() If present this function
will return the "raw" heading, this is useful in assigning the heading
variable within a task.

-mist.utils.makeVec3 now supports being given a table in WP format.
Specifically it now coverts a table {x, y, alt) to vec3
This commit is contained in:
mrSkortch 2015-10-21 03:32:01 -06:00
parent 71de3f5b53
commit d9f5f24632
2 changed files with 13 additions and 4 deletions

View File

@ -15,7 +15,7 @@ mist = {}
-- don't change these
mist.majorVersion = 4
mist.minorVersion = 0
mist.build = 57
mist.build = 58
--------------------------------------------------------------------------------------------------------------
-- the main area
@ -921,7 +921,9 @@ end
function mist.utils.makeVec3(Vec2, y)
if not Vec2.z then
if not y then
if Vec2.alt and not y then
y = Vec2.alt
elseif not y then
y = 0
end
return {x = Vec2.x, y = y, z = Vec2.y}
@ -959,9 +961,11 @@ mist.utils.zoneToVec3 = function(zone)
end
-- gets heading-error corrected direction from point along vector vec.
function mist.utils.getDir(vec, point)
function mist.utils.getDir(vec, point, raw)
local dir = math.atan2(vec.z, vec.x)
if not raw then
dir = dir + mist.getNorthCorrection(point)
end
if dir < 0 then
dir = dir + 2*math.pi -- put dir in range of 0 to 2*pi
end

View File

@ -1,3 +1,8 @@
v58
-added optional variable to mist.utils.getDir() If present this function will return the "raw" heading, this is useful in assigning the heading variable within a task.
-mist.utils.makeVec3 now supports being given a table in WP format. Specifically it now coverts a table {x, y, alt) to vec3
v57
-fixed bug with groupRandomDistSelf improperly declaring the y variable
-fixed flagFunc.units_in_moving_zones not checking for a unitNameTable for the zone_units