mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-22 05:52:54 +00:00
Progress designing system settings
This commit is contained in:
@@ -154,27 +154,19 @@ do -- ACT_ROUTE
|
|||||||
--- Get the routing text to be displayed.
|
--- Get the routing text to be displayed.
|
||||||
-- The route mode determines the text displayed.
|
-- The route mode determines the text displayed.
|
||||||
-- @param #ACT_ROUTE self
|
-- @param #ACT_ROUTE self
|
||||||
|
-- @param Core.Point#COORDINATE FromCoordinate
|
||||||
-- @return #string
|
-- @return #string
|
||||||
function ACT_ROUTE:GetRouteText( FromCoordinate )
|
function ACT_ROUTE:GetRouteText( FromCoordinate )
|
||||||
|
|
||||||
local RouteText = ""
|
local RouteText = ""
|
||||||
|
|
||||||
if self.Coordinate and self.RouteMode == "B" then
|
|
||||||
RouteText = "Route to " .. FromCoordinate:GetBRText( self.Coordinate ) .. " km."
|
if self.Coordinate then
|
||||||
|
RouteText = "Route to " .. self.Coordinate:ToString( FromCoordinate )
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.Coordinate and self.RouteMode == "C" then
|
if self.Zone then
|
||||||
RouteText = "Route to " .. self.Coordinate:ToString()
|
RouteText = "Route to " .. self.Zone:GetCoordinate():ToString( FromCoordinate )
|
||||||
end
|
|
||||||
|
|
||||||
if self.Zone and self.RouteMode == "B" then
|
|
||||||
local Coordinate = self.Zone:GetCoordinate()
|
|
||||||
RouteText = "Route to zone bearing " .. FromCoordinate:GetBRText( Coordinate ) .. " km."
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.Zone and self.RouteMode == "C" then
|
|
||||||
local Coordinate = self.Zone:GetCoordinate()
|
|
||||||
RouteText = "Route to zone at " .. Coordinate:ToString()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return RouteText
|
return RouteText
|
||||||
@@ -438,10 +430,7 @@ do -- ACT_ROUTE_ZONE
|
|||||||
-- @param #string To
|
-- @param #string To
|
||||||
function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To )
|
function ACT_ROUTE_ZONE:onafterReport( ProcessUnit, From, Event, To )
|
||||||
|
|
||||||
local ZoneVec2 = self.Zone:GetVec2()
|
local TaskUnitCoordinate = ProcessUnit:GetCoordinate()
|
||||||
local ZoneCoordinate = COORDINATE:New( ZoneVec2.x, ZoneVec2.y )
|
|
||||||
local TaskUnitVec2 = ProcessUnit:GetVec2()
|
|
||||||
local TaskUnitCoordinate = COORDINATE:New( TaskUnitVec2.x, TaskUnitVec2.y )
|
|
||||||
local RouteText = self:GetRouteText( TaskUnitCoordinate )
|
local RouteText = self:GetRouteText( TaskUnitCoordinate )
|
||||||
self:Message( RouteText )
|
self:Message( RouteText )
|
||||||
end
|
end
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,228 @@
|
|||||||
|
--- **Core** - **SETTINGS** classe defines the format settings management for measurement.
|
||||||
|
--
|
||||||
|
-- 
|
||||||
|
--
|
||||||
|
-- ====
|
||||||
|
--
|
||||||
|
-- # Demo Missions
|
||||||
|
--
|
||||||
|
-- ### [SETTINGS Demo Missions source code]()
|
||||||
|
--
|
||||||
|
-- ### [SETTINGS Demo Missions, only for beta testers]()
|
||||||
|
--
|
||||||
|
-- ### [ALL Demo Missions pack of the last release](https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases)
|
||||||
|
--
|
||||||
|
-- ====
|
||||||
|
--
|
||||||
|
-- # YouTube Channel
|
||||||
|
--
|
||||||
|
-- ### [SETTINGS YouTube Channel]()
|
||||||
|
--
|
||||||
|
-- ===
|
||||||
|
--
|
||||||
|
-- ### Authors:
|
||||||
|
--
|
||||||
|
-- * FlightControl : Design & Programming
|
||||||
|
--
|
||||||
|
-- ### Contributions:
|
||||||
|
--
|
||||||
|
-- @module Settings
|
||||||
|
|
||||||
|
|
||||||
|
--- @type SETTINGS
|
||||||
|
-- @field #number LL_Accuracy
|
||||||
|
-- @field #boolean LL_DMS
|
||||||
|
-- @field #number MGRS_Accuracy
|
||||||
|
-- @field #string A2GSystem
|
||||||
|
-- @field #string A2ASystem
|
||||||
|
-- @extends Core.Base#BASE
|
||||||
|
|
||||||
|
--- # SETTINGS class, extends @{Base#BASE}
|
||||||
|
--
|
||||||
|
-- @field #SETTINGS
|
||||||
|
SETTINGS = {
|
||||||
|
ClassName = "SETTINGS",
|
||||||
|
LL_Accuracy = 2,
|
||||||
|
LL_DMS = true,
|
||||||
|
MGRS_Accuracy = 5,
|
||||||
|
A2GSystem = "MGRS",
|
||||||
|
A2ASystem = "BRA",
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
do -- SETTINGS
|
||||||
|
|
||||||
|
--- SETTINGS constructor.
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:New()
|
||||||
|
|
||||||
|
local self = BASE:Inherit( self, BASE:New() ) -- #SETTINGS
|
||||||
|
|
||||||
|
self:SetMetric() -- Defaults
|
||||||
|
self:SetA2G_MGRS() -- Defaults
|
||||||
|
self:SetA2A_BRA() -- Defaults
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Sets the SETTINGS metric.
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
function SETTINGS:SetMetric()
|
||||||
|
self.Metric = true
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets if the SETTINGS is metric.
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if metric.
|
||||||
|
function SETTINGS:IsMetric()
|
||||||
|
return self.Metric == true
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets the SETTINGS imperial.
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
function SETTINGS:SetImperial()
|
||||||
|
self.Metric = false
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Gets if the SETTINGS is imperial.
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if imperial.
|
||||||
|
function SETTINGS:IsImperial()
|
||||||
|
return self.Metric == false
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets A2G LL
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:SetA2G_LL()
|
||||||
|
self.A2GSystem = "LL"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Is LL
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if LL
|
||||||
|
function SETTINGS:IsA2G_LL()
|
||||||
|
return self.A2GSystem == "LL"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets A2G MGRS
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:SetA2G_MGRS()
|
||||||
|
self.A2GSystem = "MGRS"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Is MGRS
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if MGRS
|
||||||
|
function SETTINGS:IsA2G_MGRS()
|
||||||
|
return self.A2GSystem == "MGRS"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets A2A BRA
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:SetA2A_BRA()
|
||||||
|
self.A2ASystem = "BRA"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Is BRA
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if BRA
|
||||||
|
function SETTINGS:IsA2A_BRA()
|
||||||
|
return self.A2ASystem == "BRA"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Sets A2A BULLS
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:SetA2A_BULLS()
|
||||||
|
self.A2ASystem = "BULLS"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Is BULLS
|
||||||
|
-- @param #SETTINGS self
|
||||||
|
-- @return #boolean true if BULLS
|
||||||
|
function SETTINGS:IsA2A_BULLS()
|
||||||
|
return self.A2ASystem == "BULLS"
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
-- @return #SETTINGS
|
||||||
|
function SETTINGS:SettingsMenu( RootMenu )
|
||||||
|
|
||||||
|
if self.SystemMenu then
|
||||||
|
self.SystemMenu:Remove()
|
||||||
|
self.SystemMenu = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
self.SystemMenu = MENU_MISSION:New( "Coordinate Settings" )
|
||||||
|
local A2GCoordinateMenu = MENU_MISSION:New( "A2G Coordinate System", self.SystemMenu )
|
||||||
|
|
||||||
|
if self:IsA2GLL() then
|
||||||
|
MENU_MISSION_COMMAND:New( "Activate MGRS", A2GCoordinateMenu, self.A2GMenuSystem, self, "MGRS" )
|
||||||
|
MENU_MISSION_COMMAND:New( "LL Accuracy 1", A2GCoordinateMenu, self.MenuLL_Accuracy, self, 1 )
|
||||||
|
MENU_MISSION_COMMAND:New( "LL Accuracy 2", A2GCoordinateMenu, self.MenuLL_Accuracy, self, 2 )
|
||||||
|
MENU_MISSION_COMMAND:New( "LL Accuracy 3", A2GCoordinateMenu, self.MenuLL_Accuracy, self, 3 )
|
||||||
|
MENU_MISSION_COMMAND:New( "LL Decimal On", A2GCoordinateMenu, self.MenuLL_DMS, self, true )
|
||||||
|
MENU_MISSION_COMMAND:New( "LL Decimal Off", A2GCoordinateMenu, self.MenuLL_DMS, self, false )
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:IsA2GMGRS() then
|
||||||
|
MENU_MISSION_COMMAND:New( "Activate LL", A2GCoordinateMenu, self.A2GMenuSystem, self, "LL" )
|
||||||
|
MENU_MISSION_COMMAND:New( "MGRS Accuracy 1", A2GCoordinateMenu, self.MenuMGRS_Accuracy, self, 1 )
|
||||||
|
MENU_MISSION_COMMAND:New( "MGRS Accuracy 2", A2GCoordinateMenu, self.MenuMGRS_Accuracy, self, 2 )
|
||||||
|
MENU_MISSION_COMMAND:New( "MGRS Accuracy 3", A2GCoordinateMenu, self.MenuMGRS_Accuracy, self, 3 )
|
||||||
|
MENU_MISSION_COMMAND:New( "MGRS Accuracy 4", A2GCoordinateMenu, self.MenuMGRS_Accuracy, self, 4 )
|
||||||
|
MENU_MISSION_COMMAND:New( "MGRS Accuracy 5", A2GCoordinateMenu, self.MenuMGRS_Accuracy, self, 5 )
|
||||||
|
end
|
||||||
|
|
||||||
|
local A2ACoordinateMenu = MENU_MISSION:New( "A2A Coordinate System", self.SystemMenu )
|
||||||
|
|
||||||
|
if self:IsA2ABULLS() then
|
||||||
|
MENU_MISSION_COMMAND:New( "Activate BRA", A2GCoordinateMenu, self.A2AMenuSystem, self, "BRA" )
|
||||||
|
end
|
||||||
|
|
||||||
|
if self:IsA2ABRA() then
|
||||||
|
MENU_MISSION_COMMAND:New( "Activate BULLS", A2GCoordinateMenu, self.A2AMenuSystem, self, "BULLS" )
|
||||||
|
end
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
function SETTINGS:A2GMenuSystem( A2GSystem )
|
||||||
|
self.A2GSystem = A2GSystem
|
||||||
|
self:CoordinateMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
function SETTINGS:A2AMenuSystem( A2ASystem )
|
||||||
|
self.A2ASystem = A2ASystem
|
||||||
|
self:CoordinateMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
function SETTINGS:MenuLL_Accuracy( LL_Accuracy )
|
||||||
|
self.LL_Accuracy = LL_Accuracy
|
||||||
|
self:CoordinateMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
function SETTINGS:MenuLL_DMS( LL_DMS )
|
||||||
|
self.LL_DMS = LL_DMS
|
||||||
|
self:CoordinateMenu()
|
||||||
|
end
|
||||||
|
--- @param #SETTINGS self
|
||||||
|
function SETTINGS:MenuMGRS_Accuracy( MGRS_Accuracy )
|
||||||
|
self.MGRS_Accuracy = MGRS_Accuracy
|
||||||
|
self:CoordinateMenu()
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -1308,7 +1308,7 @@ do -- DETECTION_BASE
|
|||||||
--- Get the COORDINATE of a detection item using a given numeric index.
|
--- Get the COORDINATE of a detection item using a given numeric index.
|
||||||
-- @param #DETECTION_BASE self
|
-- @param #DETECTION_BASE self
|
||||||
-- @param #number Index
|
-- @param #number Index
|
||||||
-- @return Core.Point#COORDINATE Coordinate
|
-- @return Core.Point#COORDINATE
|
||||||
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.
|
||||||
@@ -1317,14 +1317,15 @@ do -- DETECTION_BASE
|
|||||||
|
|
||||||
local DetectedZone = self:GetDetectedItemZone( Index )
|
local DetectedZone = self:GetDetectedItemZone( Index )
|
||||||
if DetectedZone then
|
if DetectedZone then
|
||||||
local Coordinate = DetectedZone:GetCoordinate()
|
local Coordinate = DetectedZone:GetPointVec2()
|
||||||
Coordinate:SetHeading(FirstUnit:GetHeading())
|
Coordinate:SetHeading(FirstUnit:GetHeading())
|
||||||
|
Coordinate:SetAlt( FirstUnit:GetAltitude() )
|
||||||
return Coordinate
|
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
|
||||||
if FirstUnit then
|
if FirstUnit then
|
||||||
local Coordinate = FirstUnit:GetCoordinate()
|
local Coordinate = FirstUnit:GetPointVec3()
|
||||||
FirstUnit:SetHeading(FirstUnit:GetHeading())
|
FirstUnit:SetHeading(FirstUnit:GetHeading())
|
||||||
return Coordinate
|
return Coordinate
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ _SCHEDULEDISPATCHER = SCHEDULEDISPATCHER:New() -- Core.Timer#SCHEDULEDISPATCHER
|
|||||||
--- Declare the main database object, which is used internally by the MOOSE classes.
|
--- Declare the main database object, which is used internally by the MOOSE classes.
|
||||||
_DATABASE = DATABASE:New() -- Database#DATABASE
|
_DATABASE = DATABASE:New() -- Database#DATABASE
|
||||||
|
|
||||||
--COORDINATE:CoordinateMenu()
|
_SETTINGS = SETTINGS:New()
|
||||||
|
_SETTINGS:SettingsMenu(nil)
|
||||||
|
|||||||
@@ -1403,9 +1403,10 @@ function TASK:ReportDetails( TaskGroup ) --R2.1 fixed report. Now nicely formatt
|
|||||||
elseif type(TaskInfo) == "table" then
|
elseif type(TaskInfo) == "table" then
|
||||||
if TaskInfoID == "Coordinates" then
|
if TaskInfoID == "Coordinates" then
|
||||||
local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = TaskGroup:GetUnit(1):GetCoordinate()
|
||||||
|
local ToCoordinate = TaskInfo -- Core.Point#COORDINATE
|
||||||
Report:Add( TaskInfoIDText )
|
Report:Add( TaskInfoIDText )
|
||||||
Report:AddIndent( TaskInfo:ToStringBRAA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
Report:AddIndent( ToCoordinate:ToStringBRAA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
||||||
Report:AddIndent( TaskInfo:ToStringBULLS( TaskGroup:GetCoalition() ) )
|
Report:AddIndent( ToCoordinate:ToStringBULLS( TaskGroup:GetCoalition() ) )
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
self.Mission = Mission
|
self.Mission = Mission
|
||||||
|
|
||||||
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.Detection:SetDetectionInterval( 30 )
|
||||||
|
|
||||||
self:AddTransition( "Started", "Assign", "Started" )
|
self:AddTransition( "Started", "Assign", "Started" )
|
||||||
@@ -190,7 +190,11 @@ do -- TASK_A2A_DISPATCHER
|
|||||||
local DetectedItemsCount = DetectedSet:Count()
|
local DetectedItemsCount = DetectedSet:Count()
|
||||||
local DetectedItemsTypes = DetectedSet:GetTypeNames()
|
local DetectedItemsTypes = DetectedSet:GetTypeNames()
|
||||||
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 ) )
|
|
||||||
|
local Coordinate = Detection:GetDetectedItemCoordinate( DetectedIndex )
|
||||||
|
Coordinate:SetModeA2A()
|
||||||
|
|
||||||
|
Task:SetInfo( "Coordinates", Coordinate )
|
||||||
Task:SetInfo( "Object", DetectedSet:GetFirst() )
|
Task:SetInfo( "Object", DetectedSet:GetFirst() )
|
||||||
Mission:AddTask( Task )
|
Mission:AddTask( Task )
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ Core/Base.lua
|
|||||||
Core/Scheduler.lua
|
Core/Scheduler.lua
|
||||||
Core/ScheduleDispatcher.lua
|
Core/ScheduleDispatcher.lua
|
||||||
Core/Event.lua
|
Core/Event.lua
|
||||||
|
Core/Settings.lua
|
||||||
Core/Menu.lua
|
Core/Menu.lua
|
||||||
Core/Zone.lua
|
Core/Zone.lua
|
||||||
Core/Database.lua
|
Core/Database.lua
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||||
env.info( 'Moose Generation Timestamp: 20170517_1856' )
|
env.info( 'Moose Generation Timestamp: 20170520_0827' )
|
||||||
|
|
||||||
local base = _G
|
local base = _G
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ __Moose.Include( 'Core/Base.lua' )
|
|||||||
__Moose.Include( 'Core/Scheduler.lua' )
|
__Moose.Include( 'Core/Scheduler.lua' )
|
||||||
__Moose.Include( 'Core/ScheduleDispatcher.lua' )
|
__Moose.Include( 'Core/ScheduleDispatcher.lua' )
|
||||||
__Moose.Include( 'Core/Event.lua' )
|
__Moose.Include( 'Core/Event.lua' )
|
||||||
|
__Moose.Include( 'Core/Settings.lua' )
|
||||||
__Moose.Include( 'Core/Menu.lua' )
|
__Moose.Include( 'Core/Menu.lua' )
|
||||||
__Moose.Include( 'Core/Zone.lua' )
|
__Moose.Include( 'Core/Zone.lua' )
|
||||||
__Moose.Include( 'Core/Database.lua' )
|
__Moose.Include( 'Core/Database.lua' )
|
||||||
|
|||||||
Reference in New Issue
Block a user