mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Updated detection algorithm
Now the detected sets are kept consistent to previous sets. New algorithm developed. This is important to keep assigned tasks consistent with the detected sets.
This commit is contained in:
@@ -586,12 +586,62 @@ end
|
||||
function UNIT:IsAir()
|
||||
self:F2()
|
||||
|
||||
local UnitDescriptor = self.DCSUnit:getDesc()
|
||||
self:T3( { UnitDescriptor.category, Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
local IsAirResult = ( UnitDescriptor.category == Unit.Category.AIRPLANE ) or ( UnitDescriptor.category == Unit.Category.HELICOPTER )
|
||||
|
||||
self:T3( IsAirResult )
|
||||
return IsAirResult
|
||||
if DCSUnit then
|
||||
local UnitDescriptor = DCSUnit:getDesc()
|
||||
self:T3( { UnitDescriptor.category, Unit.Category.AIRPLANE, Unit.Category.HELICOPTER } )
|
||||
|
||||
local IsAirResult = ( UnitDescriptor.category == Unit.Category.AIRPLANE ) or ( UnitDescriptor.category == Unit.Category.HELICOPTER )
|
||||
|
||||
self:T3( IsAirResult )
|
||||
return IsAirResult
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns if the unit is of an ground category.
|
||||
-- If the unit is a ground vehicle or infantry, this method will return true, otherwise false.
|
||||
-- @param #UNIT self
|
||||
-- @return #boolean Ground category evaluation result.
|
||||
function UNIT:IsGround()
|
||||
self:F2()
|
||||
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitDescriptor = DCSUnit:getDesc()
|
||||
self:T3( { UnitDescriptor.category, Unit.Category.GROUND_UNIT } )
|
||||
|
||||
local IsGroundResult = ( UnitDescriptor.category == Unit.Category.GROUND_UNIT )
|
||||
|
||||
self:T3( IsGroundResult )
|
||||
return IsGroundResult
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns if the unit is of a ship category.
|
||||
-- If the unit is a ship, this method will return true, otherwise false.
|
||||
-- @param #UNIT self
|
||||
-- @return #boolean Ship category evaluation result.
|
||||
function UNIT:IsShip()
|
||||
self:F2()
|
||||
|
||||
local DCSUnit = self:GetDCSObject()
|
||||
|
||||
if DCSUnit then
|
||||
local UnitDescriptor = DCSUnit:getDesc()
|
||||
self:T3( { UnitDescriptor.category, Unit.Category.SHIP } )
|
||||
|
||||
local IsShipResult = ( UnitDescriptor.category == Unit.Category.SHIP )
|
||||
|
||||
self:T3( IsShipResult )
|
||||
return IsShipResult
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user