AB v0.2.2

This commit is contained in:
Frank
2018-11-10 00:57:14 +01:00
parent 4542c96eae
commit cf4be99093
4 changed files with 145 additions and 39 deletions

View File

@@ -342,18 +342,18 @@ do -- COORDINATE
return x - Precision <= self.x and x + Precision >= self.x and z - Precision <= self.z and z + Precision >= self.z
end
--- Returns if the 2 coordinates are at the same 2D position.
--- Scan/find objects (units, statics, scenery) within a certain radius around the coordinate using the world.searchObjects() DCS API function.
-- @param #COORDINATE self
-- @param #number radius (Optional) Scan radius in meters. Default 100 m.
-- @param #boolean scanunits (Optional) If true scan for units. Default true.
-- @param #boolean scanstatics (Optional) If true scan for static objects. Default true.
-- @param #boolean scanscenery (Optional) If true scan for scenery objects. Default false.
-- @return True if units were found.
-- @return True if statics were found.
-- @return True if scenery objects were found.
-- @return Unit objects found.
-- @return Static objects found.
-- @return Scenery objects found.
-- @return #boolean True if units were found.
-- @return #boolean True if statics were found.
-- @return #boolean True if scenery objects were found.
-- @return #table Table of MOOSE @[#Wrapper.Unit#UNIT} objects found.
-- @return #table Table of DCS static objects found.
-- @return #table Table of DCS scenery objects found.
function COORDINATE:ScanObjects(radius, scanunits, scanstatics, scanscenery)
self:F(string.format("Scanning in radius %.1f m.", radius))
@@ -405,18 +405,17 @@ do -- COORDINATE
local ObjectCategory = ZoneObject:getCategory()
-- Check for unit or static objects
--if (ObjectCategory == Object.Category.UNIT and ZoneObject:isExist() and ZoneObject:isActive()) then
if (ObjectCategory == Object.Category.UNIT and ZoneObject:isExist()) then
if ObjectCategory==Object.Category.UNIT and ZoneObject:isExist() then
table.insert(Units, UNIT:Find(ZoneObject))
gotunits=true
elseif (ObjectCategory == Object.Category.STATIC and ZoneObject:isExist()) then
elseif ObjectCategory==Object.Category.STATIC and ZoneObject:isExist() then
table.insert(Statics, ZoneObject)
gotstatics=true
elseif ObjectCategory == Object.Category.SCENERY then
elseif ObjectCategory==Object.Category.SCENERY then
table.insert(Scenery, ZoneObject)
gotscenery=true

View File

@@ -480,7 +480,7 @@ end
--
-- myBeacon:TACAN(20, "Y", "TEXACO", true) -- Activate the beacon
function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
self:F({TACANChannel, Message, Bearing, BeaconDuration})
self:I({channel=Channel, mode=Mode, callsign=Message, bearing=Bearing, duration=Duration})
-- Get frequency.
local Frequency=UTILS.TACANToFrequency(Channel, Mode)
@@ -496,12 +496,6 @@ function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
self:E({"The POSITIONABLE you want to attach the AA Tacan Beacon is not an aircraft! The BEACON is not emitting.", self.Positionable})
end
-- Using the beacon type 4 (BEACON_TYPE_TACAN). For System, I'm using 5 (TACAN_TANKER_MODE_Y) if the beacon shows its bearing or 14 (TACAN_AA_MODE_Y) if it does not.
local System=14
if Bearing then
System = 5
end
-- Beacon type.
local Type=BEACON.Type.TACAN
@@ -517,14 +511,14 @@ function BEACON:ActivateTACAN(Channel, Mode, Message, Bearing, Duration)
-- Attached unit.
local UnitID=self.Positionable:GetID()
-- Debug
-- Debug.
self:T({"TACAN BEACON started!"})
-- Start beacon.
self.Positionable:CommandActivateBeacon(Type, System, Frequency, UnitID, Channel, Mode, AA, Message, Bearing)
-- Stop sheduler
if Duration then -- Schedule the stop of the BEACON if asked by the MD
-- Stop sheduler.
if Duration then
self.Positionable:DeactivateBeacon(Duration)
end