From 2cecc526fb66238c3076bbe1e920857e7918bbf2 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Tue, 5 Oct 2021 19:10:15 +0200 Subject: [PATCH] ZONE_CAPTURE_COALITION - fixed an issue when monitoring hits and SCENERY was delivered as hit UNIT --- .../Moose/Functional/ZoneCaptureCoalition.lua | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua index e6a07e323..d90dfcca7 100644 --- a/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua +++ b/Moose Development/Moose/Functional/ZoneCaptureCoalition.lua @@ -715,20 +715,21 @@ do -- ZONE_CAPTURE_COALITION local UnitHit = EventData.TgtUnit + if UnitHit.ClassName ~= "SCENERY" then -- Check if unit is inside the capture zone and that it is of the defending coalition. - if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then - - -- Update last hit time. - self.HitTimeLast=timer.getTime() - - -- Only trigger attacked event if not already in state "Attacked". - if self:GetState()~="Attacked" then - self:F2("Hit ==> Attack") - self:Attack() - end - + if UnitHit and UnitHit:IsInZone(self) and UnitHit:GetCoalition()==self.Coalition then + + -- Update last hit time. + self.HitTimeLast=timer.getTime() + + -- Only trigger attacked event if not already in state "Attacked". + if self:GetState()~="Attacked" then + self:F2("Hit ==> Attack") + self:Attack() + end + + end end - end end @@ -890,12 +891,14 @@ do -- ZONE_CAPTURE_COALITION end -- Status text. - local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlue, nRed, State) - local NewState = self:GetState() - if NewState~=State then - text=text..string.format(" --> %s", NewState) + if false then + local text=string.format("CAPTURE ZONE %s: Owner=%s (Previous=%s): #blue=%d, #red=%d, Status %s", self:GetZoneName(), self:GetCoalitionName(), UTILS.GetCoalitionName(self:GetPreviousCoalition()), nBlue, nRed, State) + local NewState = self:GetState() + if NewState~=State then + text=text..string.format(" --> %s", NewState) + end + self:I(text) end - self:I(text) end