mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop' into FF/Develop
This commit is contained in:
commit
31207c3368
@ -107,8 +107,9 @@ do -- Goal
|
||||
end
|
||||
|
||||
|
||||
--- @param #GOAL self
|
||||
-- @param #string PlayerName
|
||||
--- Add a new contribution by a player.
|
||||
-- @param #GOAL self
|
||||
-- @param #string PlayerName The name of the player.
|
||||
function GOAL:AddPlayerContribution( PlayerName )
|
||||
self.Players[PlayerName] = self.Players[PlayerName] or 0
|
||||
self.Players[PlayerName] = self.Players[PlayerName] + 1
|
||||
@ -123,21 +124,28 @@ do -- Goal
|
||||
end
|
||||
|
||||
|
||||
--- @param #GOAL self
|
||||
--- Get the players who contributed to achieve the goal.
|
||||
-- The result is a list of players, sorted by the name of the players.
|
||||
-- @param #GOAL self
|
||||
-- @return #list The list of players, indexed by the player name.
|
||||
function GOAL:GetPlayerContributions()
|
||||
return self.Players or {}
|
||||
end
|
||||
|
||||
|
||||
--- @param #GOAL self
|
||||
--- Gets the total contributions that happened to achieve the goal.
|
||||
-- The result is a number.
|
||||
-- @param #GOAL self
|
||||
-- @return #number The total number of contributions. 0 is returned if there were no contributions (yet).
|
||||
function GOAL:GetTotalContributions()
|
||||
return self.TotalContributions or 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- @param #GOAL self
|
||||
-- @return #boolean true if the goal is Achieved
|
||||
--- Validates if the goal is achieved.
|
||||
-- @param #GOAL self
|
||||
-- @return #boolean true if the goal is achieved.
|
||||
function GOAL:IsAchieved()
|
||||
return self:Is( "Achieved" )
|
||||
end
|
||||
|
||||
@ -496,7 +496,12 @@ end
|
||||
|
||||
--- Sets the coalition of the spawned group. Note that it might be necessary to also set the country explicitly!
|
||||
-- @param #SPAWN self
|
||||
-- @param DCS#coalition.side Coalition Coalition of the group as number of enumerator, i.e. 0=coaliton.side.NEUTRAL, 1=coaliton.side.RED, 2=coalition.side.BLUE.
|
||||
-- @param DCS#coalition.side Coalition Coalition of the group as number of enumerator:
|
||||
--
|
||||
-- * @{DCS#coaliton.side.NEUTRAL}
|
||||
-- * @{DCS#coaliton.side.RED}
|
||||
-- * @{DCS#coalition.side.BLUE}
|
||||
--
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitCoalition( Coalition )
|
||||
self:F({coalition=Coalition})
|
||||
@ -507,9 +512,12 @@ function SPAWN:InitCoalition( Coalition )
|
||||
end
|
||||
|
||||
--- Sets the country of the spawn group. Note that the country determins the coalition of the group depending on which country is defined to be on which side for each specific mission!
|
||||
-- See https://wiki.hoggitworld.com/view/DCS_enum_country for country enumerators.
|
||||
-- @param #SPAWN self
|
||||
-- @param #DCS.country Country Country id as number or enumerator, e.g. country.id.RUSSIA=0, county.id.USA=2 etc.
|
||||
-- @param #DCS.country Country Country id as number or enumerator:
|
||||
--
|
||||
-- * @{DCS#country.id.RUSSIA}
|
||||
-- * @{DCS#county.id.USA}
|
||||
--
|
||||
-- @return #SPAWN self
|
||||
function SPAWN:InitCountry( Country )
|
||||
self:F( )
|
||||
@ -757,14 +765,20 @@ end
|
||||
|
||||
|
||||
|
||||
--TODO: Add example.
|
||||
--- This method provides the functionality to randomize the spawning of the Groups at a given list of zones of different types.
|
||||
-- @param #SPAWN self
|
||||
-- @param #table SpawnZoneTable A table with @{Zone} objects. If this table is given, then each spawn will be executed within the given list of @{Zone}s objects.
|
||||
-- @return #SPAWN
|
||||
-- @usage
|
||||
-- -- NATO Tank Platoons invading Gori.
|
||||
-- -- Choose between 3 different zones for each new SPAWN the Group to be executed, regardless of the zone type.
|
||||
-- -- Create a zone table of the 2 zones.
|
||||
-- ZoneTable = { ZONE:New( "Zone1" ), ZONE:New( "Zone2" ) }
|
||||
--
|
||||
-- Spawn_Vehicle_1 = SPAWN:New( "Spawn Vehicle 1" )
|
||||
-- :InitLimit( 10, 10 )
|
||||
-- :InitRandomizeRoute( 1, 1, 200 )
|
||||
-- :InitRandomizeZones( ZoneTable )
|
||||
-- :SpawnScheduled( 5, .5 )
|
||||
--
|
||||
function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
||||
self:F( { self.SpawnTemplatePrefix, SpawnZoneTable } )
|
||||
|
||||
@ -883,10 +897,10 @@ end
|
||||
--- Makes the groups visible before start (like a batallion).
|
||||
-- The method will take the position of the group as the first position in the array.
|
||||
-- @param #SPAWN self
|
||||
-- @param #number SpawnAngle The angle in degrees how the groups and each unit of the group will be positioned.
|
||||
-- @param #number SpawnWidth The amount of Groups that will be positioned on the X axis.
|
||||
-- @param #number SpawnDeltaX The space between each Group on the X-axis.
|
||||
-- @param #number SpawnDeltaY The space between each Group on the Y-axis.
|
||||
-- @param #number SpawnAngle The angle in degrees how the groups and each unit of the group will be positioned.
|
||||
-- @param #number SpawnWidth The amount of Groups that will be positioned on the X axis.
|
||||
-- @param #number SpawnDeltaX The space between each Group on the X-axis.
|
||||
-- @param #number SpawnDeltaY The space between each Group on the Y-axis.
|
||||
-- @return #SPAWN self
|
||||
-- @usage
|
||||
-- -- Define an array of Groups.
|
||||
@ -1253,16 +1267,17 @@ end
|
||||
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
|
||||
-- @return #SPAWN
|
||||
-- @usage
|
||||
-- -- Declare SpawnObject and call a function when a new Group is spawned.
|
||||
-- local SpawnObject = SPAWN
|
||||
-- :New( "SpawnObject" )
|
||||
-- :InitLimit( 2, 10 )
|
||||
-- :OnSpawnGroup(
|
||||
-- function( SpawnGroup )
|
||||
-- SpawnGroup:E( "I am spawned" )
|
||||
-- end
|
||||
-- )
|
||||
-- :SpawnScheduled( 300, 0.3 )
|
||||
-- -- Declare SpawnObject and call a function when a new Group is spawned.
|
||||
-- local SpawnObject = SPAWN
|
||||
-- :New( "SpawnObject" )
|
||||
-- :InitLimit( 2, 10 )
|
||||
-- :OnSpawnGroup(
|
||||
-- function( SpawnGroup )
|
||||
-- SpawnGroup:E( "I am spawned" )
|
||||
-- end
|
||||
-- )
|
||||
-- :SpawnScheduled( 300, 0.3 )
|
||||
--
|
||||
function SPAWN:OnSpawnGroup( SpawnCallBackFunction, ... )
|
||||
self:F( "OnSpawnGroup" )
|
||||
|
||||
|
||||
@ -670,7 +670,7 @@ function COMMANDCENTER:ReportSummary( ReportGroup )
|
||||
|
||||
for MissionID, Mission in pairs( self.Missions ) do
|
||||
local Mission = Mission -- Tasking.Mission#MISSION
|
||||
Report:Add( " - " .. Mission:ReportSummary() )
|
||||
Report:Add( " - " .. Mission:ReportSummary( ReportGroup ) )
|
||||
end
|
||||
|
||||
self:MessageToGroup( Report:Text(), ReportGroup )
|
||||
|
||||
@ -1200,15 +1200,27 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
||||
|
||||
self:UpdateTaskInfo( self.DetectedItem )
|
||||
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
||||
|
||||
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
--Coordinate:MarkToAll( Briefing )
|
||||
local TargetCoordinates = self.TaskInfo:GetData( "Coordinates" ) -- Core.Point#COORDINATE
|
||||
if TargetCoordinates then
|
||||
for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup, TargetCoordinateID )
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
--Coordinate:MarkToAll( Briefing )
|
||||
end
|
||||
else
|
||||
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
||||
if TargetCoordinate then
|
||||
local Report = REPORT:New():SetIndent( 0 )
|
||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
||||
local MarkText = Report:Text( ", " )
|
||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- Report the task status.
|
||||
|
||||
@ -85,7 +85,7 @@ end
|
||||
-- @return Data The data of the info.
|
||||
function TASKINFO:GetData( Key )
|
||||
local Object = self.Info:Get( Key )
|
||||
return Object.Data
|
||||
return Object and Object.Data
|
||||
end
|
||||
|
||||
|
||||
@ -130,6 +130,19 @@ function TASKINFO:AddCoordinate( Coordinate, Order, Detail, Keep )
|
||||
end
|
||||
|
||||
|
||||
--- Add Coordinates.
|
||||
-- @param #TASKINFO self
|
||||
-- @param #list<Core.Point#COORDINATE> Coordinates
|
||||
-- @param #number Order The display order, which is a number from 0 to 100.
|
||||
-- @param #TASKINFO.Detail Detail The detail Level.
|
||||
-- @param #boolean Keep (optional) If true, this would indicate that the planned taskinfo would be persistent when the task is completed, so that the original planned task info is used at the completed reports.
|
||||
-- @return #TASKINFO self
|
||||
function TASKINFO:AddCoordinates( Coordinates, Order, Detail, Keep )
|
||||
self:AddInfo( "Coordinates", Coordinates, Order, Detail, Keep )
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- Add Threat.
|
||||
-- @param #TASKINFO self
|
||||
@ -259,6 +272,7 @@ function TASKINFO:AddCargoSet( SetCargo, Order, Detail, Keep )
|
||||
)
|
||||
|
||||
self:AddInfo( "Cargo", CargoReport:Text(), Order, Detail, Keep )
|
||||
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
@ -1361,10 +1361,19 @@ do -- TASK_CARGO
|
||||
end
|
||||
|
||||
--- @param #TASK_CARGO self
|
||||
function TASK_CARGO:UpdateTaskInfo( DetectedItem )
|
||||
function TASK_CARGO:UpdateTaskInfo()
|
||||
|
||||
if self:IsStatePlanned() or self:IsStateAssigned() then
|
||||
self.TaskInfo:AddTaskName( 0, "MSOD" )
|
||||
self.TaskInfo:AddCargoSet( self.SetCargo, 10, "SOD", true )
|
||||
local Coordinates = {}
|
||||
for CargoName, Cargo in pairs( self.SetCargo:GetSet() ) do
|
||||
local Cargo = Cargo -- Cargo.Cargo#CARGO
|
||||
if not Cargo:IsLoaded() then
|
||||
Coordinates[#Coordinates+1] = Cargo:GetCoordinate()
|
||||
end
|
||||
end
|
||||
self.TaskInfo:AddCoordinates( Coordinates, 1, "M" )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -332,12 +332,12 @@ function UNIT:GetPlayerName()
|
||||
|
||||
local PlayerName = DCSUnit:getPlayerName()
|
||||
-- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696
|
||||
if PlayerName == nil or PlayerName == "" then
|
||||
local PlayerCategory = DCSUnit:getDesc().category
|
||||
if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
|
||||
PlayerName = "Player" .. DCSUnit:getID()
|
||||
end
|
||||
end
|
||||
-- if PlayerName == nil or PlayerName == "" then
|
||||
-- local PlayerCategory = DCSUnit:getDesc().category
|
||||
-- if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
|
||||
-- PlayerName = "Player" .. DCSUnit:getID()
|
||||
-- end
|
||||
-- end
|
||||
-- -- Good code
|
||||
-- if PlayerName == nil then
|
||||
-- PlayerName = nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user