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
3106f62709
commit
312007b51c
BIN
Moose Development/Maths/Aspect.ggb
Normal file
BIN
Moose Development/Maths/Aspect.ggb
Normal file
Binary file not shown.
@ -309,6 +309,8 @@ function POINT_VEC3:New( x, y, z )
|
|||||||
self.y = y
|
self.y = y
|
||||||
self.z = z
|
self.z = z
|
||||||
|
|
||||||
|
self:SetMetric( true )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -589,7 +591,7 @@ end
|
|||||||
-- @return #string Altitude text.
|
-- @return #string Altitude text.
|
||||||
function POINT_VEC3:GetAltitudeText()
|
function POINT_VEC3:GetAltitudeText()
|
||||||
if self:IsMetric() then
|
if self:IsMetric() then
|
||||||
return ' at ' .. UTILS.Round( self:GetY(), 0 )
|
return ' at ' .. UTILS.Round( self:GetY(), -3 )
|
||||||
else
|
else
|
||||||
return ' at ' .. UTILS.Round( UTILS.MetersToFeet( self:GetY() ), 0 )
|
return ' at ' .. UTILS.Round( UTILS.MetersToFeet( self:GetY() ), 0 )
|
||||||
end
|
end
|
||||||
@ -876,11 +878,8 @@ end
|
|||||||
function POINT_VEC2:NewFromVec3( Vec3 )
|
function POINT_VEC2:NewFromVec3( Vec3 )
|
||||||
|
|
||||||
local self = BASE:Inherit( self, BASE:New() )
|
local self = BASE:Inherit( self, BASE:New() )
|
||||||
local Vec2 = { x = Vec3.x, y = Vec3.z }
|
|
||||||
|
|
||||||
local LandHeight = land.getHeight( Vec2 )
|
self = BASE:Inherit( self, POINT_VEC3:New( Vec3.x, Vec3.y, Vec3.z ) )
|
||||||
|
|
||||||
self = BASE:Inherit( self, POINT_VEC3:New( Vec2.x, LandHeight, Vec2.y ) )
|
|
||||||
self:F2( self )
|
self:F2( self )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@ -1074,12 +1073,17 @@ do -- COORDINATE
|
|||||||
-- @return Core.Point#COORDINATE self
|
-- @return Core.Point#COORDINATE self
|
||||||
function COORDINATE:NewFromVec3( Vec3 ) --R2.1 Fixes issue #424.
|
function COORDINATE:NewFromVec3( Vec3 ) --R2.1 Fixes issue #424.
|
||||||
|
|
||||||
self = BASE:Inherit( self, POINT_VEC2:NewFromVec3( Vec3 ) ) -- Core.Point#COORDINATE
|
self = BASE:Inherit( self, POINT_VEC3:NewFromVec3( Vec3 ) ) -- Core.Point#COORDINATE
|
||||||
self:F2( self )
|
self:F2( self )
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function COORDINATE:SetHeading( Heading )
|
||||||
|
self.Heading = Heading
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return a BR string from a COORDINATE to the COORDINATE.
|
--- Return a BR string from a COORDINATE to the COORDINATE.
|
||||||
-- @param #COORDINATE self
|
-- @param #COORDINATE self
|
||||||
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
||||||
@ -1100,7 +1104,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 "BRAA: " .. self:GetBRText( AngleRadians, Distance ) .. Altitude .. ", flanking"
|
return "BRAA: " .. self:GetBRText( AngleRadians, Distance )
|
||||||
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.
|
||||||
@ -1113,7 +1117,34 @@ 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 ) .. Altitude .. ", flanking"
|
return "BULLS: " .. self:GetBRText( AngleRadians, Distance )
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Return an aspect string from a COORDINATE to the Angle of the object.
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #COORDINATE TargetCoordinate The target COORDINATE.
|
||||||
|
-- @return #string The Aspect string, which is Hot, Cold or Flanking.
|
||||||
|
function COORDINATE:ToStringAspect( TargetCoordinate )
|
||||||
|
local Heading = self.Heading
|
||||||
|
local DirectionVec3 = self:GetDirectionVec3( TargetCoordinate )
|
||||||
|
local Angle = self:GetAngleDegrees( DirectionVec3 )
|
||||||
|
|
||||||
|
if Heading then
|
||||||
|
local Aspect = Angle - Heading
|
||||||
|
if Aspect > -135 and Aspect <= -45 then
|
||||||
|
return "Flanking"
|
||||||
|
end
|
||||||
|
if Aspect > -45 and Aspect <= 45 then
|
||||||
|
return "Hot"
|
||||||
|
end
|
||||||
|
if Aspect > 45 and Aspect <= 135 then
|
||||||
|
return "Flanking"
|
||||||
|
end
|
||||||
|
if Aspect > 135 or Aspect <= -135 then
|
||||||
|
return "Cold"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Provides a Lat Lon string
|
--- Provides a Lat Lon string
|
||||||
|
|||||||
@ -1192,7 +1192,7 @@ do -- DETECTION_BASE
|
|||||||
end
|
end
|
||||||
|
|
||||||
DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes()
|
DetectedItem.Set = Set or SET_UNIT:New():FilterDeads():FilterCrashes()
|
||||||
DetectedItem.Index = DetectedItemIndex
|
DetectedItem.Index = DetectedItemIndex or self.DetectedItemCount
|
||||||
DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax
|
DetectedItem.ItemID = ItemPrefix .. "." .. self.DetectedItemMax
|
||||||
DetectedItem.ID = self.DetectedItemMax
|
DetectedItem.ID = self.DetectedItemMax
|
||||||
DetectedItem.Removed = false
|
DetectedItem.Removed = false
|
||||||
@ -1312,16 +1312,21 @@ do -- DETECTION_BASE
|
|||||||
function DETECTION_BASE:GetDetectedItemCoordinate( Index )
|
function DETECTION_BASE:GetDetectedItemCoordinate( Index )
|
||||||
|
|
||||||
-- If the Zone is set, return the coordinate of the Zone.
|
-- If the Zone is set, return the coordinate of the Zone.
|
||||||
|
local DetectedItemSet = self:GetDetectedSet( Index )
|
||||||
|
local FirstUnit = DetectedItemSet:GetFirst()
|
||||||
|
|
||||||
local DetectedZone = self:GetDetectedItemZone( Index )
|
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||||
if DetectedZone then
|
if DetectedZone then
|
||||||
return DetectedZone:GetCoordinate()
|
local Coordinate = DetectedZone:GetCoordinate()
|
||||||
|
Coordinate:SetHeading(FirstUnit:GetHeading())
|
||||||
|
return Coordinate
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If no Zone is set, return the coordinate of the first unit in the Set
|
-- If no Zone is set, return the coordinate of the first unit in the Set
|
||||||
local DetectedItemSet = self:GetDetectedSet( Index )
|
|
||||||
local FirstUnit = DetectedItemSet:GetFirst()
|
|
||||||
if FirstUnit then
|
if FirstUnit then
|
||||||
return FirstUnit:GetCoordinate()
|
local Coordinate = FirstUnit:GetCoordinate()
|
||||||
|
FirstUnit:SetHeading(FirstUnit:GetHeading())
|
||||||
|
return Coordinate
|
||||||
end
|
end
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -1404,9 +1404,7 @@ function TASK:ReportDetails( TaskGroup ) --R2.1 fixed report. Now nicely formatt
|
|||||||
if TaskInfoID == "Coordinates" then
|
if TaskInfoID == "Coordinates" then
|
||||||
local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate()
|
||||||
Report:Add( TaskInfoIDText )
|
Report:Add( TaskInfoIDText )
|
||||||
Report:AddIndent( TaskInfo:ToStringLL() )
|
Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
||||||
Report:AddIndent( TaskInfo:ToStringMGRS() )
|
|
||||||
Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) )
|
|
||||||
Report:AddIndent( TaskInfo:ToStringBULLS( TaskGroup:GetCoalition() ) )
|
Report:AddIndent( TaskInfo:ToStringBULLS( TaskGroup:GetCoalition() ) )
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
|
|||||||
@ -73,6 +73,7 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
|
|
||||||
self.Detection:FilterCategories( Unit.Category.AIRPLANE, Unit.Category.HELICOPTER )
|
self.Detection:FilterCategories( Unit.Category.AIRPLANE, Unit.Category.HELICOPTER )
|
||||||
self.Detection:InitDetectRadar( true )
|
self.Detection:InitDetectRadar( true )
|
||||||
|
self.Detection:SetDetectionInterval(30)
|
||||||
|
|
||||||
self:AddTransition( "Started", "Assign", "Started" )
|
self:AddTransition( "Started", "Assign", "Started" )
|
||||||
|
|
||||||
@ -191,6 +192,7 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
Task:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
Task:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
Task:SetInfo( "Coordinates", Detection:GetDetectedItemCoordinate( DetectedIndex ) )
|
Task:SetInfo( "Coordinates", Detection:GetDetectedItemCoordinate( DetectedIndex ) )
|
||||||
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
Task:SetInfo( "Changes", Detection:GetChangeText( DetectedItem ) )
|
||||||
|
Task:SetInfo( "Object", DetectedSet:GetFirst() )
|
||||||
Mission:AddTask( Task )
|
Mission:AddTask( Task )
|
||||||
else
|
else
|
||||||
self:E("This should not happen")
|
self:E("This should not happen")
|
||||||
|
|||||||
@ -149,6 +149,7 @@ function POSITIONABLE:GetCoordinate()
|
|||||||
local PositionableVec3 = self:GetPositionVec3()
|
local PositionableVec3 = self:GetPositionVec3()
|
||||||
|
|
||||||
local PositionableCoordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
local PositionableCoordinate = COORDINATE:NewFromVec3( PositionableVec3 )
|
||||||
|
PositionableCoordinate:SetHeading( self:GetHeading() )
|
||||||
|
|
||||||
self:T2( PositionableCoordinate )
|
self:T2( PositionableCoordinate )
|
||||||
return PositionableCoordinate
|
return PositionableCoordinate
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user