mirror of
https://github.com/mrSkortch/MissionScriptingTools.git
synced 2026-08-11 19:57:25 +00:00
fixed mixed-indention, removed trailing spaces
This commit is contained in:
@@ -588,8 +588,8 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
mist.dynAdd = function(newGroup) -- same as coalition.add function in SSE. checks the passed data to see if its valid.
|
mist.dynAdd = function(newGroup) -- same as coalition.add function in SSE. checks the passed data to see if its valid.
|
||||||
--Will generate groupId, groupName, unitId, and unitName if needed
|
--Will generate groupId, groupName, unitId, and unitName if needed
|
||||||
--
|
--
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -770,8 +770,8 @@ do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------
|
||||||
--Modified Slmod task scheduler, superior to timer.scheduleFunction
|
--Modified Slmod task scheduler, superior to timer.scheduleFunction
|
||||||
|
|
||||||
local Tasks = {}
|
local Tasks = {}
|
||||||
local task_id = 0
|
local task_id = 0
|
||||||
@@ -875,7 +875,7 @@ do
|
|||||||
end
|
end
|
||||||
|
|
||||||
mist.addEventHandler(groupSpawned)
|
mist.addEventHandler(groupSpawned)
|
||||||
-- mist.scheduleFunction(checkSpawnedEvents, {}, timer.getTime() + 5, 1)
|
-- mist.scheduleFunction(checkSpawnedEvents, {}, timer.getTime() + 5, 1)
|
||||||
|
|
||||||
end
|
end
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1896,7 +1896,7 @@ end
|
|||||||
|
|
||||||
mist.DBs.navPoints = {}
|
mist.DBs.navPoints = {}
|
||||||
mist.DBs.units = {}
|
mist.DBs.units = {}
|
||||||
--Build mist.db.units and mist.DBs.navPoints
|
--Build mist.db.units and mist.DBs.navPoints
|
||||||
for coa_name, coa_data in pairs(env.mission.coalition) do
|
for coa_name, coa_data in pairs(env.mission.coalition) do
|
||||||
|
|
||||||
if (coa_name == 'red' or coa_name == 'blue') and type(coa_data) == 'table' then
|
if (coa_name == 'red' or coa_name == 'blue') and type(coa_data) == 'table' then
|
||||||
@@ -2060,16 +2060,16 @@ mist.DBs.aliveUnits = {} -- will be filled in by the "update_alive_units" corou
|
|||||||
mist.DBs.removedAliveUnits = {} -- will be filled in by the "update_alive_units" coroutine in mist.main.
|
mist.DBs.removedAliveUnits = {} -- will be filled in by the "update_alive_units" coroutine in mist.main.
|
||||||
-- create mist.DBs.oldAliveUnits
|
-- create mist.DBs.oldAliveUnits
|
||||||
-- do
|
-- do
|
||||||
-- local intermediate_alive_units = {} -- between 0 and 0.5 secs old
|
-- local intermediate_alive_units = {} -- between 0 and 0.5 secs old
|
||||||
-- local function make_old_alive_units() -- called every 0.5 secs, makes the old_alive_units DB which is just a copy of alive_units that is 0.5 to 1 sec old
|
-- local function make_old_alive_units() -- called every 0.5 secs, makes the old_alive_units DB which is just a copy of alive_units that is 0.5 to 1 sec old
|
||||||
-- if intermediate_alive_units then
|
-- if intermediate_alive_units then
|
||||||
-- mist.DBs.oldAliveUnits = mist.utils.deepCopy(intermediate_alive_units)
|
-- mist.DBs.oldAliveUnits = mist.utils.deepCopy(intermediate_alive_units)
|
||||||
-- end
|
-- end
|
||||||
-- intermediate_alive_units = mist.utils.deepCopy(mist.DBs.aliveUnits)
|
-- intermediate_alive_units = mist.utils.deepCopy(mist.DBs.aliveUnits)
|
||||||
-- timer.scheduleFunction(make_old_alive_units, nil, timer.getTime() + 0.5)
|
-- timer.scheduleFunction(make_old_alive_units, nil, timer.getTime() + 0.5)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
-- make_old_alive_units()
|
-- make_old_alive_units()
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
@@ -2295,7 +2295,7 @@ end
|
|||||||
|
|
||||||
function mist.makeUnitTable(tbl)
|
function mist.makeUnitTable(tbl)
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Prefixes:
|
Prefixes:
|
||||||
"[-u]<unit name>" - subtract this unit if its in the table
|
"[-u]<unit name>" - subtract this unit if its in the table
|
||||||
"[g]<group name>" - add this group to the table
|
"[g]<group name>" - add this group to the table
|
||||||
@@ -2396,7 +2396,7 @@ Country names to be used in [c] and [-c] short-cuts:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif unit:sub(1,4) == '[-g]' then -- subtract a group
|
elseif unit:sub(1,4) == '[-g]' then -- subtract a group
|
||||||
for coa, coa_tbl in pairs(l_munits) do
|
for coa, coa_tbl in pairs(l_munits) do
|
||||||
for country, country_table in pairs(coa_tbl) do
|
for country, country_table in pairs(coa_tbl) do
|
||||||
for unit_type, unit_type_tbl in pairs(country_table) do
|
for unit_type, unit_type_tbl in pairs(country_table) do
|
||||||
@@ -2413,7 +2413,7 @@ Country names to be used in [c] and [-c] short-cuts:
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif unit:sub(1,3) == '[c]' then -- add a country
|
elseif unit:sub(1,3) == '[c]' then -- add a country
|
||||||
local category = ''
|
local category = ''
|
||||||
local country_start = 4
|
local country_start = 4
|
||||||
@@ -2671,8 +2671,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
mist.getDeadMapObjsInZones = function(zone_names)
|
mist.getDeadMapObjsInZones = function(zone_names)
|
||||||
-- zone_names: table of zone names
|
-- zone_names: table of zone names
|
||||||
-- returns: table of dead map objects (indexed numerically)
|
-- returns: table of dead map objects (indexed numerically)
|
||||||
local map_objs = {}
|
local map_objs = {}
|
||||||
local zones = {}
|
local zones = {}
|
||||||
for i = 1, #zone_names do
|
for i = 1, #zone_names do
|
||||||
@@ -2694,8 +2694,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
mist.getDeadMapObjsInPolygonZone = function(zone)
|
mist.getDeadMapObjsInPolygonZone = function(zone)
|
||||||
-- zone_names: table of zone names
|
-- zone_names: table of zone names
|
||||||
-- returns: table of dead map objects (indexed numerically)
|
-- returns: table of dead map objects (indexed numerically)
|
||||||
local map_objs = {}
|
local map_objs = {}
|
||||||
for obj_id, obj in pairs(mist.DBs.deadObjects) do
|
for obj_id, obj in pairs(mist.DBs.deadObjects) do
|
||||||
if obj.objectType and obj.objectType == 'building' then --dead map object
|
if obj.objectType and obj.objectType == 'building' then --dead map object
|
||||||
@@ -2710,7 +2710,7 @@ end
|
|||||||
mist.flagFunc = {}
|
mist.flagFunc = {}
|
||||||
|
|
||||||
mist.flagFunc.mapobjs_dead_zones = function(vars)
|
mist.flagFunc.mapobjs_dead_zones = function(vars)
|
||||||
--[[vars needs to be:
|
--[[vars needs to be:
|
||||||
zones = table or string,
|
zones = table or string,
|
||||||
flag = number,
|
flag = number,
|
||||||
stopflag = number or nil,
|
stopflag = number or nil,
|
||||||
@@ -2720,7 +2720,7 @@ AND used by function,
|
|||||||
initial_number
|
initial_number
|
||||||
|
|
||||||
]]
|
]]
|
||||||
-- type_tbl
|
-- type_tbl
|
||||||
local type_tbl = {
|
local type_tbl = {
|
||||||
[{'zones', 'zone'}] = {'table', 'string'},
|
[{'zones', 'zone'}] = {'table', 'string'},
|
||||||
flag = {'number', 'string'},
|
flag = {'number', 'string'},
|
||||||
@@ -2757,7 +2757,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
mist.flagFunc.mapobjs_dead_polygon = function(vars)
|
mist.flagFunc.mapobjs_dead_polygon = function(vars)
|
||||||
--[[vars needs to be:
|
--[[vars needs to be:
|
||||||
zone = table,
|
zone = table,
|
||||||
flag = number,
|
flag = number,
|
||||||
stopflag = number or nil,
|
stopflag = number or nil,
|
||||||
@@ -2767,7 +2767,7 @@ AND used by function,
|
|||||||
initial_number
|
initial_number
|
||||||
|
|
||||||
]]
|
]]
|
||||||
-- type_tbl
|
-- type_tbl
|
||||||
local type_tbl = {
|
local type_tbl = {
|
||||||
[{'zone', 'polyzone'}] = 'table',
|
[{'zone', 'polyzone'}] = 'table',
|
||||||
flag = {'number', 'string'},
|
flag = {'number', 'string'},
|
||||||
@@ -2855,7 +2855,7 @@ mist.getUnitsInPolygon = function (unit_names, polyZone, max_alt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function mist.flagFunc.units_in_polygon(vars)
|
function mist.flagFunc.units_in_polygon(vars)
|
||||||
--[[vars needs to be:
|
--[[vars needs to be:
|
||||||
units = table,
|
units = table,
|
||||||
zone = table,
|
zone = table,
|
||||||
flag = number,
|
flag = number,
|
||||||
@@ -2866,7 +2866,7 @@ req_num = number or nil
|
|||||||
toggle = boolean or nil
|
toggle = boolean or nil
|
||||||
unitTableDef = table or nil
|
unitTableDef = table or nil
|
||||||
]]
|
]]
|
||||||
-- type_tbl
|
-- type_tbl
|
||||||
local type_tbl = {
|
local type_tbl = {
|
||||||
[{'units', 'unit'}] = 'table',
|
[{'units', 'unit'}] = 'table',
|
||||||
[{'zone', 'polyzone'}] = 'table',
|
[{'zone', 'polyzone'}] = 'table',
|
||||||
@@ -3224,7 +3224,7 @@ mist.getUnitsLOS = function(unitset1, altoffset1, unitset2, altoffset2, radius)
|
|||||||
end
|
end
|
||||||
|
|
||||||
mist.flagFunc.units_LOS = function(vars)
|
mist.flagFunc.units_LOS = function(vars)
|
||||||
--[[vars needs to be:
|
--[[vars needs to be:
|
||||||
unitset1 = table,
|
unitset1 = table,
|
||||||
altoffset1 = number,
|
altoffset1 = number,
|
||||||
unitset2 = table,
|
unitset2 = table,
|
||||||
@@ -3236,7 +3236,7 @@ interval = number or nil,
|
|||||||
req_num = number or nil
|
req_num = number or nil
|
||||||
toggle = boolean or nil
|
toggle = boolean or nil
|
||||||
]]
|
]]
|
||||||
-- type_tbl
|
-- type_tbl
|
||||||
local type_tbl = {
|
local type_tbl = {
|
||||||
[{'unitset1', 'units1'}] = 'table',
|
[{'unitset1', 'units1'}] = 'table',
|
||||||
[{'altoffset1', 'alt1'}] = 'number',
|
[{'altoffset1', 'alt1'}] = 'number',
|
||||||
@@ -3301,7 +3301,7 @@ toggle = boolean or nil
|
|||||||
end
|
end
|
||||||
|
|
||||||
mist.flagFunc.group_alive = function(vars)
|
mist.flagFunc.group_alive = function(vars)
|
||||||
--[[vars
|
--[[vars
|
||||||
groupName
|
groupName
|
||||||
flag
|
flag
|
||||||
toggle
|
toggle
|
||||||
@@ -4330,7 +4330,7 @@ do
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end]]
|
end]]
|
||||||
|
|
||||||
mist.message = {
|
mist.message = {
|
||||||
|
|
||||||
@@ -4755,14 +4755,14 @@ mist.msgMGRS = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ vars for mist.msgLL
|
--[[ vars for mist.msgLL
|
||||||
@@ -4789,15 +4789,15 @@ mist.msgLL = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4828,15 +4828,15 @@ mist.msgBR = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4911,15 +4911,15 @@ mist.msgLeadingMGRS = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -4954,15 +4954,15 @@ mist.msgLeadingLL = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -4999,15 +4999,15 @@ mist.msgLeadingBR = function(vars)
|
|||||||
else -- else, just append to the end.
|
else -- else, just append to the end.
|
||||||
newText = text .. s
|
newText = text .. s
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
newText = s
|
newText = s
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.message.add{
|
mist.message.add{
|
||||||
text = newText,
|
text = newText,
|
||||||
displayTime = displayTime,
|
displayTime = displayTime,
|
||||||
msgFor = msgFor
|
msgFor = msgFor
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -5020,7 +5020,7 @@ end
|
|||||||
do -- all function uses of group and unit Ids must be in this do statement
|
do -- all function uses of group and unit Ids must be in this do statement
|
||||||
|
|
||||||
|
|
||||||
mist.groupTableCheck = function(groupData)
|
mist.groupTableCheck = function(groupData)
|
||||||
local isOk = false
|
local isOk = false
|
||||||
|
|
||||||
if groupData.country then
|
if groupData.country then
|
||||||
@@ -5042,9 +5042,9 @@ mist.groupTableCheck = function(groupData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return isOk
|
return isOk
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getCurrentGroupData = function(gpName)
|
mist.getCurrentGroupData = function(gpName)
|
||||||
local dbData = mist.getGroupData(gpName)
|
local dbData = mist.getGroupData(gpName)
|
||||||
|
|
||||||
if Group.getByName(gpName) and Group.getByName(gpName):isExist() == true then
|
if Group.getByName(gpName) and Group.getByName(gpName):isExist() == true then
|
||||||
@@ -5092,9 +5092,9 @@ mist.getCurrentGroupData = function(gpName)
|
|||||||
return dbData
|
return dbData
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getGroupData = function(gpName)
|
mist.getGroupData = function(gpName)
|
||||||
local found = false
|
local found = false
|
||||||
local newData = {}
|
local newData = {}
|
||||||
if mist.DBs.groupsByName[gpName] then
|
if mist.DBs.groupsByName[gpName] then
|
||||||
@@ -5157,9 +5157,9 @@ mist.getGroupData = function(gpName)
|
|||||||
env.info(gpName .. ' not found in mist.getGroupData')
|
env.info(gpName .. ' not found in mist.getGroupData')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getPayload = function(unitIdent)
|
mist.getPayload = function(unitIdent)
|
||||||
-- refactor to search by groupId and allow groupId and groupName as inputs
|
-- refactor to search by groupId and allow groupId and groupName as inputs
|
||||||
local unitId = unitIdent
|
local unitId = unitIdent
|
||||||
if type(unitIdent) == 'string' and not tonumber(unitIdent) then
|
if type(unitIdent) == 'string' and not tonumber(unitIdent) then
|
||||||
@@ -5197,9 +5197,9 @@ mist.getPayload = function(unitIdent)
|
|||||||
end
|
end
|
||||||
env.info('mist.getPayload, payload not found')
|
env.info('mist.getPayload, payload not found')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getGroupPayload = function(groupIdent)
|
mist.getGroupPayload = function(groupIdent)
|
||||||
local gpId = groupIdent
|
local gpId = groupIdent
|
||||||
if type(groupIdent) == 'string' and not tonumber(groupIdent) then
|
if type(groupIdent) == 'string' and not tonumber(groupIdent) then
|
||||||
gpId = mist.DBs.MEgroupsByName[groupIdent].groupId
|
gpId = mist.DBs.MEgroupsByName[groupIdent].groupId
|
||||||
@@ -5236,9 +5236,9 @@ mist.getGroupPayload = function(groupIdent)
|
|||||||
env.info('mist.getGroupPayload, payload not found')
|
env.info('mist.getGroupPayload, payload not found')
|
||||||
return
|
return
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.teleportToPoint = function(vars) -- main teleport function that all of teleport/respawn functions call
|
mist.teleportToPoint = function(vars) -- main teleport function that all of teleport/respawn functions call
|
||||||
local point = vars.point
|
local point = vars.point
|
||||||
|
|
||||||
local gpName
|
local gpName
|
||||||
@@ -5372,9 +5372,9 @@ mist.teleportToPoint = function(vars) -- main teleport function that all of tele
|
|||||||
end
|
end
|
||||||
return mist.dynAdd(newGroupData)
|
return mist.dynAdd(newGroupData)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.respawnInZone = function(gpName, zone, disperse, maxDisp)
|
mist.respawnInZone = function(gpName, zone, disperse, maxDisp)
|
||||||
|
|
||||||
if type(gpName) == 'table' and gpName:getName() then
|
if type(gpName) == 'table' and gpName:getName() then
|
||||||
gpName = gpName:getName()
|
gpName = gpName:getName()
|
||||||
@@ -5397,9 +5397,9 @@ mist.respawnInZone = function(gpName, zone, disperse, maxDisp)
|
|||||||
vars.disperse = disperse
|
vars.disperse = disperse
|
||||||
vars.maxDisp = maxDisp
|
vars.maxDisp = maxDisp
|
||||||
return mist.teleportToPoint(vars)
|
return mist.teleportToPoint(vars)
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.cloneInZone = function(gpName, zone, disperse, maxDisp)
|
mist.cloneInZone = function(gpName, zone, disperse, maxDisp)
|
||||||
|
|
||||||
if type(gpName) == 'table' then
|
if type(gpName) == 'table' then
|
||||||
gpName = gpName:getName()
|
gpName = gpName:getName()
|
||||||
@@ -5420,9 +5420,9 @@ mist.cloneInZone = function(gpName, zone, disperse, maxDisp)
|
|||||||
vars.disperse = disperse
|
vars.disperse = disperse
|
||||||
vars.maxDisp = maxDisp
|
vars.maxDisp = maxDisp
|
||||||
return mist.teleportToPoint(vars)
|
return mist.teleportToPoint(vars)
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.teleportInZone = function(gpName, zone, disperse, maxDisp) -- groupName, zoneName or table of Zone Names, keepForm is a boolean
|
mist.teleportInZone = function(gpName, zone, disperse, maxDisp) -- groupName, zoneName or table of Zone Names, keepForm is a boolean
|
||||||
if type(gpName) == 'table' and gpName:getName() then
|
if type(gpName) == 'table' and gpName:getName() then
|
||||||
gpName = gpName:getName()
|
gpName = gpName:getName()
|
||||||
else
|
else
|
||||||
@@ -5443,9 +5443,9 @@ mist.teleportInZone = function(gpName, zone, disperse, maxDisp) -- groupName, zo
|
|||||||
vars.disperse = disperse
|
vars.disperse = disperse
|
||||||
vars.maxDisp = maxDisp
|
vars.maxDisp = maxDisp
|
||||||
return mist.teleportToPoint(vars)
|
return mist.teleportToPoint(vars)
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.respawnGroup = function(gpName, task)
|
mist.respawnGroup = function(gpName, task)
|
||||||
local vars = {}
|
local vars = {}
|
||||||
vars.gpName = gpName
|
vars.gpName = gpName
|
||||||
vars.action = 'respawn'
|
vars.action = 'respawn'
|
||||||
@@ -5458,9 +5458,9 @@ mist.respawnGroup = function(gpName, task)
|
|||||||
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
||||||
end
|
end
|
||||||
return newGroup
|
return newGroup
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.cloneGroup = function(gpName, task)
|
mist.cloneGroup = function(gpName, task)
|
||||||
local vars = {}
|
local vars = {}
|
||||||
vars.gpName = gpName
|
vars.gpName = gpName
|
||||||
vars.action = 'clone'
|
vars.action = 'clone'
|
||||||
@@ -5473,9 +5473,9 @@ mist.cloneGroup = function(gpName, task)
|
|||||||
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
||||||
end
|
end
|
||||||
return newGroup
|
return newGroup
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.teleportGroup = function(gpName, task)
|
mist.teleportGroup = function(gpName, task)
|
||||||
local vars = {}
|
local vars = {}
|
||||||
vars.gpName = gpName
|
vars.gpName = gpName
|
||||||
vars.action = 'teleport'
|
vars.action = 'teleport'
|
||||||
@@ -5488,9 +5488,9 @@ mist.teleportGroup = function(gpName, task)
|
|||||||
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
mist.scheduleFunction(mist.goRoute, {newGroup, newRoute}, timer.getTime() + task)
|
||||||
end
|
end
|
||||||
return newGroup
|
return newGroup
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.spawnRandomizedGroup = function(groupName, vars) -- need to debug
|
mist.spawnRandomizedGroup = function(groupName, vars) -- need to debug
|
||||||
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true then
|
if Group.getByName(groupName) and Group.getByName(groupName):isExist() == true then
|
||||||
local gpData = mist.getGroupData(groupName)
|
local gpData = mist.getGroupData(groupName)
|
||||||
gpData.units = mist.randomizeGroupOrder(gpData.units, vars)
|
gpData.units = mist.randomizeGroupOrder(gpData.units, vars)
|
||||||
@@ -5500,9 +5500,9 @@ mist.spawnRandomizedGroup = function(groupName, vars) -- need to debug
|
|||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.randomizeNumTable = function(vars)
|
mist.randomizeNumTable = function(vars)
|
||||||
local newTable = {}
|
local newTable = {}
|
||||||
|
|
||||||
local excludeIndex = {}
|
local excludeIndex = {}
|
||||||
@@ -5573,9 +5573,9 @@ mist.randomizeNumTable = function(vars)
|
|||||||
end
|
end
|
||||||
]]
|
]]
|
||||||
return newTable
|
return newTable
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.randomizeGroupOrder = function(passedUnits, vars)
|
mist.randomizeGroupOrder = function(passedUnits, vars)
|
||||||
-- figure out what to exclude, and send data to other func
|
-- figure out what to exclude, and send data to other func
|
||||||
local units = passedUnits
|
local units = passedUnits
|
||||||
|
|
||||||
@@ -5640,9 +5640,9 @@ mist.randomizeGroupOrder = function(passedUnits, vars)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
return newGroup
|
return newGroup
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.ground.patrolRoute = function(vars)
|
mist.ground.patrolRoute = function(vars)
|
||||||
|
|
||||||
|
|
||||||
local tempRoute = {}
|
local tempRoute = {}
|
||||||
@@ -5741,9 +5741,9 @@ mist.ground.patrolRoute = function(vars)
|
|||||||
mist.goRoute(gpData, useRoute)
|
mist.goRoute(gpData, useRoute)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.ground.patrol = function(gpData, pType, form, speed)
|
mist.ground.patrol = function(gpData, pType, form, speed)
|
||||||
local vars = {}
|
local vars = {}
|
||||||
|
|
||||||
if type(gpData) == 'table' and gpData:getName() then
|
if type(gpData) == 'table' and gpData:getName() then
|
||||||
@@ -5759,10 +5759,10 @@ mist.ground.patrol = function(gpData, pType, form, speed)
|
|||||||
mist.ground.patrolRoute(vars)
|
mist.ground.patrolRoute(vars)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
mist.random = function(firstNum, secondNum) -- no support for decimals
|
mist.random = function(firstNum, secondNum) -- no support for decimals
|
||||||
local lowNum, highNum
|
local lowNum, highNum
|
||||||
if not secondNum then
|
if not secondNum then
|
||||||
highNum = firstNum
|
highNum = firstNum
|
||||||
@@ -5786,11 +5786,11 @@ mist.random = function(firstNum, secondNum) -- no support for decimals
|
|||||||
rtnVal = math.random(#choices) -- iterate a few times for giggles
|
rtnVal = math.random(#choices) -- iterate a few times for giggles
|
||||||
end
|
end
|
||||||
return choices[rtnVal]
|
return choices[rtnVal]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mist.stringMatch = function(s1, s2, bool)
|
mist.stringMatch = function(s1, s2, bool)
|
||||||
local exclude = {'%-', '%(', '%)', '%_', '%[', '%]', '%.', '%#', '% ', '%{', '%}', '%$', '%%', '%?', '%+', '%^'}
|
local exclude = {'%-', '%(', '%)', '%_', '%[', '%]', '%.', '%#', '% ', '%{', '%}', '%$', '%%', '%?', '%+', '%^'}
|
||||||
if type(s1) == 'string' and type(s2) == 'string' then
|
if type(s1) == 'string' and type(s2) == 'string' then
|
||||||
for i , str in pairs(exclude) do
|
for i , str in pairs(exclude) do
|
||||||
@@ -5811,16 +5811,16 @@ mist.stringMatch = function(s1, s2, bool)
|
|||||||
env.info('mist.stringMatch; Either the first or second variable were not a string')
|
env.info('mist.stringMatch; Either the first or second variable were not a string')
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.matchString = mist.stringMatch -- both commands work because order out type of I
|
mist.matchString = mist.stringMatch -- both commands work because order out type of I
|
||||||
|
|
||||||
mist.time = {}
|
mist.time = {}
|
||||||
-- returns a string for specified military time
|
-- returns a string for specified military time
|
||||||
-- theTime is optional
|
-- theTime is optional
|
||||||
-- if present current time in mil time is returned
|
-- if present current time in mil time is returned
|
||||||
-- if number or table the time is converted into mil tim
|
-- if number or table the time is converted into mil tim
|
||||||
mist.time.convertToSec = function(timeTable)
|
mist.time.convertToSec = function(timeTable)
|
||||||
|
|
||||||
timeInSec = 0
|
timeInSec = 0
|
||||||
if timeTable and type(timeTable) == 'number' then
|
if timeTable and type(timeTable) == 'number' then
|
||||||
@@ -5841,9 +5841,9 @@ mist.time.convertToSec = function(timeTable)
|
|||||||
|
|
||||||
end
|
end
|
||||||
return timeInSec
|
return timeInSec
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.time.getDHMS = function(timeInSec)
|
mist.time.getDHMS = function(timeInSec)
|
||||||
if timeInSec and type(timeInSec) == 'number' then
|
if timeInSec and type(timeInSec) == 'number' then
|
||||||
local tbl = {d = 0, h = 0, m = 0, s = 0}
|
local tbl = {d = 0, h = 0, m = 0, s = 0}
|
||||||
if timeInSec > 86400 then
|
if timeInSec > 86400 then
|
||||||
@@ -5870,9 +5870,9 @@ mist.time.getDHMS = function(timeInSec)
|
|||||||
env.info('mist.time.getDHMS didnt recieve number')
|
env.info('mist.time.getDHMS didnt recieve number')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getMilString = function(theTime)
|
mist.getMilString = function(theTime)
|
||||||
local timeInSec = 0
|
local timeInSec = 0
|
||||||
if theTime then
|
if theTime then
|
||||||
timeInSec = mist.time.convertToSec(theTime)
|
timeInSec = mist.time.convertToSec(theTime)
|
||||||
@@ -5883,9 +5883,9 @@ mist.getMilString = function(theTime)
|
|||||||
local DHMS = mist.time.getDHMS(timeInSec)
|
local DHMS = mist.time.getDHMS(timeInSec)
|
||||||
|
|
||||||
return tostring(string.format('%02d', DHMS.h) .. string.format('%02d',DHMS.m))
|
return tostring(string.format('%02d', DHMS.h) .. string.format('%02d',DHMS.m))
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getClockString = function(theTime, hour)
|
mist.getClockString = function(theTime, hour)
|
||||||
local timeInSec = 0
|
local timeInSec = 0
|
||||||
if theTime then
|
if theTime then
|
||||||
timeInSec = mist.time.convertToSec(theTime)
|
timeInSec = mist.time.convertToSec(theTime)
|
||||||
@@ -5903,13 +5903,13 @@ mist.getClockString = function(theTime, hour)
|
|||||||
else
|
else
|
||||||
return tostring(string.format('%02d', DHMS.h) .. ':' .. string.format('%02d',DHMS.m) .. ':' .. string.format('%02d',DHMS.s))
|
return tostring(string.format('%02d', DHMS.h) .. ':' .. string.format('%02d',DHMS.m) .. ':' .. string.format('%02d',DHMS.s))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- returns the date in string format
|
-- returns the date in string format
|
||||||
-- both variables optional
|
-- both variables optional
|
||||||
-- first val returns with the month as a string
|
-- first val returns with the month as a string
|
||||||
-- 2nd val defins if it should be written the American way or the wrong way.
|
-- 2nd val defins if it should be written the American way or the wrong way.
|
||||||
mist.time.getDate = function(convert)
|
mist.time.getDate = function(convert)
|
||||||
local cal = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} -- starts at june. 2011. 2012 is leap year, sigh. add a simple check for leap year
|
local cal = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} -- starts at june. 2011. 2012 is leap year, sigh. add a simple check for leap year
|
||||||
local date = {}
|
local date = {}
|
||||||
date.d = 0
|
date.d = 0
|
||||||
@@ -5940,15 +5940,15 @@ mist.time.getDate = function(convert)
|
|||||||
start = start + 86400
|
start = start + 86400
|
||||||
end
|
end
|
||||||
return date
|
return date
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.time.relativeToStart = function(time)
|
mist.time.relativeToStart = function(time)
|
||||||
if type(time) == 'number' then
|
if type(time) == 'number' then
|
||||||
return time - timer.getTime0()
|
return time - timer.getTime0()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.getDateString = function(rtnType, murica, oTime) -- returns date based on time
|
mist.getDateString = function(rtnType, murica, oTime) -- returns date based on time
|
||||||
local word = {'January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' } -- 'etc
|
local word = {'January', 'Feburary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' } -- 'etc
|
||||||
local curTime = 0
|
local curTime = 0
|
||||||
if oTime then
|
if oTime then
|
||||||
@@ -5971,9 +5971,9 @@ mist.getDateString = function(rtnType, murica, oTime) -- returns date based on t
|
|||||||
return tostring(tbl.d .. '.' .. tbl.m .. '.' .. tbl.y)
|
return tostring(tbl.d .. '.' .. tbl.m .. '.' .. tbl.y)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--WIP
|
--WIP
|
||||||
mist.time.milToGame = function(milString, rtnType) --converts a military time. By default returns the abosolute time that event would occur. With optional value it returns how many seconds from time of call till that time.
|
mist.time.milToGame = function(milString, rtnType) --converts a military time. By default returns the abosolute time that event would occur. With optional value it returns how many seconds from time of call till that time.
|
||||||
local curTime = mist.utils.round(timer.getAbsTime())
|
local curTime = mist.utils.round(timer.getAbsTime())
|
||||||
local milTimeInSec = 0
|
local milTimeInSec = 0
|
||||||
|
|
||||||
@@ -6001,18 +6001,18 @@ mist.time.milToGame = function(milString, rtnType) --converts a military time. B
|
|||||||
milTimeInSec = milTimeInSec - startTime
|
milTimeInSec = milTimeInSec - startTime
|
||||||
end
|
end
|
||||||
return milTimeInSec
|
return milTimeInSec
|
||||||
end
|
end
|
||||||
|
|
||||||
mist.DBs.const = {}
|
mist.DBs.const = {}
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
['LAND'] = 1,
|
['LAND'] = 1,
|
||||||
['SHALLOW_WATER'] = 2,
|
['SHALLOW_WATER'] = 2,
|
||||||
['WATER'] = 3,
|
['WATER'] = 3,
|
||||||
['ROAD'] = 4,
|
['ROAD'] = 4,
|
||||||
['RUNWAY'] = 5
|
['RUNWAY'] = 5
|
||||||
]]
|
]]
|
||||||
--[[mist.DBs.const.ME_SSE_terms = {
|
--[[mist.DBs.const.ME_SSE_terms = {
|
||||||
['ME'] = {
|
['ME'] = {
|
||||||
['vehicle'] = {'GROUND', 'GROUND_UNIT'},
|
['vehicle'] = {'GROUND', 'GROUND_UNIT'},
|
||||||
['plane'] = {'AIRPLANE'},
|
['plane'] = {'AIRPLANE'},
|
||||||
@@ -6023,7 +6023,7 @@ mist.DBs.const = {}
|
|||||||
}]]
|
}]]
|
||||||
|
|
||||||
|
|
||||||
mist.DBs.const.callsigns = { -- not accessible by SSE, must use static list :-/
|
mist.DBs.const.callsigns = { -- not accessible by SSE, must use static list :-/
|
||||||
['NATO'] = {
|
['NATO'] = {
|
||||||
['rules'] = {
|
['rules'] = {
|
||||||
['groupLimit'] = 9,
|
['groupLimit'] = 9,
|
||||||
@@ -6091,13 +6091,13 @@ mist.DBs.const.callsigns = { -- not accessible by SSE, must use static list :-/
|
|||||||
|
|
||||||
}
|
}
|
||||||
--[[ scope:
|
--[[ scope:
|
||||||
{
|
{
|
||||||
units = {...}, -- unit names.
|
units = {...}, -- unit names.
|
||||||
coa = {...}, -- coa names
|
coa = {...}, -- coa names
|
||||||
countries = {...}, -- country names
|
countries = {...}, -- country names
|
||||||
CA = {...}, -- looks just like coa.
|
CA = {...}, -- looks just like coa.
|
||||||
unitTypes = { red = {}, blue = {}, all = {}, Russia = {},}
|
unitTypes = { red = {}, blue = {}, all = {}, Russia = {},}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scope examples:
|
scope examples:
|
||||||
@@ -6113,3 +6113,6 @@ scope examples:
|
|||||||
end
|
end
|
||||||
mist.main()
|
mist.main()
|
||||||
env.info(('Mist version ' .. mist.majorVersion .. '.' .. mist.minorVersion .. '.' .. mist.build .. ' loaded.'))
|
env.info(('Mist version ' .. mist.majorVersion .. '.' .. mist.minorVersion .. '.' .. mist.build .. ' loaded.'))
|
||||||
|
|
||||||
|
-- vim: sw=2:ts=2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user