some more newlines removed

This commit is contained in:
Lukas Kropatschek 2016-01-05 18:43:23 +01:00
parent 752720c8ee
commit cbea703141

View File

@ -397,10 +397,10 @@ do
local write_DB_table_counter = 0 local write_DB_table_counter = 0
local check_spawn_events_counter = 0 local check_spawn_events_counter = 0
-- THE MAIN FUNCTION -- Accessed 100 times/sec. -- The main function. Accessed 100 times/sec.
function mist.main() function mist.main()
timer.scheduleFunction(mist.main, {}, timer.getTime() + 0.01) --reschedule first in case of Lua error timer.scheduleFunction(mist.main, {}, timer.getTime() + 0.01) --reschedule first in case of Lua error
--area to add new stuff in
write_DB_table_counter = write_DB_table_counter + 1 write_DB_table_counter = write_DB_table_counter + 1
if write_DB_table_counter == 10 then if write_DB_table_counter == 10 then
@ -487,9 +487,6 @@ do
end end
end end
function mist.dynAddStatic(staticObj) function mist.dynAddStatic(staticObj)
local newObj = {} local newObj = {}
newObj.groupId = staticObj.groupId newObj.groupId = staticObj.groupId
@ -840,8 +837,6 @@ do
end end
end end
local idNum = 0 local idNum = 0
-- Simplified event handler -- Simplified event handler
@ -850,7 +845,7 @@ do
idNum = idNum + 1 idNum = idNum + 1
handler.id = idNum handler.id = idNum
handler.f = f handler.f = f
local function handler.onEvent(self, event) function handler.onEvent(self, event)
self.f(event) self.f(event)
end end
world.addEventHandler(handler) world.addEventHandler(handler)
@ -872,7 +867,7 @@ do
end end
-- Utils- conversion, Lua utils, etc. -- mist.utils: conversion, lua utils, etc. functions
mist.utils = {} mist.utils = {}
function mist.utils.toDegree (angle) function mist.utils.toDegree (angle)
@ -1017,8 +1012,6 @@ function mist.utils.unitToWP(unit)
return false return false
end end
--from http://lua-users.org/wiki/CopyTable --from http://lua-users.org/wiki/CopyTable
function mist.utils.deepCopy(object) function mist.utils.deepCopy(object)
local lookup_table = {} local lookup_table = {}
@ -1064,7 +1057,6 @@ function mist.utils.dostring(s)
end end
end end
--[[ mist.utils.typeCheck(fname, type_tbl, var_tbl) --[[ mist.utils.typeCheck(fname, type_tbl, var_tbl)
Type-checking function: Type-checking function:
Checks a var_tbl to a type_tbl. Returns true if the var_tbl passes the type check, returns false plus an error message if the var_tbl fails. Checks a var_tbl to a type_tbl. Returns true if the var_tbl passes the type check, returns false plus an error message if the var_tbl fails.
@ -1360,6 +1352,7 @@ function mist.utils.tableShow(tbl, loc, indent, tableshow_tbls) --based on seria
end end
end end
-- mist.debug: debug functions
mist.debug = {} mist.debug = {}
function mist.debug.dump_G(fname) function mist.debug.dump_G(fname)
@ -1402,7 +1395,7 @@ function mist.debug.dumpDBs()
end end
end end
--3D Vector manipulation -- mist.vec: 3D vector manipulation functions
mist.vec = {} mist.vec = {}
function mist.vec.add(vec1, vec2) function mist.vec.add(vec1, vec2)
@ -1832,7 +1825,8 @@ function mist.getClimbAngle(unit)
end end
end end
end end
-- Database building
-- mist.DBs: various tables acting as databases
mist.DBs = {} mist.DBs = {}
mist.DBs.missionData = {} mist.DBs.missionData = {}
@ -2724,8 +2718,6 @@ initial_number
end end
end end
function mist.flagFunc.mapobjs_dead_polygon(vars) function mist.flagFunc.mapobjs_dead_polygon(vars)
--[[vars needs to be: --[[vars needs to be:
zone = table, zone = table,
@ -2767,8 +2759,6 @@ initial_number
end end
end end
function mist.pointInPolygon(point, poly, maxalt) --raycasting point in polygon. Code from http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm function mist.pointInPolygon(point, poly, maxalt) --raycasting point in polygon. Code from http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm
--[[local type_tbl = { --[[local type_tbl = {
point = {'table'}, point = {'table'},
@ -2895,9 +2885,6 @@ unitTableDef = table or nil
end end
function mist.getUnitsInZones(unit_names, zone_names, zone_type) function mist.getUnitsInZones(unit_names, zone_names, zone_type)
zone_type = zone_type or 'cylinder' zone_type = zone_type or 'cylinder'
@ -2953,7 +2940,6 @@ function mist.getUnitsInZones(unit_names, zone_names, zone_type)
return in_zone_units return in_zone_units
end end
function mist.flagFunc.units_in_zones(vars) function mist.flagFunc.units_in_zones(vars)
--[[vars needs to be: --[[vars needs to be:
units = table, units = table,
@ -3015,7 +3001,6 @@ function mist.flagFunc.units_in_zones(vars)
end end
function mist.getUnitsInMovingZones(unit_names, zone_unit_names, radius, zone_type) function mist.getUnitsInMovingZones(unit_names, zone_unit_names, radius, zone_type)
zone_type = zone_type or 'cylinder' zone_type = zone_type or 'cylinder'
@ -3065,8 +3050,6 @@ function mist.getUnitsInMovingZones(unit_names, zone_unit_names, radius, zone_ty
return in_zone_units return in_zone_units
end end
function mist.flagFunc.units_in_moving_zones(vars) function mist.flagFunc.units_in_moving_zones(vars)
--[[vars needs to be: --[[vars needs to be:
units = table, units = table,
@ -3141,7 +3124,6 @@ function mist.flagFunc.units_in_moving_zones(vars)
end end
function mist.getUnitsLOS(unitset1, altoffset1, unitset2, altoffset2, radius) function mist.getUnitsLOS(unitset1, altoffset1, unitset2, altoffset2, radius)
radius = radius or math.huge radius = radius or math.huge
@ -3455,7 +3437,6 @@ function mist.getAvgPoint(points)
end end
end end
--Gets the average position of a group of units (by name) --Gets the average position of a group of units (by name)
function mist.getAvgPos(unitNames) function mist.getAvgPos(unitNames)
local avgX, avgY, avgZ, totNum = 0, 0, 0, 0 local avgX, avgY, avgZ, totNum = 0, 0, 0, 0
@ -3608,6 +3589,7 @@ function mist.demos.printFlightData(unit)
end end
end end
--start of Mission task functions --start of Mission task functions
mist.ground = {} mist.ground = {}
mist.fixedWing = {} mist.fixedWing = {}
@ -3696,11 +3678,8 @@ function mist.getGroupRoute(groupIdent, task)
end --for coa_name, coa_data in pairs(mission.coalition) do end --for coa_name, coa_data in pairs(mission.coalition) do
end end
function mist.ground.buildPath() end -- ???? function mist.ground.buildPath() end -- ????
-- No longer accepts path -- No longer accepts path
function mist.ground.buildWP(point, overRideForm, overRideSpeed) function mist.ground.buildWP(point, overRideForm, overRideSpeed)
@ -4064,8 +4043,6 @@ function mist.terrainHeightDiff(coord, searchSize)
return mist.utils.round(tMax - tMin, 2) return mist.utils.round(tMax - tMin, 2)
end end
function mist.groupToPoint(gpData, point, form, heading, speed, useRoads) function mist.groupToPoint(gpData, point, form, heading, speed, useRoads)
if type(point) == 'string' then if type(point) == 'string' then
point = trigger.misc.getZone(point) point = trigger.misc.getZone(point)
@ -4086,7 +4063,6 @@ function mist.groupToPoint(gpData, point, form, heading, speed, useRoads)
return return
end end
function mist.getLeadPos(group) function mist.getLeadPos(group)
if type(group) == 'string' then -- group name if type(group) == 'string' then -- group name
group = Group.getByName(group) group = Group.getByName(group)
@ -4479,7 +4455,6 @@ mist.getLeadingLLString(UnitNameTable, dir, radius acc)
mist.getBRString(UnitNameTable, ref, alt, metric) mist.getBRString(UnitNameTable, ref, alt, metric)
mist.getLeadingBRString(UnitNameTable, ref, alt, metric, dir, radius, acc) -- vars versions? mist.getLeadingBRString(UnitNameTable, ref, alt, metric, dir, radius, acc) -- vars versions?
mist.sendMGRSMsg(vars) mist.sendMGRSMsg(vars)
mist.sendLeadingMGRSMsg(vars) mist.sendLeadingMGRSMsg(vars)
@ -4515,8 +4490,6 @@ end
vars.units - table of unit names (NOT unitNameTable- maybe this should change). vars.units - table of unit names (NOT unitNameTable- maybe this should change).
vars.acc - integer, number of numbers after decimal place vars.acc - integer, number of numbers after decimal place
vars.DMS - if true, output in degrees, minutes, seconds. Otherwise, output in degrees, minutes. vars.DMS - if true, output in degrees, minutes, seconds. Otherwise, output in degrees, minutes.
]] ]]
function mist.getLLString(vars) function mist.getLLString(vars)
local units = vars.units local units = vars.units
@ -4529,7 +4502,6 @@ function mist.getLLString(vars)
end end
end end
--[[ --[[
vars.units- table of unit names (NOT unitNameTable- maybe this should change). vars.units- table of unit names (NOT unitNameTable- maybe this should change).
vars.ref - vec3 ref point, maybe overload for vec2 as well? vars.ref - vec3 ref point, maybe overload for vec2 as well?
@ -4610,7 +4582,6 @@ function mist.getLeadingPos(vars)
end end
end end
--[[ vars for mist.getLeadingMGRSString: --[[ vars for mist.getLeadingMGRSString:
vars.units - table of unit names vars.units - table of unit names
vars.heading - direction vars.heading - direction
@ -4644,8 +4615,6 @@ function mist.getLeadingLLString(vars)
end end
end end
--[[ vars for mist.getLeadingBRString: --[[ vars for mist.getLeadingBRString:
vars.units - table of unit names vars.units - table of unit names
vars.heading - direction, number vars.heading - direction, number
@ -4747,7 +4716,6 @@ mist.message.add{
end end
--[[ --[[
vars.units- table of unit names (NOT unitNameTable- maybe this should change). vars.units- table of unit names (NOT unitNameTable- maybe this should change).
vars.ref - vec3 ref point, maybe overload for vec2 as well? vars.ref - vec3 ref point, maybe overload for vec2 as well?
@ -4786,7 +4754,6 @@ mist.message.add{
end end
-- basically, just sub-types of mist.msgBR... saves folks the work of getting the ref point. -- basically, just sub-types of mist.msgBR... saves folks the work of getting the ref point.
--[[ --[[
vars.units- table of unit names (NOT unitNameTable- maybe this should change). vars.units- table of unit names (NOT unitNameTable- maybe this should change).
@ -4816,7 +4783,6 @@ vars.text - text of the message
vars.displayTime vars.displayTime
vars.msgFor - scope vars.msgFor - scope
]] ]]
function mist.msgBRA(vars) function mist.msgBRA(vars)
if Unit.getByName(vars.ref) and Unit.getByName(vars.ref):isExist() == true then if Unit.getByName(vars.ref) and Unit.getByName(vars.ref):isExist() == true then
vars.ref = Unit.getByName(vars.ref):getPosition().p vars.ref = Unit.getByName(vars.ref):getPosition().p
@ -4826,7 +4792,6 @@ function mist.msgBRA(vars)
mist.msgBR(vars) mist.msgBR(vars)
end end
end end
--------------------------------------------------------------------------------------------
--[[ vars for mist.msgLeadingMGRS: --[[ vars for mist.msgLeadingMGRS:
vars.units - table of unit names vars.units - table of unit names
@ -4868,6 +4833,7 @@ mist.message.add{
end end
--[[ vars for mist.msgLeadingLL: --[[ vars for mist.msgLeadingLL:
vars.units - table of unit names vars.units - table of unit names
vars.heading - direction, number vars.heading - direction, number
@ -5700,7 +5666,6 @@ do -- all function uses of group and unit Ids must be in this do statement
return return
end end
function mist.random(firstNum, secondNum) -- no support for decimals function mist.random(firstNum, secondNum) -- no support for decimals
local lowNum, highNum local lowNum, highNum
if not secondNum then if not secondNum then
@ -5727,8 +5692,6 @@ do -- all function uses of group and unit Ids must be in this do statement
return choices[rtnVal] return choices[rtnVal]
end end
function mist.stringMatch(s1, s2, bool) function mist.stringMatch(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
@ -5754,6 +5717,7 @@ do -- all function uses of group and unit Ids must be in this do statement
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: time conversion functions
mist.time = {} mist.time = {}
-- returns a string for specified military time -- returns a string for specified military time
-- theTime is optional -- theTime is optional