From 5233c633a941c127bc5ca580a465a568297a6bb4 Mon Sep 17 00:00:00 2001 From: funkyfranky Date: Wed, 2 Aug 2017 17:56:07 +0200 Subject: [PATCH] Fixes for Group in Zone functions If a group is not alive, group in zone functions crash. Added checks if group is still alive. If not return before the error occurs. --- Moose Development/Moose/Wrapper/Group.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index bab893f7a..5879bd2af 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -574,6 +574,8 @@ do -- Is Zone methods function GROUP:IsCompletelyInZone( Zone ) self:F2( { self.GroupName, Zone } ) + if not self:IsAlive() then return false end + for UnitID, UnitData in pairs( self:GetUnits() ) do local Unit = UnitData -- Wrapper.Unit#UNIT if Zone:IsVec3InZone( Unit:GetVec3() ) then @@ -595,6 +597,8 @@ function GROUP:IsPartlyInZone( Zone ) local IsOneUnitInZone = false local IsOneUnitOutsideZone = false + if not self:IsAlive() then return false end + for UnitID, UnitData in pairs( self:GetUnits() ) do local Unit = UnitData -- Wrapper.Unit#UNIT if Zone:IsVec3InZone( Unit:GetVec3() ) then @@ -618,6 +622,8 @@ end function GROUP:IsNotInZone( Zone ) self:F2( { self.GroupName, Zone } ) + if not self:IsAlive() then return true end + for UnitID, UnitData in pairs( self:GetUnits() ) do local Unit = UnitData -- Wrapper.Unit#UNIT if Zone:IsVec3InZone( Unit:GetVec3() ) then @@ -636,6 +642,8 @@ function GROUP:CountInZone( Zone ) self:F2( {self.GroupName, Zone} ) local Count = 0 + if not self:IsAlive() then return Count end + for UnitID, UnitData in pairs( self:GetUnits() ) do local Unit = UnitData -- Wrapper.Unit#UNIT if Zone:IsVec3InZone( Unit:GetVec3() ) then