Merge branch 'master' into issue437

This commit is contained in:
Grey-Echo
2017-04-22 15:21:43 +02:00
23 changed files with 1056 additions and 240 deletions

View File

@@ -1786,17 +1786,21 @@ function CONTROLLABLE:IsTargetDetected( DCSObject )
self:F2( self.ControllableName )
local DCSControllable = self:GetDCSObject()
if DCSControllable then
local DetectionVisual = ( DetectVisual and DetectVisual == true ) and Controller.Detection.VISUAL or nil
local DetectionOptical = ( DetectOptical and DetectOptical == true ) and Controller.Detection.OPTICAL or nil
local DetectionRadar = ( DetectRadar and DetectRadar == true ) and Controller.Detection.RADAR or nil
local DetectionIRST = ( DetectIRST and DetectIRST == true ) and Controller.Detection.IRST or nil
local DetectionRWR = ( DetectRWR and DetectRWR == true ) and Controller.Detection.RWR or nil
local DetectionDLINK = ( DetectDLINK and DetectDLINK == true ) and Controller.Detection.DLINK or nil
local Controller = self:_GetController()
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity
= self:_GetController().isTargetDetected( self:_GetController(), DCSObject,
Controller.Detection.VISUAL,
Controller.Detection.OPTIC,
Controller.Detection.RADAR,
Controller.Detection.IRST,
Controller.Detection.RWR,
Controller.Detection.DLINK
)
= Controller:isTargetDetected( DCSObject, DetectionVisual, DetectionOptical, DetectionRadar, DetectionIRST, DetectionRWR, DetectionDLINK )
return TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity
end

View File

@@ -443,7 +443,7 @@ function POSITIONABLE:Message( Message, Duration, Name )
return nil
end
--- Create a @{Radio#RADIO}, to allow radio transmission for this POSITIONABLE.
--- (R2.1) Create a @{Radio#RADIO}, to allow radio transmission for this POSITIONABLE.
-- Set parameters with the methods provided, then use RADIO:Broadcast() to actually broadcast the message
-- @param #POSITIONABLE self
-- @return #RADIO Radio
@@ -452,7 +452,7 @@ function POSITIONABLE:GetRadio()
return RADIO:New(self)
end
--- Create a @{Radio#BEACON}, to allow this POSITIONABLE to broadcast beacon signals
--- (R2.1) Create a @{Radio#BEACON}, to allow this POSITIONABLE to broadcast beacon signals
-- @param #POSITIONABLE self
-- @return #RADIO Radio
function POSITIONABLE:GetBeacon()
@@ -460,7 +460,7 @@ function POSITIONABLE:GetBeacon()
return BEACON:New(self)
end
--- Start Lasing a POSITIONABLE
--- (R2.1) Start Lasing a POSITIONABLE
-- @param #POSITIONABLE self
-- @param #POSITIONABLE Target
-- @param #number LaserCode
@@ -482,15 +482,12 @@ function POSITIONABLE:LaseUnit( Target, LaserCode, Duration )
end
--- Stop Lasing a POSITIONABLE
--- (R2.1) Stop Lasing a POSITIONABLE
-- @param #POSITIONABLE self
-- @param #POSITIONABLE Target
-- @return #POSITIONABLE
function POSITIONABLE:LaseOff( Target )
function POSITIONABLE:LaseOff()
self:F2()
local TargetUnitName = Target:GetName()
if self.Spot then
self.Spot:LaseOff()
self.Spot = nil
@@ -499,7 +496,7 @@ function POSITIONABLE:LaseOff( Target )
return self
end
--- Check if the POSITIONABLE is lasing a target
--- (R2.1) Check if the POSITIONABLE is lasing a target
-- @param #POSITIONABLE self
-- @return #boolean true if it is lasing a target
function POSITIONABLE:IsLasing()

View File

@@ -64,13 +64,18 @@
--
-- The UNIT class contains methods to test the location or proximity against zones or other objects.
--
-- ### Zones
-- ### Zones range
--
-- To test whether the Unit is within a **zone**, use the @{#UNIT.IsInZone}() or the @{#UNIT.IsNotInZone}() methods. Any zone can be tested on, but the zone must be derived from @{Zone#ZONE_BASE}.
--
-- ### Units
-- ### Unit range
--
-- * Test if another DCS Unit is within a given radius of the current DCS Unit, use the @{#UNIT.OtherUnitInRadius}() method.
--
-- ## Test Line of Sight
--
-- * Use the @{#UNIT.IsLOS}() method to check if the given unit is within line of sight.
--
-- Test if another DCS Unit is within a given radius of the current DCS Unit, use the @{#UNIT.OtherUnitInRadius}() method.
--
-- @field #UNIT UNIT
UNIT = {
@@ -1002,6 +1007,32 @@ do -- Event Handling
return self
end
end
do -- Detection
--- (R2.1) Returns if a unit is detecting the TargetUnit.
-- @param #UNIT self
-- @param #UNIT TargetUnit
-- @return #boolean true If the TargetUnit is detected by the unit, otherwise false.
function UNIT:IsDetected( TargetUnit )
local TargetIsDetected, TargetIsVisible, TargetLastTime, TargetKnowType, TargetKnowDistance, TargetLastPos, TargetLastVelocity = self:IsTargetDetected( TargetUnit:GetDCSObject() )
return TargetIsDetected
end
--- (R2.1) Returns if a unit has Line of Sight (LOS) with the TargetUnit.
-- @param #UNIT self
-- @param #UNIT TargetUnit
-- @return #boolean true If the TargetUnit has LOS with the unit, otherwise false.
function UNIT:IsLOS( TargetUnit )
local IsLOS = self:GetPointVec3():IsLOS( TargetUnit:GetPointVec3() )
return IsLOS
end
end