mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Progress
This commit is contained in:
parent
923ea597ec
commit
2b0fcd3426
@ -161,13 +161,13 @@ do -- ACT_ROUTE
|
||||
local RouteText = ""
|
||||
|
||||
if self.Coordinate then
|
||||
RouteText = "Route to " .. self.Coordinate:ToString( Controllable )
|
||||
RouteText = self.Coordinate:ToString( Controllable )
|
||||
end
|
||||
|
||||
if self.Zone then
|
||||
local Coordinate = self.Zone:GetPointVec3( self.Altitude )
|
||||
Coordinate:SetHeading( self.Heading )
|
||||
RouteText = "Route to zone " .. Coordinate:ToString( Controllable )
|
||||
RouteText = Coordinate:ToString( Controllable )
|
||||
end
|
||||
|
||||
return RouteText
|
||||
|
||||
@ -709,7 +709,7 @@ do -- COORDINATE
|
||||
local DirectionVec3 = self:GetDirectionVec3( FromCoordinate )
|
||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||
local Distance = self:Get2DDistance( FromCoordinate )
|
||||
return "BR: " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||
end
|
||||
|
||||
--- Return a BRAA string from a COORDINATE to the COORDINATE.
|
||||
@ -721,8 +721,7 @@ do -- COORDINATE
|
||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||
local Distance = FromCoordinate:Get2DDistance( self )
|
||||
local Altitude = self:GetAltitudeText()
|
||||
local AspectText = self:ToStringAspect( FromCoordinate )
|
||||
return "BRAA: " .. self:GetBRText( AngleRadians, Distance, Settings ) .. ( AspectText and ", " .. AspectText or "" )
|
||||
return "BRA, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||
end
|
||||
|
||||
--- Return a BULLS string from a COORDINATE to the BULLS of the coalition.
|
||||
@ -735,7 +734,7 @@ do -- COORDINATE
|
||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||
local Distance = self:Get2DDistance( TargetCoordinate )
|
||||
local Altitude = self:GetAltitudeText()
|
||||
return "BULLS: " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||
end
|
||||
|
||||
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
||||
@ -774,7 +773,7 @@ do -- COORDINATE
|
||||
local LL_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
|
||||
local LL_DMS = Settings and Settings.LL_DMS or _SETTINGS.LL_DMS
|
||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||
return "LL: " .. UTILS.tostringLL( lat, lon, LL_Accuracy, LL_DMS )
|
||||
return "LL, " .. UTILS.tostringLL( lat, lon, LL_Accuracy, LL_DMS )
|
||||
end
|
||||
|
||||
--- Provides a MGRS string
|
||||
@ -786,7 +785,7 @@ do -- COORDINATE
|
||||
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
|
||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||
local MGRS = coord.LLtoMGRS( lat, lon )
|
||||
return "MGRS: " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||
return "MGRS, " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||
end
|
||||
|
||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||
|
||||
@ -239,6 +239,11 @@ do -- DETECTION_BASE
|
||||
--
|
||||
-- -- Start the Detection.
|
||||
-- Detection:Start()
|
||||
--
|
||||
-- ## Detection of Friendlies Nearby
|
||||
--
|
||||
-- Use the method @{Detection#DETECTION_BASE.SetFriendliesRange}() to set the range what will indicate when friendlies are nearby
|
||||
-- a DetectedItem. The default range is 6000 meters. For air detections, it is advisory to use about 30.000 meters.
|
||||
--
|
||||
-- ## DETECTION_BASE is a Finite State Machine
|
||||
--
|
||||
@ -329,6 +334,8 @@ do -- DETECTION_BASE
|
||||
Unit.Category.SHIP,
|
||||
Unit.Category.STRUCTURE
|
||||
} )
|
||||
|
||||
self:SetFriendlesRange( 6000 )
|
||||
|
||||
-- Create FSM transitions.
|
||||
|
||||
@ -879,6 +886,22 @@ do -- DETECTION_BASE
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- Friendlies Radius
|
||||
|
||||
--- Set the radius in meters to validate if friendlies are nearby.
|
||||
-- @param #DETECTION_BASE self
|
||||
-- @param #number FriendliesRange Radius to use when checking if Friendlies are nearby.
|
||||
-- @return #DETECTION_BASE self
|
||||
function DETECTION_BASE:SetFriendlesRange( FriendliesRange ) --R2.2 Friendlies range
|
||||
self:F2()
|
||||
|
||||
self.FriendliesRange = FriendliesRange
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
do -- Accept / Reject detected units
|
||||
|
||||
@ -1071,7 +1094,7 @@ do -- DETECTION_BASE
|
||||
id = world.VolumeType.SPHERE,
|
||||
params = {
|
||||
point = DetectedUnit:GetVec3(),
|
||||
radius = 6000,
|
||||
radius = self.FriendliesRadius,
|
||||
}
|
||||
|
||||
}
|
||||
@ -1411,7 +1434,7 @@ end
|
||||
|
||||
do -- DETECTION_UNITS
|
||||
|
||||
--- # 2) DETECTION_UNITS class, extends @{Detection#DETECTION_BASE}
|
||||
--- # DETECTION_UNITS class, extends @{Detection#DETECTION_BASE}
|
||||
--
|
||||
-- The DETECTION_UNITS class will detect units within the battle zone.
|
||||
-- It will build a DetectedItems list filled with DetectedItems. Each DetectedItem will contain a field Set, which contains a @{Set#SET_UNIT} containing ONE @{UNIT} object reference.
|
||||
|
||||
@ -105,8 +105,9 @@ do -- TASK_A2A_DISPATCHER
|
||||
local DetectedZone = DetectedItem.Zone
|
||||
|
||||
-- Put here the intercept logic....
|
||||
local FriendliesNearBy = self.Detection:IsFriendliesNearBy( DetectedItem )
|
||||
|
||||
if true then
|
||||
if not FriendliesNearBy == true then
|
||||
|
||||
-- Here we're doing something advanced... We're copying the DetectedSet, but making a new Set only with SEADable Radar units in it.
|
||||
local TargetSetUnit = SET_UNIT:New()
|
||||
@ -130,8 +131,11 @@ do -- TASK_A2A_DISPATCHER
|
||||
-- @return Tasking.Task#TASK
|
||||
function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged )
|
||||
|
||||
|
||||
if Task then
|
||||
if Task:IsStatePlanned() and DetectedItemChanged == true then
|
||||
local FriendliesNearBy = self.Detection:IsFriendliesNearBy( DetectedItemID )
|
||||
|
||||
if Task:IsStatePlanned() and DetectedItemChanged == true and FriendliesNearBy then
|
||||
self:E( "Removing Tasking: " .. Task:GetTaskName() )
|
||||
Mission:RemoveTask( Task )
|
||||
self.Tasks[DetectedItemID] = nil
|
||||
|
||||
@ -2226,8 +2226,8 @@ function CONTROLLABLE:IsAirPlane()
|
||||
local DCSObject = self:GetDCSObject()
|
||||
|
||||
if DCSObject then
|
||||
local Category = DCSObject:getCategory()
|
||||
self:T2( Category )
|
||||
local Category = DCSObject:getDesc().category
|
||||
self:T( Category )
|
||||
return Category == Unit.Category.AIRPLANE
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user