mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-19 05:36:02 +00:00
Urgent fixes
* DESIGNATE: Messages not appearing correctly and crashing the logic is fixed. (due to a stupid typo). * TASK_A2G: Tasking is fixed. Status menus are now displayed properly. Also when the task is planned. * MENU_COMMAND: I found now why DCS is displayer "error in error handler" sometimes when a menu was selected. The error handler is DCS is bugged, so made my own one.
This commit is contained in:
@@ -140,10 +140,23 @@ do -- MENU_COMMAND_BASE
|
|||||||
|
|
||||||
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) ) -- #MENU_COMMAND_BASE
|
local self = BASE:Inherit( self, MENU_BASE:New( MenuText, ParentMenu ) ) -- #MENU_COMMAND_BASE
|
||||||
|
|
||||||
|
-- When a menu function goes into error, DCS displays an obscure menu message.
|
||||||
|
-- This error handler catches the menu error and displays the full call stack.
|
||||||
|
local ErrorHandler = function( errmsg )
|
||||||
|
env.info( "MOOSE error in MENU COMMAND function: " .. errmsg )
|
||||||
|
if debug ~= nil then
|
||||||
|
env.info( debug.traceback() )
|
||||||
|
end
|
||||||
|
return errmsg
|
||||||
|
end
|
||||||
|
|
||||||
self:SetCommandMenuFunction( CommandMenuFunction )
|
self:SetCommandMenuFunction( CommandMenuFunction )
|
||||||
self:SetCommandMenuArguments( CommandMenuArguments )
|
self:SetCommandMenuArguments( CommandMenuArguments )
|
||||||
self.MenuCallHandler = function()
|
self.MenuCallHandler = function()
|
||||||
self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
|
local function MenuFunction()
|
||||||
|
return self.CommandMenuFunction( unpack( self.CommandMenuArguments ) )
|
||||||
|
end
|
||||||
|
local Status, Result = xpcall( MenuFunction, ErrorHandler )
|
||||||
end
|
end
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|||||||
@@ -888,6 +888,8 @@ end
|
|||||||
-- @return #string
|
-- @return #string
|
||||||
function MISSION:ReportOverview( ReportGroup, TaskStatus )
|
function MISSION:ReportOverview( ReportGroup, TaskStatus )
|
||||||
|
|
||||||
|
self:F( { TaskStatus = TaskStatus } )
|
||||||
|
|
||||||
local Report = REPORT:New()
|
local Report = REPORT:New()
|
||||||
|
|
||||||
-- List the name of the mission.
|
-- List the name of the mission.
|
||||||
|
|||||||
@@ -366,7 +366,8 @@ do -- TASK_A2G_SEAD
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TASK_A2G_SEAD:ReportOrder( ReportGroup )
|
function TASK_A2G_SEAD:ReportOrder( ReportGroup )
|
||||||
local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
local Coordinate = self:GetInfo( "Coordinates" )
|
||||||
|
--local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
||||||
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
||||||
|
|
||||||
return Distance
|
return Distance
|
||||||
@@ -515,7 +516,8 @@ do -- TASK_A2G_BAI
|
|||||||
|
|
||||||
|
|
||||||
function TASK_A2G_BAI:ReportOrder( ReportGroup )
|
function TASK_A2G_BAI:ReportOrder( ReportGroup )
|
||||||
local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
local Coordinate = self:GetInfo( "Coordinates" )
|
||||||
|
--local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
||||||
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
||||||
|
|
||||||
return Distance
|
return Distance
|
||||||
@@ -630,7 +632,7 @@ do -- TASK_A2G_CAS
|
|||||||
|
|
||||||
function TASK_A2G_CAS:UpdateTaskInfo()
|
function TASK_A2G_CAS:UpdateTaskInfo()
|
||||||
|
|
||||||
local TargetCoordinate = self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) or self.TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = ( self.Detection and self.Detection:GetDetectedItemCoordinate( self.DetectedItemIndex ) ) or self.TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate, 0 )
|
self:SetInfo( "Coordinates", TargetCoordinate, 0 )
|
||||||
|
|
||||||
local ThreatLevel, ThreatText
|
local ThreatLevel, ThreatText
|
||||||
@@ -661,8 +663,10 @@ do -- TASK_A2G_CAS
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param #TASK_A2G_CAS self
|
||||||
function TASK_A2G_CAS:ReportOrder( ReportGroup )
|
function TASK_A2G_CAS:ReportOrder( ReportGroup )
|
||||||
local Coordinate = self.TaskInfo.Coordinates.TaskInfoText
|
|
||||||
|
local Coordinate = self:GetInfo( "Coordinates" )
|
||||||
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
local Distance = ReportGroup:GetCoordinate():Get2DDistance( Coordinate )
|
||||||
|
|
||||||
return Distance
|
return Distance
|
||||||
|
|||||||
@@ -372,6 +372,7 @@ do -- TASK_A2G_DISPATCHER
|
|||||||
self.Tasks[TaskIndex] = Task
|
self.Tasks[TaskIndex] = Task
|
||||||
Task:SetTargetZone( DetectedZone )
|
Task:SetTargetZone( DetectedZone )
|
||||||
Task:SetDispatcher( self )
|
Task:SetDispatcher( self )
|
||||||
|
Task:UpdateTaskInfo()
|
||||||
Mission:AddTask( Task )
|
Mission:AddTask( Task )
|
||||||
|
|
||||||
TaskReport:Add( Task:GetName() )
|
TaskReport:Add( Task:GetName() )
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ function POSITIONABLE:MessageToSetGroup( Message, Duration, MessageSetGroup, Nam
|
|||||||
if DCSObject:isExist() then
|
if DCSObject:isExist() then
|
||||||
MessageSetGroup:ForEachGroup(
|
MessageSetGroup:ForEachGroup(
|
||||||
function( MessageGroup )
|
function( MessageGroup )
|
||||||
self:GetMessageType( Message, Duration, Name ):ToGroup( MessageGroup )
|
self:GetMessage( Message, Duration, Name ):ToGroup( MessageGroup )
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user