mirror of
https://github.com/weyne85/MIST.git
synced 2025-10-29 16:56:32 +00:00
fixed groupTableCheck and added some ldoc
This commit is contained in:
parent
42e67cf481
commit
864e89d43b
44
mist.lua
44
mist.lua
@ -2763,27 +2763,24 @@ do -- group functions scope
|
|||||||
-- @treturn boolean true if a group can be spawned using
|
-- @treturn boolean true if a group can be spawned using
|
||||||
-- this table, false otherwise.
|
-- this table, false otherwise.
|
||||||
function mist.groupTableCheck(groupData)
|
function mist.groupTableCheck(groupData)
|
||||||
local isOk = false
|
-- return false if country, category
|
||||||
|
-- or units are missing
|
||||||
if groupData.country then
|
if not groupData.country and
|
||||||
isOk = true
|
not groupData.category and
|
||||||
|
not groupData.units then
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
if groupData.category then
|
-- return false if unitData misses
|
||||||
isOk = true
|
-- x, y or type
|
||||||
else
|
for unitId, unitData in pairs(groupData.units) do
|
||||||
isOk = false
|
if not unitData.x and
|
||||||
end
|
not unitData.y and
|
||||||
if groupData.units then
|
not unitData.type then
|
||||||
for unitId, unitData in pairs(groupData.units) do
|
return false
|
||||||
if unitData.x and unitData.y and unitData.type then
|
|
||||||
isOk = true
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
isOk = false
|
|
||||||
end
|
end
|
||||||
|
-- everything we need is here return true
|
||||||
return isOk
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
function mist.getCurrentGroupData(gpName)
|
function mist.getCurrentGroupData(gpName)
|
||||||
@ -5733,6 +5730,13 @@ do -- group tasks scope
|
|||||||
mist.air.fixedWing = {}
|
mist.air.fixedWing = {}
|
||||||
mist.air.heli = {}
|
mist.air.heli = {}
|
||||||
|
|
||||||
|
--- Tasks group to follow a route.
|
||||||
|
-- This sets the mission task for the given group.
|
||||||
|
-- Any wrapped actions inside the path (like enroute
|
||||||
|
-- tasks) will be executed.
|
||||||
|
-- @tparam Group group group to task.
|
||||||
|
-- @tparam table path containing
|
||||||
|
-- points defining a route.
|
||||||
function mist.goRoute(group, path)
|
function mist.goRoute(group, path)
|
||||||
local misTask = {
|
local misTask = {
|
||||||
id = 'Mission',
|
id = 'Mission',
|
||||||
@ -5745,15 +5749,13 @@ do -- group tasks scope
|
|||||||
if type(group) == 'string' then
|
if type(group) == 'string' then
|
||||||
group = Group.getByName(group)
|
group = Group.getByName(group)
|
||||||
end
|
end
|
||||||
local groupCon = nil
|
|
||||||
if group then
|
if group then
|
||||||
groupCon = group:getController()
|
local groupCon = group:getController()
|
||||||
if groupCon then
|
if groupCon then
|
||||||
groupCon:setTask(misTask)
|
groupCon:setTask(misTask)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--Controller.setTask(groupCon, misTask)
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user