fixed bug with unit speed not getting added to DBs if spawned

added mist.getRandomPointInZone
This commit is contained in:
mrSkortch 2015-03-13 17:19:16 -06:00
parent 822dea7ae7
commit e18778bc7d
6 changed files with 5813 additions and 8 deletions

1
.gitattributes vendored
View File

@ -25,3 +25,4 @@
.gitignore export-ignore
README.md export-ignore
mist_doc_file.doc export-ignore
mist.lua export-ignore

Binary file not shown.

View File

@ -7,8 +7,8 @@ mist = {}
-- don't change these
mist.majorVersion = 3
mist.minorVersion = 5
mist.build = 41
mist.minorVersion = 6
mist.build = 42
@ -160,7 +160,8 @@ do
newTable.units[unitId].point.x = newTable.units[unitId].x
newTable.units[unitId].point.y = newTable.units[unitId].y
newTable.units[unitId].alt = mist.utils.round(unitData:getPosition().p.y)
newTable.units[unitId].speed = mist.vec.mag(unitData:getVelocity())
newTable.units[unitId].heading = mist.getHeading(unitData, true)
newTable.units[unitId].type = unitData:getTypeName()
@ -3126,7 +3127,7 @@ stopFlag
if stopflag == -1 or (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == false) then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true then
if trigger.misc.getUserFlag(flag) == 0 then
trigger.action.setUserFlag(flag, true)
end
@ -3163,7 +3164,7 @@ mist.flagFunc.group_dead = function(vars)
if stopflag == -1 or (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == false) then
if not Group.getByName(groupName) or Group.getByName(groupName):isExist() == false then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == false or not Group.getByName(groupName) then
if trigger.misc.getUserFlag(flag) == 0 then
trigger.action.setUserFlag(flag, true)
end
@ -3201,7 +3202,7 @@ mist.flagFunc.group_alive_less_than = function(vars)
if stopflag == -1 or (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == false) then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true then
if Group.getByName(groupName):getSize()/Group.getByName(groupName):getInitialSize() < percent/100 then
if trigger.misc.getUserFlag(flag) == 0 then
trigger.action.setUserFlag(flag, true)
@ -3245,7 +3246,7 @@ mist.flagFunc.group_alive_more_than = function(vars)
if stopflag == -1 or (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == false) then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() then
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true then
if Group.getByName(groupName):getSize()/Group.getByName(groupName):getInitialSize() > percent/100 then
if trigger.misc.getUserFlag(flag) == 0 then
trigger.action.setUserFlag(flag, true)
@ -3720,6 +3721,13 @@ function mist.getRandPointInCircle(point, radius, innerRadius)
return rndCoord
end
mist.getRandomPointInZone = function(zoneName, innerRadius)
if type(zoneName) == 'string' and type(trigger.misc.getZone(zoneName)) == 'table' then
return mist.getRandPointInCircle(trigger.misc.getZone(zoneName).point, trigger.misc.getZone(zoneName).radius, innerRadius)
end
return false
end
mist.groupToRandomPoint = function(vars)
local group = vars.group --Required
local point = vars.point --required
@ -5217,7 +5225,7 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
return mist.dynAddStatic(newGroupData)
end
--mist.debug.writeData(mist.utils.serialize,{'targets', newGroupData}, 'newGroupData.lua')
return mist.dynAdd(newGroupData)
end

Binary file not shown.

5783
mistv3_6_42.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,17 @@
-- changelog
v42 v3.6 release
-added mist.getRandomPointInZone. Function uses mist.getRandomPointInCircle.
-fixed bug with altitude switching to radio if baro was specified
-added the speed to DBs if a unit is dynamically spawned in
-added extra checks in case Group/Unit.getByName returns dead objects
- Mission file searching functions now search by Id instead of group or unit names.
The name input variable hasnt changed, value gets converted to Id automatically if found.
Functions now also accept a numerical groupId or unitId
getPayload
getGroupPayload
getGroupPoints
getGroupRoute
v38
- fixed bug with optional variables for coordinate messages not actually being optional