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 = ""
|
local RouteText = ""
|
||||||
|
|
||||||
if self.Coordinate then
|
if self.Coordinate then
|
||||||
RouteText = "Route to " .. self.Coordinate:ToString( Controllable )
|
RouteText = self.Coordinate:ToString( Controllable )
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Zone then
|
if self.Zone then
|
||||||
local Coordinate = self.Zone:GetPointVec3( self.Altitude )
|
local Coordinate = self.Zone:GetPointVec3( self.Altitude )
|
||||||
Coordinate:SetHeading( self.Heading )
|
Coordinate:SetHeading( self.Heading )
|
||||||
RouteText = "Route to zone " .. Coordinate:ToString( Controllable )
|
RouteText = Coordinate:ToString( Controllable )
|
||||||
end
|
end
|
||||||
|
|
||||||
return RouteText
|
return RouteText
|
||||||
|
|||||||
@ -709,7 +709,7 @@ do -- COORDINATE
|
|||||||
local DirectionVec3 = self:GetDirectionVec3( FromCoordinate )
|
local DirectionVec3 = self:GetDirectionVec3( FromCoordinate )
|
||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( FromCoordinate )
|
local Distance = self:Get2DDistance( FromCoordinate )
|
||||||
return "BR: " .. self:GetBRText( AngleRadians, Distance, Settings )
|
return "BR, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a BRAA string from a COORDINATE to the COORDINATE.
|
--- Return a BRAA string from a COORDINATE to the COORDINATE.
|
||||||
@ -721,8 +721,7 @@ do -- COORDINATE
|
|||||||
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
local AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = FromCoordinate:Get2DDistance( self )
|
local Distance = FromCoordinate:Get2DDistance( self )
|
||||||
local Altitude = self:GetAltitudeText()
|
local Altitude = self:GetAltitudeText()
|
||||||
local AspectText = self:ToStringAspect( FromCoordinate )
|
return "BRA, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||||
return "BRAA: " .. self:GetBRText( AngleRadians, Distance, Settings ) .. ( AspectText and ", " .. AspectText or "" )
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return a BULLS string from a COORDINATE to the BULLS of the coalition.
|
--- 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 AngleRadians = self:GetAngleRadians( DirectionVec3 )
|
||||||
local Distance = self:Get2DDistance( TargetCoordinate )
|
local Distance = self:Get2DDistance( TargetCoordinate )
|
||||||
local Altitude = self:GetAltitudeText()
|
local Altitude = self:GetAltitudeText()
|
||||||
return "BULLS: " .. self:GetBRText( AngleRadians, Distance, Settings )
|
return "BULLS, " .. self:GetBRText( AngleRadians, Distance, Settings )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
--- 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_Accuracy = Settings and Settings.LL_Accuracy or _SETTINGS.LL_Accuracy
|
||||||
local LL_DMS = Settings and Settings.LL_DMS or _SETTINGS.LL_DMS
|
local LL_DMS = Settings and Settings.LL_DMS or _SETTINGS.LL_DMS
|
||||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
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
|
end
|
||||||
|
|
||||||
--- Provides a MGRS string
|
--- Provides a MGRS string
|
||||||
@ -786,7 +785,7 @@ do -- COORDINATE
|
|||||||
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
|
local MGRS_Accuracy = Settings and Settings.MGRS_Accuracy or _SETTINGS.MGRS_Accuracy
|
||||||
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
local lat, lon = coord.LOtoLL( self:GetVec3() )
|
||||||
local MGRS = coord.LLtoMGRS( lat, lon )
|
local MGRS = coord.LLtoMGRS( lat, lon )
|
||||||
return "MGRS: " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
return "MGRS, " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
|
|||||||
@ -240,6 +240,11 @@ do -- DETECTION_BASE
|
|||||||
-- -- Start the Detection.
|
-- -- Start the Detection.
|
||||||
-- Detection:Start()
|
-- 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
|
-- ## DETECTION_BASE is a Finite State Machine
|
||||||
--
|
--
|
||||||
-- Various Events and State Transitions can be tailored using DETECTION_BASE.
|
-- Various Events and State Transitions can be tailored using DETECTION_BASE.
|
||||||
@ -330,6 +335,8 @@ do -- DETECTION_BASE
|
|||||||
Unit.Category.STRUCTURE
|
Unit.Category.STRUCTURE
|
||||||
} )
|
} )
|
||||||
|
|
||||||
|
self:SetFriendlesRange( 6000 )
|
||||||
|
|
||||||
-- Create FSM transitions.
|
-- Create FSM transitions.
|
||||||
|
|
||||||
self:SetStartState( "Stopped" )
|
self:SetStartState( "Stopped" )
|
||||||
@ -880,6 +887,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
|
do -- Accept / Reject detected units
|
||||||
|
|
||||||
--- Accept detections if within a range in meters.
|
--- Accept detections if within a range in meters.
|
||||||
@ -1071,7 +1094,7 @@ do -- DETECTION_BASE
|
|||||||
id = world.VolumeType.SPHERE,
|
id = world.VolumeType.SPHERE,
|
||||||
params = {
|
params = {
|
||||||
point = DetectedUnit:GetVec3(),
|
point = DetectedUnit:GetVec3(),
|
||||||
radius = 6000,
|
radius = self.FriendliesRadius,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1411,7 +1434,7 @@ end
|
|||||||
|
|
||||||
do -- DETECTION_UNITS
|
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.
|
-- 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.
|
-- 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
|
local DetectedZone = DetectedItem.Zone
|
||||||
|
|
||||||
-- Put here the intercept logic....
|
-- 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.
|
-- 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()
|
local TargetSetUnit = SET_UNIT:New()
|
||||||
@ -130,8 +131,11 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
-- @return Tasking.Task#TASK
|
-- @return Tasking.Task#TASK
|
||||||
function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged )
|
function TASK_A2A_DISPATCHER:EvaluateRemoveTask( Mission, Task, DetectedItemID, DetectedItemChanged )
|
||||||
|
|
||||||
|
|
||||||
if Task then
|
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() )
|
self:E( "Removing Tasking: " .. Task:GetTaskName() )
|
||||||
Mission:RemoveTask( Task )
|
Mission:RemoveTask( Task )
|
||||||
self.Tasks[DetectedItemID] = nil
|
self.Tasks[DetectedItemID] = nil
|
||||||
|
|||||||
@ -2226,8 +2226,8 @@ function CONTROLLABLE:IsAirPlane()
|
|||||||
local DCSObject = self:GetDCSObject()
|
local DCSObject = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSObject then
|
if DCSObject then
|
||||||
local Category = DCSObject:getCategory()
|
local Category = DCSObject:getDesc().category
|
||||||
self:T2( Category )
|
self:T( Category )
|
||||||
return Category == Unit.Category.AIRPLANE
|
return Category == Unit.Category.AIRPLANE
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user