mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2025-08-15 10:47:23 +00:00
v53
Assorted Changes and fixes
This commit is contained in:
parent
4ff458534f
commit
065c28a697
143
mist.lua
143
mist.lua
@ -1,4 +1,11 @@
|
|||||||
--[[
|
--[[
|
||||||
|
Links:
|
||||||
|
|
||||||
|
ED Forum Thread: http://forums.eagle.ru/showthread.php?t=98616
|
||||||
|
|
||||||
|
Github
|
||||||
|
Development: https://github.com/mrSkortch/MissionScriptingTools/tree/development
|
||||||
|
Official Release: https://github.com/mrSkortch/MissionScriptingTools/tree/master
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
@ -7,10 +14,8 @@ mist = {}
|
|||||||
|
|
||||||
-- don't change these
|
-- don't change these
|
||||||
mist.majorVersion = 3
|
mist.majorVersion = 3
|
||||||
mist.minorVersion = 7
|
mist.minorVersion = 8
|
||||||
mist.build = 52
|
mist.build = 53
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------------
|
||||||
-- the main area
|
-- the main area
|
||||||
@ -21,6 +26,7 @@ do
|
|||||||
local mistAddedObjects = {} -- mist.dynAdd unit data added here
|
local mistAddedObjects = {} -- mist.dynAdd unit data added here
|
||||||
local mistAddedGroups = {} -- mist.dynAdd groupdata added here
|
local mistAddedGroups = {} -- mist.dynAdd groupdata added here
|
||||||
local writeGroups = {}
|
local writeGroups = {}
|
||||||
|
local lastUpdateTime = 0
|
||||||
|
|
||||||
local function update_alive_units() -- coroutine function
|
local function update_alive_units() -- coroutine function
|
||||||
local lalive_units = mist.DBs.aliveUnits -- local references for faster execution
|
local lalive_units = mist.DBs.aliveUnits -- local references for faster execution
|
||||||
@ -369,6 +375,9 @@ do
|
|||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if timer.getTime() > lastUpdateTime then
|
||||||
|
lastUpdateTime = timer.getTime()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -438,6 +447,7 @@ do
|
|||||||
local mistUnitId = 7000
|
local mistUnitId = 7000
|
||||||
local mistDynAddIndex = 1
|
local mistDynAddIndex = 1
|
||||||
|
|
||||||
|
|
||||||
mist.nextGroupId = 1
|
mist.nextGroupId = 1
|
||||||
mist.nextUnitId = 1
|
mist.nextUnitId = 1
|
||||||
|
|
||||||
@ -457,6 +467,10 @@ do
|
|||||||
return mist.nextGroupId
|
return mist.nextGroupId
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mist.getLastDBUpdateTime = function()
|
||||||
|
return lastUpdateTime
|
||||||
|
end
|
||||||
|
|
||||||
local function groupSpawned(event)
|
local function groupSpawned(event)
|
||||||
if event.id == world.event.S_EVENT_BIRTH and timer.getTime0() < timer.getAbsTime()then -- dont need to add units spawned in at the start of the mission if mist is loaded in init line
|
if event.id == world.event.S_EVENT_BIRTH and timer.getTime0() < timer.getAbsTime()then -- dont need to add units spawned in at the start of the mission if mist is loaded in init line
|
||||||
table.insert(tempSpawnedUnits,(event.initiator))
|
table.insert(tempSpawnedUnits,(event.initiator))
|
||||||
@ -1871,7 +1885,11 @@ for coa_name, coa_data in pairs(env.mission.coalition) do
|
|||||||
if group_data and group_data.units and type(group_data.units) == 'table' then --making sure again- this is a valid group
|
if group_data and group_data.units and type(group_data.units) == 'table' then --making sure again- this is a valid group
|
||||||
|
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num] = {}
|
mist.DBs.units[coa_name][countryName][category][group_num] = {}
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num]["groupName"] = group_data.name
|
local groupName = group_data.name
|
||||||
|
if env.mission.version > 7 then
|
||||||
|
groupName = env.getValueDictByKey(groupName)
|
||||||
|
end
|
||||||
|
mist.DBs.units[coa_name][countryName][category][group_num]["groupName"] = groupName
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num]["groupId"] = group_data.groupId
|
mist.DBs.units[coa_name][countryName][category][group_num]["groupId"] = group_data.groupId
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num]["category"] = category
|
mist.DBs.units[coa_name][countryName][category][group_num]["category"] = category
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num]["coalition"] = coa_name
|
mist.DBs.units[coa_name][countryName][category][group_num]["coalition"] = coa_name
|
||||||
@ -1888,13 +1906,15 @@ for coa_name, coa_data in pairs(env.mission.coalition) do
|
|||||||
mist.DBs.units[coa_name][countryName][category][group_num]["frequency"] = group_data.frequency
|
mist.DBs.units[coa_name][countryName][category][group_num]["frequency"] = group_data.frequency
|
||||||
mist.DBs.units[coa_name][countryName][category][group_num]["modulation"] = group_data.modulation
|
mist.DBs.units[coa_name][countryName][category][group_num]["modulation"] = group_data.modulation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for unit_num, unit_data in pairs(group_data.units) do
|
for unit_num, unit_data in pairs(group_data.units) do
|
||||||
local units_tbl = mist.DBs.units[coa_name][countryName][category][group_num]["units"] --pointer to the units table for this group
|
local units_tbl = mist.DBs.units[coa_name][countryName][category][group_num]["units"] --pointer to the units table for this group
|
||||||
|
|
||||||
units_tbl[unit_num] = {}
|
units_tbl[unit_num] = {}
|
||||||
units_tbl[unit_num]["unitName"] = unit_data.name
|
if env.mission.version > 7 then
|
||||||
|
units_tbl[unit_num]["unitName"] = env.getValueDictByKey(unit_data.name)
|
||||||
|
else
|
||||||
|
units_tbl[unit_num]["unitName"] = unit_data.name
|
||||||
|
end
|
||||||
units_tbl[unit_num]["type"] = unit_data.type
|
units_tbl[unit_num]["type"] = unit_data.type
|
||||||
units_tbl[unit_num]["skill"] = unit_data.skill --will be nil for statics
|
units_tbl[unit_num]["skill"] = unit_data.skill --will be nil for statics
|
||||||
units_tbl[unit_num]["unitId"] = unit_data.unitId
|
units_tbl[unit_num]["unitId"] = unit_data.unitId
|
||||||
@ -1924,7 +1944,7 @@ for coa_name, coa_data in pairs(env.mission.coalition) do
|
|||||||
units_tbl[unit_num]["psi"] = unit_data.psi
|
units_tbl[unit_num]["psi"] = unit_data.psi
|
||||||
|
|
||||||
|
|
||||||
units_tbl[unit_num]["groupName"] = group_data.name
|
units_tbl[unit_num]["groupName"] = groupName
|
||||||
units_tbl[unit_num]["groupId"] = group_data.groupId
|
units_tbl[unit_num]["groupId"] = group_data.groupId
|
||||||
|
|
||||||
if unit_data.AddPropAircraft then
|
if unit_data.AddPropAircraft then
|
||||||
@ -2557,7 +2577,7 @@ Country names to be used in [c] and [-c] short-cuts:
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
units_tbl['processed'] = true --add the processed flag
|
units_tbl['processed'] = timer.getTime() --add the processed flag
|
||||||
return units_tbl
|
return units_tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2756,6 +2776,7 @@ maxalt = number or nil,
|
|||||||
interval = number or nil,
|
interval = number or nil,
|
||||||
req_num = number or nil
|
req_num = number or nil
|
||||||
toggle = boolean or nil
|
toggle = boolean or nil
|
||||||
|
unitTableDef = table or nil
|
||||||
]]
|
]]
|
||||||
-- type_tbl
|
-- type_tbl
|
||||||
local type_tbl = {
|
local type_tbl = {
|
||||||
@ -2767,6 +2788,7 @@ toggle = boolean or nil
|
|||||||
interval = {'number', 'nil'},
|
interval = {'number', 'nil'},
|
||||||
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
||||||
toggle = {'boolean', 'nil'},
|
toggle = {'boolean', 'nil'},
|
||||||
|
unitTableDef = {'table', 'nil'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_polygon', type_tbl, vars)
|
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_polygon', type_tbl, vars)
|
||||||
@ -2779,14 +2801,17 @@ toggle = boolean or nil
|
|||||||
local maxalt = vars.maxalt or vars.alt
|
local maxalt = vars.maxalt or vars.alt
|
||||||
local req_num = vars.req_num or vars.reqnum or 1
|
local req_num = vars.req_num or vars.reqnum or 1
|
||||||
local toggle = vars.toggle or nil
|
local toggle = vars.toggle or nil
|
||||||
|
local unitTableDef = vars.unitTableDef
|
||||||
|
|
||||||
|
if not units.processed then
|
||||||
if not units.processed then -- run unit table short cuts
|
unitTableDef = mist.utils.deepCopy(units)
|
||||||
units = mist.makeUnitTable(units)
|
|
||||||
--mist.debug.writeData(mist.utils.serialize,{'vars', vars}, 'vars.txt')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
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 (units.processed and units.processed < mist.getLastDBUpdateTime()) or not units.processed then -- run unit table short cuts
|
||||||
|
units = mist.makeUnitTable(unitTableDef)
|
||||||
|
end
|
||||||
|
|
||||||
|
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) == 0) then
|
||||||
local num_in_zone = 0
|
local num_in_zone = 0
|
||||||
for i = 1, #units do
|
for i = 1, #units do
|
||||||
local unit = Unit.getByName(units[i])
|
local unit = Unit.getByName(units[i])
|
||||||
@ -2794,7 +2819,7 @@ toggle = boolean or nil
|
|||||||
local pos = unit:getPosition().p
|
local pos = unit:getPosition().p
|
||||||
if mist.pointInPolygon(pos, zone, maxalt) then
|
if mist.pointInPolygon(pos, zone, maxalt) then
|
||||||
num_in_zone = num_in_zone + 1
|
num_in_zone = num_in_zone + 1
|
||||||
if num_in_zone >= req_num and trigger.misc.getUserFlag(flag) == false then
|
if num_in_zone >= req_num and trigger.misc.getUserFlag(flag) == 0 then
|
||||||
trigger.action.setUserFlag(flag, true)
|
trigger.action.setUserFlag(flag, true)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -2802,13 +2827,11 @@ toggle = boolean or nil
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if toggle and (num_in_zone < req_num) and trigger.misc.getUserFlag(flag) > 0 then
|
if toggle and (num_in_zone < req_num) and trigger.misc.getUserFlag(flag) > 0 then
|
||||||
|
|
||||||
trigger.action.setUserFlag(flag, false)
|
trigger.action.setUserFlag(flag, false)
|
||||||
end
|
end
|
||||||
-- do another check in case stopflag was set true by this function
|
-- do another check in case stopflag was set true by this function
|
||||||
if (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 (type(trigger.misc.getUserFlag(stopflag)) == 'number' and trigger.misc.getUserFlag(stopflag) == 0) or (type(trigger.misc.getUserFlag(stopflag)) == 'boolean' and trigger.misc.getUserFlag(stopflag) == 0) then
|
||||||
|
mist.scheduleFunction(mist.flagFunc.units_in_polygon, {{units = units, zone = zone, flag = flag, stopflag = stopflag, interval = interval, req_num = req_num, maxalt = maxalt, toggle = toggle, unitTableDef = unitTableDef}}, timer.getTime() + interval)
|
||||||
mist.scheduleFunction(mist.flagFunc.units_in_polygon, {{units = units, zone = zone, flag = flag, stopflag = stopflag, interval = interval, req_num = req_num, maxalt = maxalt, toggle = toggle}}, timer.getTime() + interval)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -2894,6 +2917,7 @@ function mist.flagFunc.units_in_zones(vars)
|
|||||||
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
||||||
interval = {'number', 'nil'},
|
interval = {'number', 'nil'},
|
||||||
toggle = {'boolean', 'nil'},
|
toggle = {'boolean', 'nil'},
|
||||||
|
unitTableDef = {'table', 'nil'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_zones', type_tbl, vars)
|
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_zones', type_tbl, vars)
|
||||||
@ -2906,10 +2930,16 @@ function mist.flagFunc.units_in_zones(vars)
|
|||||||
local req_num = vars.req_num or vars.reqnum or 1
|
local req_num = vars.req_num or vars.reqnum or 1
|
||||||
local interval = vars.interval or 1
|
local interval = vars.interval or 1
|
||||||
local toggle = vars.toggle or nil
|
local toggle = vars.toggle or nil
|
||||||
|
local unitTableDef = vars.unitTableDef
|
||||||
|
|
||||||
if not units.processed then -- run unit table short cuts
|
if not units.processed then
|
||||||
units = mist.makeUnitTable(units)
|
unitTableDef = mist.utils.deepCopy(units)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (units.processed and units.processed < mist.getLastDBUpdateTime()) or not units.processed then -- run unit table short cuts
|
||||||
|
units = mist.makeUnitTable(unitTableDef)
|
||||||
|
end
|
||||||
|
|
||||||
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 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
|
||||||
|
|
||||||
local in_zone_units = mist.getUnitsInZones(units, zones, zone_type)
|
local in_zone_units = mist.getUnitsInZones(units, zones, zone_type)
|
||||||
@ -2921,7 +2951,7 @@ function mist.flagFunc.units_in_zones(vars)
|
|||||||
end
|
end
|
||||||
-- do another check in case stopflag was set true by this function
|
-- do another check in case stopflag was set true by this function
|
||||||
if (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 (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
|
||||||
mist.scheduleFunction(mist.flagFunc.units_in_zones, {{units = units, zones = zones, flag = flag, stopflag = stopflag, zone_type = zone_type, req_num = req_num, interval = interval, toggle = toggle}}, timer.getTime() + interval)
|
mist.scheduleFunction(mist.flagFunc.units_in_zones, {{units = units, zones = zones, flag = flag, stopflag = stopflag, zone_type = zone_type, req_num = req_num, interval = interval, toggle = toggle, unitTableDef = unitTableDef}}, timer.getTime() + interval)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3002,6 +3032,7 @@ function mist.flagFunc.units_in_moving_zones(vars)
|
|||||||
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
[{'req_num', 'reqnum'}] = {'number', 'nil'},
|
||||||
interval = {'number', 'nil'},
|
interval = {'number', 'nil'},
|
||||||
toggle = {'boolean', 'nil'},
|
toggle = {'boolean', 'nil'},
|
||||||
|
unitTableDef = {'table', 'nil'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_moving_zones', type_tbl, vars)
|
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_in_moving_zones', type_tbl, vars)
|
||||||
@ -3015,15 +3046,16 @@ function mist.flagFunc.units_in_moving_zones(vars)
|
|||||||
local req_num = vars.req_num or vars.reqnum or 1
|
local req_num = vars.req_num or vars.reqnum or 1
|
||||||
local interval = vars.interval or 1
|
local interval = vars.interval or 1
|
||||||
local toggle = vars.toggle or nil
|
local toggle = vars.toggle or nil
|
||||||
|
local unitTableDef = vars.unitTableDef
|
||||||
|
|
||||||
if not units.processed then -- run unit table short cuts
|
if not units.processed then
|
||||||
units = mist.makeUnitTable(units)
|
unitTableDef = mist.utils.deepCopy(units)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not zone_units.processed then -- run unit table short cuts
|
if (units.processed and units.processed < mist.getLastDBUpdateTime()) or not units.processed then -- run unit table short cuts
|
||||||
zone_units = mist.makeUnitTable(zone_units)
|
units = mist.makeUnitTable(unitTableDef)
|
||||||
end
|
end
|
||||||
|
|
||||||
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 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
|
||||||
|
|
||||||
local in_zone_units = mist.getUnitsInMovingZones(units, zone_units, radius, zone_type)
|
local in_zone_units = mist.getUnitsInMovingZones(units, zone_units, radius, zone_type)
|
||||||
@ -3118,6 +3150,8 @@ toggle = boolean or nil
|
|||||||
interval = {'number', 'nil'},
|
interval = {'number', 'nil'},
|
||||||
radius = {'number', 'nil'},
|
radius = {'number', 'nil'},
|
||||||
toggle = {'boolean', 'nil'},
|
toggle = {'boolean', 'nil'},
|
||||||
|
unitTableDef1 = {'table', 'nil'},
|
||||||
|
unitTableDef2 = {'table', 'nil'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_LOS', type_tbl, vars)
|
local err, errmsg = mist.utils.typeCheck('mist.flagFunc.units_LOS', type_tbl, vars)
|
||||||
@ -3132,16 +3166,26 @@ toggle = boolean or nil
|
|||||||
local radius = vars.radius or math.huge
|
local radius = vars.radius or math.huge
|
||||||
local req_num = vars.req_num or vars.reqnum or 1
|
local req_num = vars.req_num or vars.reqnum or 1
|
||||||
local toggle = vars.toggle or nil
|
local toggle = vars.toggle or nil
|
||||||
|
local unitTableDef1 = vars.unitTableDef1
|
||||||
|
local unitTableDef2 = vars.unitTableDef2
|
||||||
|
|
||||||
|
if not unitset1.processed then
|
||||||
if not unitset1.processed then -- run unit table short cuts
|
unitTableDef1 = mist.utils.deepCopy(unitset1)
|
||||||
unitset1 = mist.makeUnitTable(unitset1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not unitset2.processed then -- run unit table short cuts
|
if not unitset2.processed then
|
||||||
unitset2 = mist.makeUnitTable(unitset2)
|
unitTableDef2 = mist.utils.deepCopy(unitset2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if (unitset1.processed and unitset1.processed < mist.getLastDBUpdateTime()) or not unitset1.processed then -- run unit table short cuts
|
||||||
|
units = mist.makeUnitTable(unitTableDef1)
|
||||||
|
end
|
||||||
|
|
||||||
|
if (unitset2.processed and unitset2.processed < mist.getLastDBUpdateTime()) or not unitset2.processed then -- run unit table short cuts
|
||||||
|
units = mist.makeUnitTable(unitTableDef2)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
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 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
|
||||||
|
|
||||||
local unitLOSdata = mist.getUnitsLOS(unitset1, altoffset1, unitset2, altoffset2, radius)
|
local unitLOSdata = mist.getUnitsLOS(unitset1, altoffset1, unitset2, altoffset2, radius)
|
||||||
@ -3153,7 +3197,7 @@ toggle = boolean or nil
|
|||||||
end
|
end
|
||||||
-- do another check in case stopflag was set true by this function
|
-- do another check in case stopflag was set true by this function
|
||||||
if (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 (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
|
||||||
mist.scheduleFunction(mist.flagFunc.units_LOS, {{unitset1 = unitset1, altoffset1 = altoffset1, unitset2 = unitset2, altoffset2 = altoffset2, flag = flag, stopflag = stopflag, radius = radius, req_num = req_num, interval = interval, toggle = toggle}}, timer.getTime() + interval)
|
mist.scheduleFunction(mist.flagFunc.units_LOS, {{unitset1 = unitset1, altoffset1 = altoffset1, unitset2 = unitset2, altoffset2 = altoffset2, flag = flag, stopflag = stopflag, radius = radius, req_num = req_num, interval = interval, toggle = toggle, unitTableDef1 = unitTableDef1, unitTableDef2 = unitTableDef2}}, timer.getTime() + interval)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -3333,14 +3377,20 @@ end
|
|||||||
mist.getAvgPos = function(unitNames)
|
mist.getAvgPos = function(unitNames)
|
||||||
local avgX, avgY, avgZ, totNum = 0, 0, 0, 0
|
local avgX, avgY, avgZ, totNum = 0, 0, 0, 0
|
||||||
for i = 1, #unitNames do
|
for i = 1, #unitNames do
|
||||||
local unit = Unit.getByName(unitNames[i])
|
local unit
|
||||||
|
if Unit.getByName(unitNames[i]) then
|
||||||
|
unit = Unit.getByName(unitNames[i])
|
||||||
|
elseif StaticObject.getByName(unitNames[i]) then
|
||||||
|
unit = StaticObject.getByName(unitNames[i])
|
||||||
|
end
|
||||||
if unit then
|
if unit then
|
||||||
|
|
||||||
local pos = unit:getPosition().p
|
local pos = unit:getPosition().p
|
||||||
avgX = avgX + pos.x
|
if pos then -- you never know O.o
|
||||||
avgY = avgY + pos.y
|
avgX = avgX + pos.x
|
||||||
avgZ = avgZ + pos.z
|
avgY = avgY + pos.y
|
||||||
totNum = totNum + 1
|
avgZ = avgZ + pos.z
|
||||||
|
totNum = totNum + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if totNum ~= 0 then
|
if totNum ~= 0 then
|
||||||
@ -4127,6 +4177,7 @@ do
|
|||||||
trigger.action.outSoundForCoalition(coalition.side.BLUE, msgTableSound['BLUE'])
|
trigger.action.outSoundForCoalition(coalition.side.BLUE, msgTableSound['BLUE'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for index, file in pairs(msgTableSound) do
|
for index, file in pairs(msgTableSound) do
|
||||||
if type(index) == 'number' then -- its a groupNumber
|
if type(index) == 'number' then -- its a groupNumber
|
||||||
trigger.action.outSoundForGroup(index, file)
|
trigger.action.outSoundForGroup(index, file)
|
||||||
@ -4211,7 +4262,7 @@ do
|
|||||||
local found = false
|
local found = false
|
||||||
for clientDataEntry, clientDataVal in pairs(clientData) do
|
for clientDataEntry, clientDataVal in pairs(clientData) do
|
||||||
if type(clientDataVal) == 'string' then
|
if type(clientDataVal) == 'string' then
|
||||||
if string.lower(list) == string.lower(clientDataVal) or list == 'all' then
|
if mist.matchString(list, clientDataVal) == true or list == 'all' then
|
||||||
if typeData == clientData.type then
|
if typeData == clientData.type then
|
||||||
found = true
|
found = true
|
||||||
newMsgFor = msgSpamFilter(newMsgFor, clientData.groupId) -- sends info oto other function to see if client is already recieving the current message.
|
newMsgFor = msgSpamFilter(newMsgFor, clientData.groupId) -- sends info oto other function to see if client is already recieving the current message.
|
||||||
@ -5136,11 +5187,15 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
|
|||||||
newGroupData.units[unitNum]["y"] = unitData.y + diff.y
|
newGroupData.units[unitNum]["y"] = unitData.y + diff.y
|
||||||
end
|
end
|
||||||
if point then
|
if point then
|
||||||
if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') and point.z then
|
if (newGroupData.category == 'plane' or newGroupData.category == 'helicopter') then
|
||||||
if point.y > 0 and point.y > land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
if point.z and point.y > 0 and point.y > land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 10 then
|
||||||
newGroupData.units[unitNum]["alt"] = point.y
|
newGroupData.units[unitNum]["alt"] = point.y
|
||||||
else
|
else
|
||||||
newGroupData.units[unitNum]["alt"] = land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + 300
|
if newGroupData.category == 'plane' then
|
||||||
|
newGroupData.units[unitNum]["alt"] = land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + math.random(300, 9000)
|
||||||
|
else
|
||||||
|
newGroupData.units[unitNum]["alt"] = land.getHeight({newGroupData.units[unitNum]["x"], newGroupData.units[unitNum]["y"]}) + math.random(200, 3000)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,3 +1,13 @@
|
|||||||
|
v53
|
||||||
|
-added mist.getAvgPos now accepts static objects in addition to units.
|
||||||
|
-made DB creation check the mission editor version for no paticular reason
|
||||||
|
-added mist.getLastDBUpdateTime which returns the most recent time the DB update function has run.
|
||||||
|
-changed mist.makeUnitTable processed entry to return the time it was processed instead of a boolean value.
|
||||||
|
-Changed teleport/respawn/clone functions to spawn aircraft at random altitudes instead of constants if the point given is vec2/not specified.
|
||||||
|
-Fixed FlagFuncs will now recognize units added in dynamically. Note this only applies if you send it unitTableNames identifier and not the table that the function creates.
|
||||||
|
-Added variable to all flagfuncs. unitTableDef is the original definition used for units.
|
||||||
|
-Fixed all getUserFlag checks to compare with numerical value instead of boolean
|
||||||
|
|
||||||
v52
|
v52
|
||||||
-Fixed check in mist.getUnitsLOS to verify units are active in a mission
|
-Fixed check in mist.getUnitsLOS to verify units are active in a mission
|
||||||
-Fixed check in mist.goRoute to verify both the group and controller are valid before assigning the route
|
-Fixed check in mist.goRoute to verify both the group and controller are valid before assigning the route
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user