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:
@@ -107,8 +107,9 @@ do -- Goal
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- @param #GOAL self
|
--- Add a new contribution by a player.
|
||||||
-- @param #string PlayerName
|
-- @param #GOAL self
|
||||||
|
-- @param #string PlayerName The name of the player.
|
||||||
function GOAL:AddPlayerContribution( PlayerName )
|
function GOAL:AddPlayerContribution( PlayerName )
|
||||||
self.Players[PlayerName] = self.Players[PlayerName] or 0
|
self.Players[PlayerName] = self.Players[PlayerName] or 0
|
||||||
self.Players[PlayerName] = self.Players[PlayerName] + 1
|
self.Players[PlayerName] = self.Players[PlayerName] + 1
|
||||||
@@ -123,21 +124,28 @@ do -- Goal
|
|||||||
end
|
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()
|
function GOAL:GetPlayerContributions()
|
||||||
return self.Players or {}
|
return self.Players or {}
|
||||||
end
|
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()
|
function GOAL:GetTotalContributions()
|
||||||
return self.TotalContributions or 0
|
return self.TotalContributions or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- @param #GOAL self
|
--- Validates if the goal is achieved.
|
||||||
-- @return #boolean true if the goal is Achieved
|
-- @param #GOAL self
|
||||||
|
-- @return #boolean true if the goal is achieved.
|
||||||
function GOAL:IsAchieved()
|
function GOAL:IsAchieved()
|
||||||
return self:Is( "Achieved" )
|
return self:Is( "Achieved" )
|
||||||
end
|
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!
|
--- Sets the coalition of the spawned group. Note that it might be necessary to also set the country explicitly!
|
||||||
-- @param #SPAWN self
|
-- @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
|
-- @return #SPAWN self
|
||||||
function SPAWN:InitCoalition( Coalition )
|
function SPAWN:InitCoalition( Coalition )
|
||||||
self:F({coalition=Coalition})
|
self:F({coalition=Coalition})
|
||||||
@@ -507,9 +512,12 @@ function SPAWN:InitCoalition( Coalition )
|
|||||||
end
|
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!
|
--- 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 #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
|
-- @return #SPAWN self
|
||||||
function SPAWN:InitCountry( Country )
|
function SPAWN:InitCountry( Country )
|
||||||
self:F( )
|
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.
|
--- 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 #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.
|
-- @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
|
-- @return #SPAWN
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- NATO Tank Platoons invading Gori.
|
-- -- Create a zone table of the 2 zones.
|
||||||
-- -- Choose between 3 different zones for each new SPAWN the Group to be executed, regardless of the zone type.
|
-- 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 )
|
function SPAWN:InitRandomizeZones( SpawnZoneTable )
|
||||||
self:F( { self.SpawnTemplatePrefix, SpawnZoneTable } )
|
self:F( { self.SpawnTemplatePrefix, SpawnZoneTable } )
|
||||||
|
|
||||||
@@ -883,10 +897,10 @@ end
|
|||||||
--- Makes the groups visible before start (like a batallion).
|
--- 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.
|
-- The method will take the position of the group as the first position in the array.
|
||||||
-- @param #SPAWN self
|
-- @param #SPAWN self
|
||||||
-- @param #number SpawnAngle The angle in degrees how the groups and each unit of the group will be positioned.
|
-- @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 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 SpawnDeltaX The space between each Group on the X-axis.
|
||||||
-- @param #number SpawnDeltaY The space between each Group on the Y-axis.
|
-- @param #number SpawnDeltaY The space between each Group on the Y-axis.
|
||||||
-- @return #SPAWN self
|
-- @return #SPAWN self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Define an array of Groups.
|
-- -- 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.
|
-- @param SpawnFunctionArguments A random amount of arguments to be provided to the function when the group spawns.
|
||||||
-- @return #SPAWN
|
-- @return #SPAWN
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Declare SpawnObject and call a function when a new Group is spawned.
|
-- -- Declare SpawnObject and call a function when a new Group is spawned.
|
||||||
-- local SpawnObject = SPAWN
|
-- local SpawnObject = SPAWN
|
||||||
-- :New( "SpawnObject" )
|
-- :New( "SpawnObject" )
|
||||||
-- :InitLimit( 2, 10 )
|
-- :InitLimit( 2, 10 )
|
||||||
-- :OnSpawnGroup(
|
-- :OnSpawnGroup(
|
||||||
-- function( SpawnGroup )
|
-- function( SpawnGroup )
|
||||||
-- SpawnGroup:E( "I am spawned" )
|
-- SpawnGroup:E( "I am spawned" )
|
||||||
-- end
|
-- end
|
||||||
-- )
|
-- )
|
||||||
-- :SpawnScheduled( 300, 0.3 )
|
-- :SpawnScheduled( 300, 0.3 )
|
||||||
|
--
|
||||||
function SPAWN:OnSpawnGroup( SpawnCallBackFunction, ... )
|
function SPAWN:OnSpawnGroup( SpawnCallBackFunction, ... )
|
||||||
self:F( "OnSpawnGroup" )
|
self:F( "OnSpawnGroup" )
|
||||||
|
|
||||||
|
|||||||
@@ -670,7 +670,7 @@ function COMMANDCENTER:ReportSummary( ReportGroup )
|
|||||||
|
|
||||||
for MissionID, Mission in pairs( self.Missions ) do
|
for MissionID, Mission in pairs( self.Missions ) do
|
||||||
local Mission = Mission -- Tasking.Mission#MISSION
|
local Mission = Mission -- Tasking.Mission#MISSION
|
||||||
Report:Add( " - " .. Mission:ReportSummary() )
|
Report:Add( " - " .. Mission:ReportSummary( ReportGroup ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
self:MessageToGroup( Report:Text(), ReportGroup )
|
self:MessageToGroup( Report:Text(), ReportGroup )
|
||||||
|
|||||||
@@ -1200,15 +1200,27 @@ function TASK:MenuMarkToGroup( TaskGroup )
|
|||||||
|
|
||||||
self:UpdateTaskInfo( self.DetectedItem )
|
self:UpdateTaskInfo( self.DetectedItem )
|
||||||
|
|
||||||
local Report = REPORT:New():SetIndent( 0 )
|
local TargetCoordinates = self.TaskInfo:GetData( "Coordinates" ) -- Core.Point#COORDINATE
|
||||||
|
if TargetCoordinates then
|
||||||
self.TaskInfo:Report( Report, "M", TaskGroup )
|
for TargetCoordinateID, TargetCoordinate in pairs( TargetCoordinates ) do
|
||||||
|
local Report = REPORT:New():SetIndent( 0 )
|
||||||
local TargetCoordinate = self.TaskInfo:GetData( "Coordinate" ) -- Core.Point#COORDINATE
|
self.TaskInfo:Report( Report, "M", TaskGroup, TargetCoordinateID )
|
||||||
local MarkText = Report:Text( ", " )
|
local MarkText = Report:Text( ", " )
|
||||||
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
self:F( { Coordinate = TargetCoordinate, MarkText = MarkText } )
|
||||||
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
TargetCoordinate:MarkToGroup( MarkText, TaskGroup )
|
||||||
--Coordinate:MarkToAll( Briefing )
|
--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
|
end
|
||||||
|
|
||||||
--- Report the task status.
|
--- Report the task status.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ end
|
|||||||
-- @return Data The data of the info.
|
-- @return Data The data of the info.
|
||||||
function TASKINFO:GetData( Key )
|
function TASKINFO:GetData( Key )
|
||||||
local Object = self.Info:Get( Key )
|
local Object = self.Info:Get( Key )
|
||||||
return Object.Data
|
return Object and Object.Data
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -130,6 +130,19 @@ function TASKINFO:AddCoordinate( Coordinate, Order, Detail, Keep )
|
|||||||
end
|
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.
|
--- Add Threat.
|
||||||
-- @param #TASKINFO self
|
-- @param #TASKINFO self
|
||||||
@@ -259,6 +272,7 @@ function TASKINFO:AddCargoSet( SetCargo, Order, Detail, Keep )
|
|||||||
)
|
)
|
||||||
|
|
||||||
self:AddInfo( "Cargo", CargoReport:Text(), Order, Detail, Keep )
|
self:AddInfo( "Cargo", CargoReport:Text(), Order, Detail, Keep )
|
||||||
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1361,10 +1361,19 @@ do -- TASK_CARGO
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- @param #TASK_CARGO self
|
--- @param #TASK_CARGO self
|
||||||
function TASK_CARGO:UpdateTaskInfo( DetectedItem )
|
function TASK_CARGO:UpdateTaskInfo()
|
||||||
|
|
||||||
if self:IsStatePlanned() or self:IsStateAssigned() then
|
if self:IsStatePlanned() or self:IsStateAssigned() then
|
||||||
|
self.TaskInfo:AddTaskName( 0, "MSOD" )
|
||||||
self.TaskInfo:AddCargoSet( self.SetCargo, 10, "SOD", true )
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -332,12 +332,12 @@ function UNIT:GetPlayerName()
|
|||||||
|
|
||||||
local PlayerName = DCSUnit:getPlayerName()
|
local PlayerName = DCSUnit:getPlayerName()
|
||||||
-- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696
|
-- TODO Workaround DCS-BUG-3 - https://github.com/FlightControl-Master/MOOSE/issues/696
|
||||||
if PlayerName == nil or PlayerName == "" then
|
-- if PlayerName == nil or PlayerName == "" then
|
||||||
local PlayerCategory = DCSUnit:getDesc().category
|
-- local PlayerCategory = DCSUnit:getDesc().category
|
||||||
if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
|
-- if PlayerCategory == Unit.Category.GROUND_UNIT or PlayerCategory == Unit.Category.SHIP then
|
||||||
PlayerName = "Player" .. DCSUnit:getID()
|
-- PlayerName = "Player" .. DCSUnit:getID()
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
-- -- Good code
|
-- -- Good code
|
||||||
-- if PlayerName == nil then
|
-- if PlayerName == nil then
|
||||||
-- PlayerName = nil
|
-- PlayerName = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user