From ed9c14e63d5a7d65b891cdb27744afdfd97be7e8 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Sun, 22 May 2022 12:06:45 +0200 Subject: [PATCH] GROUP - changes in GetDCSGroup --- Moose Development/Moose/Wrapper/Group.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index a801b5f3f..fd2bfe86c 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -715,21 +715,20 @@ function GROUP:GetDCSUnit( UnitNumber ) if DCSGroup then - local UnitFound = nil - -- 2.7.1 dead event bug, return the first alive unit instead - local units = DCSGroup:getUnits() or {} + if DCSGroup.getUnit and DCSGroup:getUnit( UnitNumber ) then + return DCSGroup:getUnit( UnitNumber ) + else - for _,_unit in pairs(units) do - - local UnitFound = UNIT:Find(_unit) + local UnitFound = nil + -- 2.7.1 dead event bug, return the first alive unit instead + local units = DCSGroup:getUnits() or {} - if UnitFound then - - return UnitFound - + for _,_unit in pairs(units) do + if _unit and _unit:isExist() then + return _unit + end end end - end return nil