Remove Junk

**ZONE**
- Added `ZONE_RADIUS:RemoveJunk()` function
- Added `ZONE_POLYGON_BASE:RemoveJunk()` function (not working)

**POSITIONABLE**
- Added `Explosion`
This commit is contained in:
Frank
2023-04-22 14:02:18 +02:00
parent 240307ef94
commit 1507cc0b42
2 changed files with 76 additions and 0 deletions

View File

@@ -1001,6 +1001,24 @@ function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
end
--- Remove junk inside the zone using the `world.removeJunk` function.
-- @param #ZONE_RADIUS self
-- @return #number Number of deleted objects.
function ZONE_RADIUS:RemoveJunk()
local radius=self.Radius
local vec3=self:GetVec3()
local volS = {
id = world.VolumeType.SPHERE,
params = {point = vec3, radius = radius}
}
local n=world.removeJunk(volS)
return n
end
--- Count the number of different coalitions inside the zone.
-- @param #ZONE_RADIUS self
-- @return #table Table of DCS units and DCS statics inside the zone.
@@ -2141,6 +2159,35 @@ function ZONE_POLYGON_BASE:GetZoneQuad(ZoneName, DoNotRegisterZone)
return zone
end
--- Remove junk inside the zone. Due to DCS limitations, this works only for rectangular zones. So we get the smallest rectangular zone encompassing all points points of the polygon zone.
-- @param #ZONE_POLYGON_BASE self
-- @param #number Height Height of the box in meters. Default 1000.
-- @return #number Number of removed objects.
function ZONE_POLYGON_BASE:RemoveJunk(Height)
Height=Height or 1000
local vec2SW, vec2NE=self:GetBoundingVec2()
local vec3SW={x=vec2SW.x, y=-Height, z=vec2SW.y} --DCS#Vec3
local vec3NE={x=vec2NE.x, y= Height, z=vec2NE.y} --DCS#Vec3
--local coord1=COORDINATE:NewFromVec3(vec3SW):MarkToAll("SW")
--local coord1=COORDINATE:NewFromVec3(vec3NE):MarkToAll("NE")
local volume = {
id = world.VolumeType.BOX,
params = {
min=vec3SW,
max=vec3SW
}
}
local n=world.removeJunk(volume)
return n
end
--- Smokes the zone boundaries in a color.
-- @param #ZONE_POLYGON_BASE self
-- @param Utilities.Utils#SMOKECOLOR SmokeColor The smoke color.