From 7f7570429a322f00fe1636dde04bebd90ab688d3 Mon Sep 17 00:00:00 2001 From: FlightControl Date: Wed, 14 Dec 2016 20:05:45 +0100 Subject: [PATCH] Abort working now as it should... fiew... what a work was that ... --- .../Moose/Tasking/CommandCenter.lua | 8 ++++++++ Moose Development/Moose/Tasking/Task.lua | 9 ++++++--- .../Moose/Wrapper/Positionable.lua | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Tasking/CommandCenter.lua b/Moose Development/Moose/Tasking/CommandCenter.lua index f14a49dd5..797711cc4 100644 --- a/Moose Development/Moose/Tasking/CommandCenter.lua +++ b/Moose Development/Moose/Tasking/CommandCenter.lua @@ -200,6 +200,14 @@ function COMMANDCENTER:MessageToGroup( Message, TaskGroup ) end +--- Send a CC message to the coalition of the CC. +-- @param #COMMANDCENTER self +function COMMANDCENTER:MessageToCoalition( Message ) + + local CCCoalition = self:GetPositionable():GetCoalition() + self:GetPositionable():MessageToBlue( Message , 20, CCCoalition ) + +end --- Report the status of all MISSIONs to a GROUP. -- @param #COMMANDCENTER self function COMMANDCENTER:ReportMissions( ReportGroup ) diff --git a/Moose Development/Moose/Tasking/Task.lua b/Moose Development/Moose/Tasking/Task.lua index 8e9365ef8..e7e8ca47a 100644 --- a/Moose Development/Moose/Tasking/Task.lua +++ b/Moose Development/Moose/Tasking/Task.lua @@ -218,8 +218,8 @@ function TASK_BASE:AbortUnit( PlayerUnit ) if IsAssignedToGroup then self:UnAssignFromUnit( PlayerUnit ) self:MessageToGroups( PlayerUnit:GetPlayerName() .. " aborted Task " .. self:GetName() ) - self:E( { TaskGroup = PlayerGroup:GetName(), HasAliveUnits = self:HasAliveUnits() } ) - if self:HasAliveUnits() == false then + self:E( { TaskGroup = PlayerGroup:GetName(), GetUnits = PlayerGroup:GetUnits() } ) + if #PlayerGroup:GetUnits() == 1 then PlayerGroup:SetState( PlayerGroup, "Assigned", nil ) self:RemoveMenuForGroup( PlayerGroup ) self:__Abort( 1 ) @@ -837,7 +837,10 @@ function TASK_BASE:onenterAborted( Event, From, To ) self:E("Aborted") - self:MessageToGroups( "Task " .. self:GetName() .. " has been aborted! Task will be replanned." ) + self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " has been aborted! Task will be replanned." ) + + self:__Replan( 10 ) + end diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 9cee3d91e..8b449bf7e 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -307,6 +307,23 @@ function POSITIONABLE:MessageToAll( Message, Duration ) return nil 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 Dcs.DCSTYpes#Duration Duration The duration of the message. +function POSITIONABLE:MessageToCoalition( Message, Duration, MessageCoalition ) + self:F2( { Message, Duration } ) + + local DCSObject = self:GetDCSObject() + if DCSObject then + self:GetMessage( Message, Duration ):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