mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
[ADDED] WAREHOUSE:SetValidateAndRepositionGroundUnits to use for Brigades
This commit is contained in:
parent
ca1ddb4013
commit
facac82130
@ -4247,6 +4247,16 @@ function WAREHOUSE:_AssetItemInfo(asset)
|
|||||||
self:T3({Template=asset.template})
|
self:T3({Template=asset.template})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- This function uses Disposition and other fallback logic to find better ground positions for ground units.
|
||||||
|
--- NOTE: This is not a spawn randomizer.
|
||||||
|
--- It will try to find clear ground locations avoiding trees, water, roads, runways, map scenery, statics and other units in the area and modifies the provided positions table.
|
||||||
|
--- Maintains the original layout and unit positions as close as possible by searching for the next closest valid position to each unit.
|
||||||
|
--- Uses UTILS.ValidateAndRepositionGroundUnits.
|
||||||
|
-- @param #boolean Enabled Enable/disable the feature.
|
||||||
|
function WAREHOUSE:SetValidateAndRepositionGroundUnits(Enabled)
|
||||||
|
self.ValidateAndRepositionGroundUnits = Enabled
|
||||||
|
end
|
||||||
|
|
||||||
--- On after "NewAsset" event. A new asset has been added to the warehouse stock.
|
--- On after "NewAsset" event. A new asset has been added to the warehouse stock.
|
||||||
-- @param #WAREHOUSE self
|
-- @param #WAREHOUSE self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
@ -5965,6 +5975,10 @@ function WAREHOUSE:_SpawnAssetGroundNaval(alias, asset, request, spawnzone, late
|
|||||||
template.y = coord.z
|
template.y = coord.z
|
||||||
template.alt = coord.y
|
template.alt = coord.y
|
||||||
|
|
||||||
|
if self.ValidateAndRepositionGroundUnits then
|
||||||
|
UTILS.ValidateAndRepositionGroundUnits(template.units)
|
||||||
|
end
|
||||||
|
|
||||||
-- Spawn group.
|
-- Spawn group.
|
||||||
local group=_DATABASE:Spawn(template) --Wrapper.Group#GROUP
|
local group=_DATABASE:Spawn(template) --Wrapper.Group#GROUP
|
||||||
|
|
||||||
|
|||||||
@ -4876,11 +4876,11 @@ end
|
|||||||
--- NOTE: This is not a spawn randomizer.
|
--- NOTE: This is not a spawn randomizer.
|
||||||
--- It will try to find clear ground locations avoiding trees, water, roads, runways, map scenery, statics and other units in the area and modifies the provided positions table.
|
--- It will try to find clear ground locations avoiding trees, water, roads, runways, map scenery, statics and other units in the area and modifies the provided positions table.
|
||||||
--- Maintains the original layout and unit positions as close as possible by searching for the next closest valid position to each unit.
|
--- Maintains the original layout and unit positions as close as possible by searching for the next closest valid position to each unit.
|
||||||
-- @param table Positions A table of DCS#Vec2 or DCS#Vec3, can be a units table from the group template.
|
-- @param #table Positions A table of DCS#Vec2 or DCS#Vec3, can be a units table from the group template.
|
||||||
-- @param DCS#Vec2 Anchor (Optional) DCS#Vec2 or DCS#Vec3 as anchor point to calculate offset of the units.
|
-- @param DCS#Vec2 Anchor (Optional) DCS#Vec2 or DCS#Vec3 as anchor point to calculate offset of the units.
|
||||||
-- @param #number MaxRadius (Optional) Max radius to search for valid ground locations in meters. Default is double the max radius of the units.
|
-- @param #number MaxRadius (Optional) Max radius to search for valid ground locations in meters. Default is double the max radius of the units.
|
||||||
-- @param #number Spacing (Optional) Minimum spacing between units in meters. Default is 5% of the search radius or 5 meters, whichever is larger.
|
-- @param #number Spacing (Optional) Minimum spacing between units in meters. Default is 5% of the search radius or 5 meters, whichever is larger.
|
||||||
function UTILS.ValidateAndRepositionGroundUnits(Anchor, Positions, MaxRadius, Spacing)
|
function UTILS.ValidateAndRepositionGroundUnits(Positions, Anchor, MaxRadius, Spacing)
|
||||||
local units = Positions
|
local units = Positions
|
||||||
Anchor = Anchor or UTILS.GetCenterPoint(units)
|
Anchor = Anchor or UTILS.GetCenterPoint(units)
|
||||||
local gPos = { x = Anchor.x, y = Anchor.z or Anchor.y }
|
local gPos = { x = Anchor.x, y = Anchor.z or Anchor.y }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user