-- ############################################################################
-- ### LATN AREAS MANAGEMENT ###
-- ############################################################################
function spawnLatn(area)
for groupName, group in pairs(latn_areas[area]) do
trigger.action.activateGroup(Group.getByName(groupName))
end
trigger.action.outText("AAA/SAM threats in " .. area .. " spawned.", 10)
end
function despawnLatn(range)
for groupName, group in pairs(ranges[range]) do
local grp = Group.getByName(groupName)
local controller = grp:getController()
controller:setOption(0, 4) -- ROE = WEAPON HOLD
controller:setOnOff(false)
trigger.action.deactivateGroup(grp)
end
trigger.action.outText("AAA/SAM threats in " .. area .. " despawned.", 10)
end
function activateLatn(area)
for groupName, group in pairs(latn_areas[area]) do
local controller = Group.getByName(groupName):getController()
controller:setOnOff(true)
-- see https://wiki.hoggitworld.com/view/DCS_enum_AI
controller:setOption(0, 2) -- ROE = OPEN FIRE
controller:setOption(9, 2) -- ALARM_STATE = RED
end
trigger.action.outText("AAA/SAM threats in " .. area .. " activated!", 10)
end
function deactivateLatn(area)
for groupName, group in pairs(latn_areas[area]) do
local controller = Group.getByName(groupName):getController()
controller:setOption(0, 4) -- ROE = WEAPON HOLD
controller:setOnOff(false)
end
trigger.action.outText("AAA/SAM threats in " .. area .. " deactivated.", 10)
-- ############################################################################ -- ### LATN AREAS MANAGEMENT ### -- ############################################################################ function spawnLatn(area) for groupName, group in pairs(latn_areas[area]) do trigger.action.activateGroup(Group.getByName(groupName)) end
end
function despawnLatn(range) for groupName, group in pairs(ranges[range]) do local grp = Group.getByName(groupName) local controller = grp:getController() controller:setOption(0, 4) -- ROE = WEAPON HOLD controller:setOnOff(false) trigger.action.deactivateGroup(grp) end
end
function activateLatn(area) for groupName, group in pairs(latn_areas[area]) do local controller = Group.getByName(groupName):getController() controller:setOnOff(true)
end
function deactivateLatn(area) for groupName, group in pairs(latn_areas[area]) do local controller = Group.getByName(groupName):getController() controller:setOption(0, 4) -- ROE = WEAPON HOLD controller:setOnOff(false) end
end