Code formatting. (#1651)

General code formatting and fixes of minor typos.
This commit is contained in:
TommyC81 2021-12-04 21:49:57 +04:00 committed by GitHub
parent 32deb160ef
commit b0818977cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 549 additions and 631 deletions

View File

@ -38,7 +38,7 @@ do -- TASK_A2A
--
-- @field #TASK_A2A
TASK_A2A = {
ClassName = "TASK_A2A",
ClassName = "TASK_A2A"
}
--- Instantiates a new TASK_A2A.
@ -60,7 +60,6 @@ do -- TASK_A2A
local Fsm = self:GetUnitProcess()
Fsm:AddTransition( "Assigned", "RouteToRendezVous", "RoutingToRendezVous" )
Fsm:AddProcess( "RoutingToRendezVous", "RouteToRendezVousPoint", ACT_ROUTE_POINT:New(), { Arrived = "ArriveAtRendezVous" } )
Fsm:AddProcess( "RoutingToRendezVous", "RouteToRendezVousZone", ACT_ROUTE_ZONE:New(), { Arrived = "ArriveAtRendezVous" } )
@ -81,8 +80,7 @@ do -- TASK_A2A
Fsm:AddTransition( "Rejected", "Reject", "Aborted" )
Fsm:AddTransition( "Failed", "Fail", "Failed" )
---- @param #FSM_PROCESS self
-- @param #FSM_PROCESS self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @param #TASK_CARGO Task
function Fsm:OnLeaveAssigned( TaskUnit, Task )
@ -177,8 +175,6 @@ do -- TASK_A2A
self.TargetSetUnit = TargetSetUnit
end
--- @param #TASK_A2A self
function TASK_A2A:GetPlannedMenuText()
return self:GetStateString() .. " - " .. self:GetTaskName() .. " ( " .. self.TargetSetUnit:GetUnitTypesText() .. " )"
@ -209,8 +205,6 @@ do -- TASK_A2A
return ActRouteRendezVous:GetCoordinate(), ActRouteRendezVous:GetRange()
end
--- @param #TASK_A2A self
-- @param Core.Zone#ZONE_BASE RendezVousZone The Zone object where the RendezVous is located on the map.
-- @param Wrapper.Unit#UNIT TaskUnit
@ -244,7 +238,6 @@ do -- TASK_A2A
ActRouteTarget:SetCoordinate( TargetCoordinate )
end
--- @param #TASK_A2A self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @return Core.Point#COORDINATE The Coordinate object where the Target is located on the map.
@ -256,7 +249,6 @@ do -- TASK_A2A
return ActRouteTarget:GetCoordinate()
end
--- @param #TASK_A2A self
-- @param Core.Zone#ZONE_BASE TargetZone The Zone object where the Target is located on the map.
-- @param Wrapper.Unit#UNIT TaskUnit
@ -268,7 +260,6 @@ do -- TASK_A2A
ActRouteTarget:SetZone( TargetZone, Altitude, Heading )
end
--- @param #TASK_A2A self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @return Core.Zone#ZONE_BASE The Zone object where the Target is located on the map.
@ -301,7 +292,6 @@ do -- TASK_A2A
return Distance
end
--- This method checks every 10 seconds if the goal has been reached of the task.
-- @param #TASK_A2A self
function TASK_A2A:onafterGoal( TaskUnit, From, Event, To )
@ -314,7 +304,6 @@ do -- TASK_A2A
self:__Goal( -10 )
end
--- @param #TASK_A2A self
function TASK_A2A:UpdateTaskInfo( DetectedItem )
@ -375,7 +364,6 @@ do -- TASK_A2A
end
do -- TASK_A2A_INTERCEPT
--- The TASK_A2A_INTERCEPT class
@ -384,7 +372,7 @@ do -- TASK_A2A_INTERCEPT
-- @extends Tasking.Task#TASK
--- Defines an intercept task for a human player to be executed.
-- When enemy planes need to be intercepted by human players, use this task type to urgen the players to get out there!
-- When enemy planes need to be intercepted by human players, use this task type to urge the players to get out there!
--
-- The TASK_A2A_INTERCEPT is used by the @{Tasking.Task_A2A_Dispatcher#TASK_A2A_DISPATCHER} to automatically create intercept tasks
-- based on detected airborne enemy targets intruding friendly airspace.
@ -394,11 +382,9 @@ do -- TASK_A2A_INTERCEPT
--
-- @field #TASK_A2A_INTERCEPT
TASK_A2A_INTERCEPT = {
ClassName = "TASK_A2A_INTERCEPT",
ClassName = "TASK_A2A_INTERCEPT"
}
--- Instantiates a new TASK_A2A_INTERCEPT.
-- @param #TASK_A2A_INTERCEPT self
-- @param Tasking.Mission#MISSION Mission
@ -413,10 +399,7 @@ do -- TASK_A2A_INTERCEPT
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Intercept incoming intruders.\n"
)
self:SetBriefing( TaskBriefing or "Intercept incoming intruders.\n" )
return self
end
@ -469,10 +452,8 @@ do -- TASK_A2A_INTERCEPT
return self
end
end
do -- TASK_A2A_SWEEP
--- The TASK_A2A_SWEEP class
@ -493,11 +474,9 @@ do -- TASK_A2A_SWEEP
--
-- @field #TASK_A2A_SWEEP
TASK_A2A_SWEEP = {
ClassName = "TASK_A2A_SWEEP",
ClassName = "TASK_A2A_SWEEP"
}
--- Instantiates a new TASK_A2A_SWEEP.
-- @param #TASK_A2A_SWEEP self
-- @param Tasking.Mission#MISSION Mission
@ -512,10 +491,7 @@ do -- TASK_A2A_SWEEP
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Perform a fighter sweep. Incoming intruders were detected and could be hiding at the location.\n"
)
self:SetBriefing( TaskBriefing or "Perform a fighter sweep. Incoming intruders were detected and could be hiding at the location.\n" )
return self
end
@ -581,7 +557,6 @@ do -- TASK_A2A_SWEEP
end
do -- TASK_A2A_ENGAGE
--- The TASK_A2A_ENGAGE class
@ -600,11 +575,9 @@ do -- TASK_A2A_ENGAGE
--
-- @field #TASK_A2A_ENGAGE
TASK_A2A_ENGAGE = {
ClassName = "TASK_A2A_ENGAGE",
ClassName = "TASK_A2A_ENGAGE"
}
--- Instantiates a new TASK_A2A_ENGAGE.
-- @param #TASK_A2A_ENGAGE self
-- @param Tasking.Mission#MISSION Mission
@ -619,10 +592,7 @@ do -- TASK_A2A_ENGAGE
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Bogeys are nearby! Players close by are ordered to ENGAGE the intruders!\n"
)
self:SetBriefing( TaskBriefing or "Bogeys are nearby! Players close by are ordered to ENGAGE the intruders!\n" )
return self
end

View File

@ -108,7 +108,7 @@ do -- TASK_A2A_DISPATCHER
-- The above example creates a SET_GROUP instance, and stores this in the variable (object) **EWRSet**.
-- **EWRSet** is then being configured to filter all active groups with a group name starting with **EWR** to be included in the Set.
-- **EWRSet** is then being ordered to start the dynamic filtering. Note that any destroy or new spawn of a group with the above names will be removed or added to the Set.
-- Then a new **EWRDetection** object is created from the class DETECTION_AREAS. A grouping radius of 6000 is choosen, which is 6km.
-- Then a new **EWRDetection** object is created from the class DETECTION_AREAS. A grouping radius of 6000 is chosen, which is 6 km.
-- The **EWRDetection** object is then passed to the @{#TASK_A2A_DISPATCHER.New}() method to indicate the EWR network configuration and setup the A2A tasking and detection mechanism.
--
-- ### 2. Define the detected **target grouping radius**:
@ -182,10 +182,9 @@ do -- TASK_A2A_DISPATCHER
Mission = nil,
Detection = nil,
Tasks = {},
SweepZones = {},
SweepZones = {}
}
--- TASK_A2A_DISPATCHER constructor.
-- @param #TASK_A2A_DISPATCHER self
-- @param Tasking.Mission#MISSION Mission The mission for which the task dispatching is done.
@ -208,7 +207,6 @@ do -- TASK_A2A_DISPATCHER
self:AddTransition( "Started", "Assign", "Started" )
--- OnAfter Transition Handler for Event Assign.
-- @function [parent=#TASK_A2A_DISPATCHER] OnAfterAssign
-- @param #TASK_A2A_DISPATCHER self
@ -224,7 +222,6 @@ do -- TASK_A2A_DISPATCHER
return self
end
--- Define the radius to when an ENGAGE task will be generated for any nearby by airborne friendlies, which are executing cap or returning from an intercept mission.
-- So, if there is a target area detected and reported,
-- then any friendlies that are airborne near this target area,
@ -286,7 +283,6 @@ do -- TASK_A2A_DISPATCHER
return nil
end
--- Creates an SWEEP task when there are targets for it.
-- @param #TASK_A2A_DISPATCHER self
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
@ -298,7 +294,6 @@ do -- TASK_A2A_DISPATCHER
local DetectedSet = DetectedItem.Set
local DetectedZone = DetectedItem.Zone
if DetectedItem.IsDetected == false then
-- Here we're doing something advanced... We're copying the DetectedSet.
@ -312,7 +307,6 @@ do -- TASK_A2A_DISPATCHER
return nil
end
--- Creates an ENGAGE task when there are human friendlies airborne near the targets.
-- @param #TASK_A2A_DISPATCHER self
-- @param Functional.Detection#DETECTION_BASE.DetectedItem DetectedItem
@ -326,7 +320,6 @@ do -- TASK_A2A_DISPATCHER
local PlayersCount, PlayersReport = self:GetPlayerFriendliesNearBy( DetectedItem )
-- Only allow ENGAGE when there are Players near the zone, and when the Area has detected items since the last run in a 60 seconds time zone.
if PlayersCount > 0 and DetectedItem.IsDetected == true then
@ -341,9 +334,6 @@ do -- TASK_A2A_DISPATCHER
return nil
end
--- Evaluates the removal of the Task from the Mission.
-- Can only occur when the DetectedItem is Changed AND the state of the Task is "Planned".
-- @param #TASK_A2A_DISPATCHER self
@ -443,7 +433,6 @@ do -- TASK_A2A_DISPATCHER
FriendlyTypesReport:Add( "-" )
end
return FriendliesCount, FriendlyTypesReport
end
@ -487,7 +476,6 @@ do -- TASK_A2A_DISPATCHER
PlayerTypesReport:Add( "-" )
end
return PlayersCount, PlayerTypesReport
end
@ -496,7 +484,6 @@ do -- TASK_A2A_DISPATCHER
self.Tasks[TaskIndex] = nil
end
--- Assigns tasks in relation to the detected items to the @{Core.Set#SET_GROUP}.
-- @param #TASK_A2A_DISPATCHER self
-- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Functional.Detection#DETECTION_BASE} derived object.

View File

@ -38,7 +38,7 @@ do -- TASK_A2G
--
-- @field #TASK_A2G
TASK_A2G = {
ClassName = "TASK_A2G",
ClassName = "TASK_A2G"
}
--- Instantiates a new TASK_A2G.
@ -80,8 +80,6 @@ do -- TASK_A2G
Fsm:AddTransition( "Rejected", "Reject", "Aborted" )
Fsm:AddTransition( "Failed", "Fail", "Failed" )
--- Test
-- @param #FSM_PROCESS self
-- @param Wrapper.Unit#UNIT TaskUnit
@ -179,8 +177,6 @@ do -- TASK_A2G
self.TargetSetUnit = TargetSetUnit
end
--- @param #TASK_A2G self
function TASK_A2G:GetPlannedMenuText()
return self:GetStateString() .. " - " .. self:GetTaskName() .. " ( " .. self.TargetSetUnit:GetUnitTypesText() .. " )"
@ -211,8 +207,6 @@ do -- TASK_A2G
return ActRouteRendezVous:GetCoordinate(), ActRouteRendezVous:GetRange()
end
--- @param #TASK_A2G self
-- @param Core.Zone#ZONE_BASE RendezVousZone The Zone object where the RendezVous is located on the map.
-- @param Wrapper.Unit#UNIT TaskUnit
@ -246,7 +240,6 @@ do -- TASK_A2G
ActRouteTarget:SetCoordinate( TargetCoordinate )
end
--- @param #TASK_A2G self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @return Core.Point#COORDINATE The Coordinate object where the Target is located on the map.
@ -258,7 +251,6 @@ do -- TASK_A2G
return ActRouteTarget:GetCoordinate()
end
--- @param #TASK_A2G self
-- @param Core.Zone#ZONE_BASE TargetZone The Zone object where the Target is located on the map.
-- @param Wrapper.Unit#UNIT TaskUnit
@ -270,7 +262,6 @@ do -- TASK_A2G
ActRouteTarget:SetZone( TargetZone )
end
--- @param #TASK_A2G self
-- @param Wrapper.Unit#UNIT TaskUnit
-- @return Core.Zone#ZONE_BASE The Zone object where the Target is located on the map.
@ -303,7 +294,6 @@ do -- TASK_A2G
return Distance
end
--- This method checks every 10 seconds if the goal has been reached of the task.
-- @param #TASK_A2G self
function TASK_A2G:onafterGoal( TaskUnit, From, Event, To )
@ -381,7 +371,6 @@ do -- TASK_A2G
end
do -- TASK_A2G_SEAD
--- The TASK_A2G_SEAD class
@ -397,7 +386,7 @@ do -- TASK_A2G_SEAD
--
-- @field #TASK_A2G_SEAD
TASK_A2G_SEAD = {
ClassName = "TASK_A2G_SEAD",
ClassName = "TASK_A2G_SEAD"
}
--- Instantiates a new TASK_A2G_SEAD.
@ -414,10 +403,7 @@ do -- TASK_A2G_SEAD
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Execute a Suppression of Enemy Air Defenses."
)
self:SetBriefing( TaskBriefing or "Execute a Suppression of Enemy Air Defenses." )
return self
end
@ -470,7 +456,6 @@ do -- TASK_A2G_SEAD
return self
end
end
do -- TASK_A2G_BAI
@ -488,9 +473,7 @@ do -- TASK_A2G_BAI
-- based on detected enemy ground targets.
--
-- @field #TASK_A2G_BAI
TASK_A2G_BAI = {
ClassName = "TASK_A2G_BAI",
}
TASK_A2G_BAI = { ClassName = "TASK_A2G_BAI" }
--- Instantiates a new TASK_A2G_BAI.
-- @param #TASK_A2G_BAI self
@ -506,10 +489,7 @@ do -- TASK_A2G_BAI
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Execute a Battlefield Air Interdiction of a group of enemy targets."
)
self:SetBriefing( TaskBriefing or "Execute a Battlefield Air Interdiction of a group of enemy targets." )
return self
end
@ -564,9 +544,6 @@ do -- TASK_A2G_BAI
end
do -- TASK_A2G_CAS
--- The TASK_A2G_CAS class
@ -581,9 +558,7 @@ do -- TASK_A2G_CAS
-- based on detected enemy ground targets.
--
-- @field #TASK_A2G_CAS
TASK_A2G_CAS = {
ClassName = "TASK_A2G_CAS",
}
TASK_A2G_CAS = { ClassName = "TASK_A2G_CAS" }
--- Instantiates a new TASK_A2G_CAS.
-- @param #TASK_A2G_CAS self
@ -599,17 +574,11 @@ do -- TASK_A2G_CAS
Mission:AddTask( self )
self:SetBriefing(
TaskBriefing or
"Execute a Close Air Support for a group of enemy targets. " ..
"Beware of friendlies at the vicinity! "
)
self:SetBriefing( TaskBriefing or ( "Execute a Close Air Support for a group of enemy targets. " .. "Beware of friendlies at the vicinity! " ) )
return self
end
--- Set a score when a target in scope of the A2G attack, has been destroyed .
-- @param #TASK_A2G_CAS self
-- @param #string PlayerName The name of the player.
@ -658,5 +627,4 @@ do -- TASK_A2G_CAS
return self
end
end

View File

@ -6,11 +6,12 @@
-- * Dynamically change the tasks as the tactical situation evolves during the mission.
-- * Dynamically assign (CAS) Close Air Support tasks for human players.
-- * Dynamically assign (BAI) Battlefield Air Interdiction tasks for human players.
-- * Dynamically assign (SEAD) Supression of Enemy Air Defense tasks for human players to eliminate G2A missile threats.
-- * Dynamically assign (SEAD) Suppression of Enemy Air Defense tasks for human players to eliminate G2A missile threats.
-- * Define and use an EWR (Early Warning Radar) network.
-- * Define different ranges to engage upon intruders.
-- * Keep task achievements.
-- * Score task achievements.--
-- * Score task achievements.
--
-- ===
--
-- ### Author: **FlightControl**
@ -122,7 +123,7 @@ do -- TASK_A2G_DISPATCHER
-- F1. Command Center [Lima]
-- F1. Mission "Overlord (High)"
--
-- Command Center [Gori] is controlling Mission "Alpha", "Beta", "Gamma". Alpha is the Primary mission, Beta the Secondary and there is a Tacical mission Gamma.
-- Command Center [Gori] is controlling Mission "Alpha", "Beta", "Gamma". Alpha is the Primary mission, Beta the Secondary and there is a Tactical mission Gamma.
-- Command Center [Lima] is controlling Missions "Overlord", which needs to be executed with High priority.
--
-- ## 1.1. Mission Menu (Under the Command Center Menu)
@ -196,7 +197,7 @@ do -- TASK_A2G_DISPATCHER
--
-- The Mission Reports Menu is a sub menu, that provides options to retrieve further information on the current Mission:
--
-- - **Report Mission Progress**: Shows the progress of the current Mission. Each Task has a %-tage of completion.
-- - **Report Mission Progress**: Shows the progress of the current Mission. Each Task has a % of completion.
-- - **Report Players per Task**: Show which players are engaged on which Task within the Mission.
--
-- For CC |Gori|, Mission "Alpha", the Mission Reports menu structure could look like this:
@ -264,7 +265,6 @@ do -- TASK_A2G_DISPATCHER
--
-- **The F5. Assigned Task __TaskName__ allows the player to control the current Assigned Task and take further actions.**
--
--
-- ## 1.3. Join Planned Task Menu
--
-- The Join Planned Task Menu contains the different Planned A2G Tasks **in a structured Menu Hierarchy**.
@ -388,7 +388,7 @@ do -- TASK_A2G_DISPATCHER
-- - A @{Mission} object. Each task belongs to a Mission.
-- - A @{Detection} object. There are several detection grouping methods to choose from.
-- - A @{Task_A2G_Dispatcher} object. The master A2G task dispatcher.
-- - A @{Set} of @{Wrapper.Group} objects that will detect the emeny, the RecceSet. This is attached to the @{Detection} object.
-- - A @{Set} of @{Wrapper.Group} objects that will detect the enemy, the RecceSet. This is attached to the @{Detection} object.
-- - A @{Set} ob @{Wrapper.Group} objects that will attack the enemy, the AttackSet. This is attached to the @{Task_A2G_Dispatcher} object.
--
-- Below an example mission declaration that is defines a Task A2G Dispatcher object.
@ -425,7 +425,7 @@ do -- TASK_A2G_DISPATCHER
--
-- -- Now we have everything to setup the main A2G TaskDispatcher.
-- TaskDispatcher = TASK_A2G_DISPATCHER
-- :New( Mission, AttackSet, DetectionAreas ) -- We assign the TaskDispatcher under Mission. The AttackSet will engage the enemy and will recieve the dispatched Tasks. The DetectionAreas will report any detected enemies to the TaskDispatcher.
-- :New( Mission, AttackSet, DetectionAreas ) -- We assign the TaskDispatcher under Mission. The AttackSet will engage the enemy and will receive the dispatched Tasks. The DetectionAreas will report any detected enemies to the TaskDispatcher.
--
--
--
@ -434,10 +434,9 @@ do -- TASK_A2G_DISPATCHER
ClassName = "TASK_A2G_DISPATCHER",
Mission = nil,
Detection = nil,
Tasks = {},
Tasks = {}
}
--- TASK_A2G_DISPATCHER constructor.
-- @param #TASK_A2G_DISPATCHER self
-- @param Tasking.Mission#MISSION Mission The mission for which the task dispatching is done.
@ -518,7 +517,6 @@ do -- TASK_A2G_DISPATCHER
local DetectedSet = DetectedItem.Set
local DetectedZone = DetectedItem.Zone
-- Determine if the set has ground units.
-- There should be ground unit friendlies nearby. Airborne units are valid friendlies types.
-- And there shouldn't be any radar.
@ -550,7 +548,6 @@ do -- TASK_A2G_DISPATCHER
local DetectedSet = DetectedItem.Set
local DetectedZone = DetectedItem.Zone
-- Determine if the set has ground units.
-- There shouldn't be any ground unit friendlies nearby.
-- And there shouldn't be any radar.
@ -571,7 +568,6 @@ do -- TASK_A2G_DISPATCHER
return nil
end
function TASK_A2G_DISPATCHER:RemoveTask( TaskIndex )
self.Mission:RemoveTask( self.Tasks[TaskIndex] )
self.Tasks[TaskIndex] = nil
@ -597,7 +593,6 @@ do -- TASK_A2G_DISPATCHER
return Task
end
--- Assigns tasks in relation to the detected items to the @{Core.Set#SET_GROUP}.
-- @param #TASK_A2G_DISPATCHER self
-- @param Functional.Detection#DETECTION_BASE Detection The detection created by the @{Functional.Detection#DETECTION_BASE} derived object.
@ -800,14 +795,12 @@ do -- TASK_A2G_DISPATCHER
self:Aborted( Task )
end
TaskReport:Add( Task:GetName() )
else
self:F( "This should not happen" )
end
end
-- OK, so the tasking has been done, now delete the changes reported for the area.
Detection:AcceptChanges( DetectedItem )
end