mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Mission goals
This commit is contained in:
@@ -146,7 +146,7 @@ function COMMANDCENTER:New( CommandCenterPositionable, CommandCenterName )
|
|||||||
local Mission = Mission -- Tasking.Mission#MISSION
|
local Mission = Mission -- Tasking.Mission#MISSION
|
||||||
local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
|
local PlayerGroup = EventData.IniGroup -- The GROUP object should be filled!
|
||||||
Mission:JoinUnit( PlayerUnit, PlayerGroup )
|
Mission:JoinUnit( PlayerUnit, PlayerGroup )
|
||||||
Mission:ReportDetails()
|
Mission:ReportDetails( PlayerGroup )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -220,6 +220,33 @@ function MISSION:New( CommandCenter, MissionName, MissionPriority, MissionBriefi
|
|||||||
-- @param #MISSION self
|
-- @param #MISSION self
|
||||||
-- @param #number Delay The delay in seconds.
|
-- @param #number Delay The delay in seconds.
|
||||||
|
|
||||||
|
|
||||||
|
self:AddTransition( "*", "MissionGoals", "*" )
|
||||||
|
|
||||||
|
--- MissionGoals Handler OnBefore for MISSION
|
||||||
|
-- @function [parent=#MISSION] OnBeforeMissionGoals
|
||||||
|
-- @param #MISSION self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
-- @return #boolean
|
||||||
|
|
||||||
|
--- MissionGoals Handler OnAfter for MISSION
|
||||||
|
-- @function [parent=#MISSION] OnAfterMissionGoals
|
||||||
|
-- @param #MISSION self
|
||||||
|
-- @param #string From
|
||||||
|
-- @param #string Event
|
||||||
|
-- @param #string To
|
||||||
|
|
||||||
|
--- MissionGoals Trigger for MISSION
|
||||||
|
-- @function [parent=#MISSION] MissionGoals
|
||||||
|
-- @param #MISSION self
|
||||||
|
|
||||||
|
--- MissionGoals Asynchronous Trigger for MISSION
|
||||||
|
-- @function [parent=#MISSION] __MissionGoals
|
||||||
|
-- @param #MISSION self
|
||||||
|
-- @param #number Delay
|
||||||
|
|
||||||
-- Private implementations
|
-- Private implementations
|
||||||
|
|
||||||
CommandCenter:SetMenu()
|
CommandCenter:SetMenu()
|
||||||
@@ -780,14 +807,14 @@ function MISSION:ReportOverview( ReportGroup, TaskStatus )
|
|||||||
local Status = self:GetState()
|
local Status = self:GetState()
|
||||||
local TasksRemaining = self:GetTasksRemaining()
|
local TasksRemaining = self:GetTasksRemaining()
|
||||||
|
|
||||||
Report:Add( string.format( '%s - Status "%s"', Name, Status ) )
|
Report:Add( string.format( '%s - %s - %s Tasks', Name, Status, TaskStatus ) )
|
||||||
|
|
||||||
-- Determine how many tasks are remaining.
|
-- Determine how many tasks are remaining.
|
||||||
local TasksRemaining = 0
|
local TasksRemaining = 0
|
||||||
for TaskID, Task in pairs( self:GetTasks() ) do
|
for TaskID, Task in pairs( self:GetTasks() ) do
|
||||||
local Task = Task -- Tasking.Task#TASK
|
local Task = Task -- Tasking.Task#TASK
|
||||||
if Task:Is( TaskStatus ) then
|
if Task:Is( TaskStatus ) then
|
||||||
Report:Add( "\n - " .. Task:ReportOverview( ReportGroup ) )
|
Report:Add( " - " .. Task:ReportOverview( ReportGroup ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1174,7 +1174,7 @@ function TASK:onenterSuccess( From, Event, To )
|
|||||||
self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " is successful! Good job!" )
|
self:GetMission():GetCommandCenter():MessageToCoalition( "Task " .. self:GetName() .. " is successful! Good job!" )
|
||||||
self:UnAssignFromGroups()
|
self:UnAssignFromGroups()
|
||||||
|
|
||||||
--self:GetMission():__Complete( 1 )
|
self:GetMission():__MissionGoals( 1 )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1312,14 +1312,14 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
|
|||||||
|
|
||||||
-- List the name of the Task.
|
-- List the name of the Task.
|
||||||
local Name = self:GetName()
|
local Name = self:GetName()
|
||||||
local Report = REPORT:New( "Task " .. Name )
|
local Report = REPORT:New( Name )
|
||||||
|
|
||||||
-- Determine the status of the Task.
|
-- Determine the status of the Task.
|
||||||
local State = self:GetState()
|
local State = self:GetState()
|
||||||
|
|
||||||
for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do
|
for TaskInfoID, TaskInfo in pairs( self.TaskInfo ) do
|
||||||
|
|
||||||
local TaskInfoIDText = string.format( " - %s: ", TaskInfoID )
|
local TaskInfoIDText = string.format( "%s: ", TaskInfoID )
|
||||||
|
|
||||||
if type(TaskInfo) == "string" then
|
if type(TaskInfo) == "string" then
|
||||||
Report:Add( TaskInfoIDText .. TaskInfo )
|
Report:Add( TaskInfoIDText .. TaskInfo )
|
||||||
@@ -1327,8 +1327,8 @@ function TASK:ReportOverview( ReportGroup ) --R2.1 fixed report. Now nicely form
|
|||||||
if TaskInfoID == "Coordinates" then
|
if TaskInfoID == "Coordinates" then
|
||||||
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
local FromCoordinate = ReportGroup:GetUnit(1):GetCoordinate()
|
||||||
local ToCoordinate = TaskInfo -- Core.Point#COORDINATE
|
local ToCoordinate = TaskInfo -- Core.Point#COORDINATE
|
||||||
Report:Add( TaskInfoIDText )
|
--Report:Add( TaskInfoIDText )
|
||||||
Report:AddIndent( ToCoordinate:ToStringBRA( FromCoordinate ) .. ", " .. TaskInfo:ToStringAspect( FromCoordinate ) )
|
Report:Add( ToCoordinate:ToString( ReportGroup ) )
|
||||||
--Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
--Report:AddIndent( ToCoordinate:ToStringBULLS( ReportGroup:GetCoalition() ) )
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ do -- TASK_A2A_INTERCEPT
|
|||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate )
|
||||||
|
|
||||||
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
@@ -420,7 +420,7 @@ do -- TASK_A2A_ENGAGE
|
|||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate )
|
||||||
|
|
||||||
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ do -- TASK_SEAD
|
|||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate )
|
||||||
|
|
||||||
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
@@ -425,7 +425,7 @@ do -- TASK_BAI
|
|||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate )
|
||||||
|
|
||||||
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
@@ -468,7 +468,7 @@ do -- TASK_CAS
|
|||||||
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
local TargetCoordinate = TargetSetUnit:GetFirst():GetCoordinate()
|
||||||
self:SetInfo( "Coordinates", TargetCoordinate )
|
self:SetInfo( "Coordinates", TargetCoordinate )
|
||||||
|
|
||||||
self:SetInfo( "ThreatLevel", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
self:SetInfo( "Threat", "[" .. string.rep( "■", TargetSetUnit:CalculateThreatLevelA2G() ) .. "]" )
|
||||||
local DetectedItemsCount = TargetSetUnit:Count()
|
local DetectedItemsCount = TargetSetUnit:Count()
|
||||||
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
local DetectedItemsTypes = TargetSetUnit:GetTypeNames()
|
||||||
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
self:SetInfo( "Targets", string.format( "%d of %s", DetectedItemsCount, DetectedItemsTypes ) )
|
||||||
|
|||||||
@@ -426,6 +426,24 @@ function GROUP:GetTypeName()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Gets the player name of the group.
|
||||||
|
-- @param #GROUP self
|
||||||
|
-- @return #string The player name of the group.
|
||||||
|
function GROUP:GetPlayerName()
|
||||||
|
self:F2( self.GroupName )
|
||||||
|
|
||||||
|
local DCSGroup = self:GetDCSObject()
|
||||||
|
|
||||||
|
if DCSGroup then
|
||||||
|
local PlayerName = DCSGroup:getUnit(1):getPlayerName()
|
||||||
|
self:T3( PlayerName )
|
||||||
|
return( PlayerName )
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Gets the CallSign of the first DCS Unit of the DCS Group.
|
--- Gets the CallSign of the first DCS Unit of the DCS Group.
|
||||||
-- @param #GROUP self
|
-- @param #GROUP self
|
||||||
-- @return #string The CallSign of the first DCS Unit of the DCS Group.
|
-- @return #string The CallSign of the first DCS Unit of the DCS Group.
|
||||||
|
|||||||
Reference in New Issue
Block a user