diff --git a/Moose Development/Moose/Wrapper/Group.lua b/Moose Development/Moose/Wrapper/Group.lua index e4d70663a..3e8a3188a 100644 --- a/Moose Development/Moose/Wrapper/Group.lua +++ b/Moose Development/Moose/Wrapper/Group.lua @@ -996,11 +996,33 @@ end --- Randomize the unit positions for the units of the respawned group. +-- When a Respawn happens, the units of the group will be placed at random positions within the Zone (selected). -- @param #GROUP self --- @param #boolean Positions true will randomize the positions. +-- @param #boolean Positions true will randomize the positions within the Zone. -- @return #GROUP self function GROUP:InitRandomizePositions( Positions ) + self.InitRespawnRandomizePositions = Positions + self.InitRespawnRandomizePositionsInner = nil + self.InitRespawnRandomizePositionsOuter = nil + + return self +end + + +--- Randomize the unit positions for the units in a circle band. +-- When a Respawn happens, the units of the group will be positioned at random places within the Outer and Inner radius. +-- Thus, a band is created around the respawn location where the units will be placed at random positions. +-- @param #GROUP self +-- @param #boolean OuterRadius Outer band in meters from the center. +-- @param #boolean InnerRadius Inner band in meters from the center. +-- @return #GROUP self +function GROUP:InitRandomizePositionsRadius( OuterRadius, InnerRadius ) + + self.InitRespawnRandomizePositions = nil + self.InitRespawnRandomizePositionsInner = Inner + self.InitRespawnRandomizePositionsOuter = Outer + return self end @@ -1050,7 +1072,11 @@ function GROUP:Respawn( Template ) if self.InitRespawnRandomizePositions then GroupUnitVec3 = Zone:GetRandomVec3() else - GroupUnitVec3 = Zone:GetVec3() + if self.InitRespawnRandomizePositionsInner and self.InitRespawnRandomizePositionsOuter then + GroupUnitVec3 = POINT_VEC3:NewFromVec2( From ):GetRandomPointVec3InRadius( self.InitRespawnRandomizePositionsOuter, self.InitRespawnRandomizePositionsInner ) + else + GroupUnitVec3 = Zone:GetVec3() + end end end