From dbae37f15148a0fc2715ef5a6b2313491b879dd6 Mon Sep 17 00:00:00 2001 From: Applevangelist Date: Mon, 13 Oct 2025 18:51:55 +0200 Subject: [PATCH] xx --- Moose Development/Moose/Core/Zone.lua | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Moose Development/Moose/Core/Zone.lua b/Moose Development/Moose/Core/Zone.lua index c2deb6823..39c1a46f6 100644 --- a/Moose Development/Moose/Core/Zone.lua +++ b/Moose Development/Moose/Core/Zone.lua @@ -1934,6 +1934,21 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset) return self end +--- Updates the current location from a @{Wrapper.Group}. +-- @param #ZONE_UNIT self +-- @param Wrapper.Group#GROUP Group (optional) Update from this Unit, if nil, update from the UNIT this zone is based on. +-- @return self +function ZONE_UNIT:UpdateFromUnit(Unit) + if Unit and Unit:IsAlive() then + local vec2 = Unit:GetVec2() + self.LastVec2 = vec2 + elseif self.ZoneUNIT and self.ZoneUNIT:IsAlive() then + local ZoneVec2 = self.ZoneUNIT:GetVec2() + self.LastVec2 = ZoneVec2 + end + return self +end + --- Returns the current location of the @{Wrapper.Unit#UNIT}. -- @param #ZONE_UNIT self @@ -2071,6 +2086,22 @@ function ZONE_GROUP:GetVec2() return ZoneVec2 end +--- Updates the current location from a @{Wrapper.Group}. +-- @param #ZONE_GROUP self +-- @param Wrapper.Group#GROUP Group (optional) Update from this Group, if nil, update from the GROUP this zone is based on. +-- @return self +function ZONE_GROUP:UpdateFromGroup(Group) + if Group and Group:IsAlive() then + local vec2 = Group:GetVec2() + self.Vec2 = vec2 + elseif self._.ZoneGROUP and self._.ZoneGROUP:IsAlive() then + local ZoneVec2 = self._.ZoneGROUP:GetVec2() + self.Vec2 = ZoneVec2 + self._.ZoneVec2Cache = ZoneVec2 + end + return self +end + --- Returns a random location within the zone of the @{Wrapper.Group}. -- @param #ZONE_GROUP self -- @return DCS#Vec2 The random location of the zone based on the @{Wrapper.Group} location.