mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge pull request #1936 from FlightControl-Master/FF/MasterDevel
Remove Junk
This commit is contained in:
commit
302e785f32
@ -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.
|
||||
|
||||
@ -394,6 +394,35 @@ function POSITIONABLE:GetCoordinate()
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
--- Triggers an explosion at the coordinates of the positionable.
|
||||
-- @param #POSITIONABLE self
|
||||
-- @param #number power Power of the explosion in kg TNT. Default 100 kg TNT.
|
||||
-- @param #number delay (Optional) Delay of explosion in seconds.
|
||||
-- @return #POSITIONABLE self
|
||||
function POSITIONABLE:Explode(power, delay)
|
||||
|
||||
-- Default.
|
||||
power=power or 100
|
||||
|
||||
-- Check if delay or not.
|
||||
if delay and delay>0 then
|
||||
-- Delayed call.
|
||||
self:ScheduleOnce(delay, POSITIONABLE.Explode, self, power, 0)
|
||||
else
|
||||
|
||||
local coord=self:GetCoord()
|
||||
|
||||
if coord then
|
||||
-- Create an explotion at the coordinate of the positionable.
|
||||
coord:Explosion(power)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--- Returns a COORDINATE object, which is offset with respect to the orientation of the POSITIONABLE.
|
||||
-- @param #POSITIONABLE self
|
||||
-- @param #number x Offset in the direction "the nose" of the unit is pointing in meters. Default 0 m.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user