diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua index 3b38720dc..c42cea39c 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -387,6 +387,20 @@ function COMMANDCENTER:MessageToCoalition( Message ) end +--- Send a CC message of a specified type to the coalition of the CC. +-- @param #COMMANDCENTER self +-- @param #string Message The message. +-- @param Core.Message#MESSAGE.MessageType MessageType The type of the message, resulting in automatic time duration and prefix of the message. +function COMMANDCENTER:MessageTypeToCoalition( Message, MessageType ) + + local CCCoalition = self:GetPositionable():GetCoalition() + --TODO: Fix coalition bug! + + self:GetPositionable():MessageTypeToCoalition( Message, MessageType, CCCoalition ) + +end + + --- Report the status of all MISSIONs to a GROUP. -- Each Mission is listed, with an indication how many Tasks are still to be completed. -- @param #COMMANDCENTER self diff --git a/Moose Development/Moose/Tasking/Mission.lua b/Moose Development/Moose/Tasking/Mission.lua index 8565078f2..57b52983e 100644 --- a/Moose Development/Moose/Tasking/Mission.lua +++ b/Moose Development/Moose/Tasking/Mission.lua @@ -264,14 +264,14 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi end --- FSM function for a MISSION +--- FSM function for a MISSION -- @param #MISSION self -- @param #string From -- @param #string Event -- @param #string To function MISSION:onenterCOMPLETED( From, Event, To ) - self:GetCommandCenter():MessageToCoalition( self:GetName() .. " has been completed! Good job guys!" ) + self:GetCommandCenter():MessageTypeToCoalition( self:GetName() .. " has been completed! Good job guys!", MESSAGE.Type.Information ) end --- Gets the mission name. @@ -958,7 +958,7 @@ function MISSION:MenuReportBriefing( ReportGroup ) local Report = self:ReportBriefing() - self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) + self:GetCommandCenter():MessageTypeToGroup( Report, ReportGroup, MESSAGE.Type.Briefing ) end @@ -970,7 +970,7 @@ function MISSION:MenuReportTasksSummary( ReportGroup ) local Report = self:ReportSummary( ReportGroup ) - self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) + self:GetCommandCenter():MessageTypeToGroup( Report, ReportGroup, MESSAGE.Type.Overview ) end @@ -983,7 +983,7 @@ function MISSION:MenuReportTasksPerStatus( ReportGroup, TaskStatus ) local Report = self:ReportOverview( ReportGroup, TaskStatus ) - self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) + self:GetCommandCenter():MessageTypeToGroup( Report, ReportGroup, MESSAGE.Type.Overview ) end @@ -993,7 +993,7 @@ function MISSION:MenuReportPlayersPerTask( ReportGroup ) local Report = self:ReportPlayersPerTask() - self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) + self:GetCommandCenter():MessageTypeToGroup( Report, ReportGroup, MESSAGE.Type.Overview ) end --- @param #MISSION self @@ -1002,7 +1002,7 @@ function MISSION:MenuReportPlayersProgress( ReportGroup ) local Report = self:ReportPlayersProgress() - self:GetCommandCenter():MessageToGroup( Report, ReportGroup ) + self:GetCommandCenter():MessageTypeToGroup( Report, ReportGroup, MESSAGE.Type.Overview ) end diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 7000f09ac..07904d069 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -884,7 +884,7 @@ function TASK:MenuTaskStatus( TaskGroup ) local ReportText = self:ReportDetails( TaskGroup ) self:T( ReportText ) - self:GetMission():GetCommandCenter():MessageToGroup( ReportText, TaskGroup ) + self:GetMission():GetCommandCenter():MessageTypeToGroup( ReportText, TaskGroup, MESSAGE.Type.Detailed ) end diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 1bde60935..ec24b47ed 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -502,6 +502,32 @@ function POSITIONABLE:MessageToCoalition( Message, Duration, MessageCoalition ) end +--- Send a message to a coalition. +-- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message. +-- @param #POSITIONABLE self +-- @param #string Message The message text +-- @param Core.Message#MESSAGE.Type MessageType The message type that determines the duration. +-- @param Dcs.DCScoalition#coalition MessageCoalition The Coalition receiving the message. +function POSITIONABLE:MessageTypeToCoalition( Message, MessageType, MessageCoalition ) + self:F2( { Message, MessageType } ) + + local Name = "" + + local DCSObject = self:GetDCSObject() + if DCSObject then + if MessageCoalition == coalition.side.BLUE then + Name = "Blue coalition" + end + if MessageCoalition == coalition.side.RED then + Name = "Red coalition" + end + self:GetMessageType( Message, MessageType, Name ):ToCoalition( MessageCoalition ) + end + + return nil +end + + --- Send a message to the red coalition. -- The message will appear in the message area. The message will begin with the callsign of the group and the type of the first unit sending the message. -- @param #POSITIONABLE self