From 446ecc5b4da543d7c1af6e8775d1d38ef04aa2a5 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Sat, 5 Aug 2017 13:33:02 +0200
Subject: [PATCH 1/3] Set the new spawn altitude
---
.../Moose/AI/AI_A2A_Dispatcher.lua | 62 ++++++++++++++++++-
Moose Development/Moose/Functional/Spawn.lua | 5 +-
2 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
index 7519ff960..30f49a2f4 100644
--- a/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
+++ b/Moose Development/Moose/AI/AI_A2A_Dispatcher.lua
@@ -418,6 +418,15 @@ do -- AI_A2A_DISPATCHER
-- A2ADispatcher:SetSquadronTakeoffFromParkingHot( "Novo" )
--
--
+ -- #### 6.1.1. Takeoff Altitude when spawning new aircraft in the air.
+ --
+ -- In the case of the @{#AI_A2A_DISPATCHER.SetSquadronTakeoffInAir}() there is also an other parameter that can be applied.
+ -- That is modifying or setting the **altitude** from where planes spawn in the air.
+ -- Use the method @{#AI_A2A_DISPATCHER.SetSquadronTakeoffInAirAltitude}() to set the altitude for a specific squadron.
+ -- The default takeoff altitude can be modified or set using the method @{#AI_A2A_DISPATCHER.SetSquadronTakeoffInAirAltitude}().
+ -- As part of the method @{#AI_A2A_DISPATCHER.SetSquadronTakeoffInAir}() a parameter can be specified to set the takeoff altitude.
+ -- If this parameter is not specified, then the default altitude will be used for the squadron.
+ --
-- ### 6.2. Set squadron landing methods
--
-- In analogy with takeoff, the landing methods are to control how squadrons land at the airfield:
@@ -839,6 +848,7 @@ do -- AI_A2A_DISPATCHER
self:SetDisengageRadius( 300000 ) -- The default disengage radius is 300 km.
self:SetDefaultTakeoff( AI_A2A_DISPATCHER.Takeoff.Air )
+ self:SetDefaultTakeoffInAirAltitude( 500 ) -- Default takeoff is 500 meters above the ground.
self:SetDefaultLanding( AI_A2A_DISPATCHER.Landing.NearAirbase )
self:SetDefaultOverhead( 1 )
self:SetDefaultGrouping( 1 )
@@ -1874,6 +1884,7 @@ do -- AI_A2A_DISPATCHER
--- Sets flights to take-off in the air, as part of the defense system.
-- @param #AI_A2A_DISPATCHER self
-- @param #string SquadronName The name of the squadron.
+ -- @param #number TakeoffAltitude (optional) The altitude in meters above the ground. If not given, the default takeoff altitude will be used.
-- @usage:
--
-- local Dispatcher = AI_A2A_DISPATCHER:New( ... )
@@ -1883,10 +1894,14 @@ do -- AI_A2A_DISPATCHER
--
-- @return #AI_A2A_DISPATCHER
--
- function AI_A2A_DISPATCHER:SetSquadronTakeoffInAir( SquadronName )
+ function AI_A2A_DISPATCHER:SetSquadronTakeoffInAir( SquadronName, TakeoffAltitude )
self:SetSquadronTakeoff( SquadronName, AI_A2A_DISPATCHER.Takeoff.Air )
+ if TakeoffAltitude then
+ self:SetSquadronTakeoffInAirAltitude( SquadronName, TakeoffAltitude )
+ end
+
return self
end
@@ -2007,6 +2022,47 @@ do -- AI_A2A_DISPATCHER
end
+ --- Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
+ -- @param #AI_A2A_DISPATCHER self
+ -- @param #number TakeoffAltitude The altitude in meters above the ground.
+ -- @usage:
+ --
+ -- local A2ADispatcher = AI_A2A_DISPATCHER:New( ... )
+ --
+ -- -- Set the default takeoff altitude when taking off in the air.
+ -- A2ADispatcher:SetDefaultTakeoffInAirAltitude( 2000 ) -- This makes planes start at 2000 meters above the ground.
+ --
+ -- @return #AI_A2A_DISPATCHER
+ --
+ function AI_A2A_DISPATCHER:SetDefaultTakeoffInAirAltitude( TakeoffAltitude )
+
+ self.DefenderDefault.TakeoffAltitude = TakeoffAltitude
+
+ return self
+ end
+
+ --- Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
+ -- @param #AI_A2A_DISPATCHER self
+ -- @param #string SquadronName The name of the squadron.
+ -- @param #number TakeoffAltitude The altitude in meters above the ground.
+ -- @usage:
+ --
+ -- local A2ADispatcher = AI_A2A_DISPATCHER:New( ... )
+ --
+ -- -- Set the default takeoff altitude when taking off in the air.
+ -- A2ADispatcher:SetSquadronTakeoffInAirAltitude( "SquadronName", 2000 ) -- This makes planes start at 2000 meters above the ground.
+ --
+ -- @return #AI_A2A_DISPATCHER
+ --
+ function AI_A2A_DISPATCHER:SetSquadronTakeoffInAirAltitude( SquadronName, TakeoffAltitude )
+
+ local DefenderSquadron = self:GetSquadron( SquadronName )
+ DefenderSquadron.TakeoffAltitude = TakeoffAltitude
+
+ return self
+ end
+
+
--- Defines the default method at which flights will land and despawn as part of the defense system.
-- @param #AI_A2A_DISPATCHER self
-- @param #number Landing The landing method which can be NearAirbase, AtRunway, AtEngineShutdown
@@ -2461,7 +2517,7 @@ do -- AI_A2A_DISPATCHER
Spawn:InitGrouping( DefenderGrouping )
local TakeoffMethod = self:GetSquadronTakeoff( SquadronName )
- local DefenderCAP = Spawn:SpawnAtAirbase( DefenderSquadron.Airbase, TakeoffMethod )
+ local DefenderCAP = Spawn:SpawnAtAirbase( DefenderSquadron.Airbase, TakeoffMethod, DefenderSquadron.TakeoffAltitude or self.DefenderDefault.TakeoffAltitude )
self:AddDefenderToSquadron( DefenderSquadron, DefenderCAP, DefenderGrouping )
if DefenderCAP then
@@ -2608,7 +2664,7 @@ do -- AI_A2A_DISPATCHER
end
local TakeoffMethod = self:GetSquadronTakeoff( ClosestDefenderSquadronName )
- local DefenderGCI = Spawn:SpawnAtAirbase( DefenderSquadron.Airbase, TakeoffMethod ) -- Wrapper.Group#GROUP
+ local DefenderGCI = Spawn:SpawnAtAirbase( DefenderSquadron.Airbase, TakeoffMethod, DefenderSquadron.TakeoffAltitude or self.DefenderDefault.TakeoffAltitude ) -- Wrapper.Group#GROUP
self:F( { GCIDefender = DefenderGCI:GetName() } )
DefendersNeeded = DefendersNeeded - DefenderGrouping
diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua
index 48af8bf46..f1db734fa 100644
--- a/Moose Development/Moose/Functional/Spawn.lua
+++ b/Moose Development/Moose/Functional/Spawn.lua
@@ -989,9 +989,10 @@ end
-- @param #SPAWN self
-- @param Wrapper.Airbase#AIRBASE Airbase The @{Airbase} where to spawn the group.
-- @param #SPAWN.Takeoff Takeoff (optional) The location and takeoff method. Default is Hot.
+-- @param #number TakeoffAltitude (optional) The altitude above the ground.
-- @return Wrapper.Group#GROUP that was spawned.
-- @return #nil Nothing was spawned.
-function SPAWN:SpawnAtAirbase( Airbase, Takeoff ) -- R2.2
+function SPAWN:SpawnAtAirbase( Airbase, Takeoff, TakeoffAltitude ) -- R2.2
self:F( { self.SpawnTemplatePrefix, Airbase } )
local PointVec3 = Airbase:GetPointVec3()
@@ -1025,7 +1026,7 @@ function SPAWN:SpawnAtAirbase( Airbase, Takeoff ) -- R2.2
SpawnTemplate.route.points[1].x = PointVec3.x
SpawnTemplate.route.points[1].y = PointVec3.z
- SpawnTemplate.route.points[1].alt = PointVec3.y + 200
+ SpawnTemplate.route.points[1].alt = PointVec3.y + TakeoffAltitude
SpawnTemplate.route.points[1].type = GROUPTEMPLATE.Takeoff[Takeoff]
SpawnTemplate.route.points[1].airdromeId = Airbase:GetID()
From b88c84fc3b8571b5f582b25525993081f1b4c01d Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Sat, 5 Aug 2017 13:52:59 +0200
Subject: [PATCH 2/3] Fixed 643
---
Moose Development/Moose/Functional/Spawn.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Moose Development/Moose/Functional/Spawn.lua b/Moose Development/Moose/Functional/Spawn.lua
index f1db734fa..413ce672c 100644
--- a/Moose Development/Moose/Functional/Spawn.lua
+++ b/Moose Development/Moose/Functional/Spawn.lua
@@ -1020,13 +1020,13 @@ function SPAWN:SpawnAtAirbase( Airbase, Takeoff, TakeoffAltitude ) -- R2.2
local TY = PointVec3.z + ( SY - BY )
SpawnTemplate.units[UnitID].x = TX
SpawnTemplate.units[UnitID].y = TY
- SpawnTemplate.units[UnitID].alt = PointVec3.y
+ SpawnTemplate.units[UnitID].alt = PointVec3.y + ( TakeoffAltitude or 200 )
self:T( 'After Translation SpawnTemplate.units['..UnitID..'].x = ' .. SpawnTemplate.units[UnitID].x .. ', SpawnTemplate.units['..UnitID..'].y = ' .. SpawnTemplate.units[UnitID].y )
end
SpawnTemplate.route.points[1].x = PointVec3.x
SpawnTemplate.route.points[1].y = PointVec3.z
- SpawnTemplate.route.points[1].alt = PointVec3.y + TakeoffAltitude
+ SpawnTemplate.route.points[1].alt = PointVec3.y + ( TakeoffAltitude or 200 )
SpawnTemplate.route.points[1].type = GROUPTEMPLATE.Takeoff[Takeoff]
SpawnTemplate.route.points[1].airdromeId = Airbase:GetID()
From 53845448b08fcebd55a1076b5e094e46a741ab24 Mon Sep 17 00:00:00 2001
From: FlightControl_Master
Date: Sat, 5 Aug 2017 15:14:11 +0200
Subject: [PATCH 3/3] Documentation
---
docs/Documentation/AI_A2A.html | 1 -
docs/Documentation/AI_A2A_Dispatcher.html | 111 +++++++++++++++++++++-
docs/Documentation/Cargo.html | 1 -
docs/Documentation/Detection.html | 2 +
docs/Documentation/Fsm.html | 3 +-
docs/Documentation/Positionable.html | 1 -
docs/Documentation/Settings.html | 2 +-
docs/Documentation/Spawn.html | 44 ++++-----
docs/Documentation/Spot.html | 4 +
docs/Documentation/Task_Cargo.html | 1 -
10 files changed, 134 insertions(+), 36 deletions(-)
diff --git a/docs/Documentation/AI_A2A.html b/docs/Documentation/AI_A2A.html
index a806e13d7..fff574c9b 100644
--- a/docs/Documentation/AI_A2A.html
+++ b/docs/Documentation/AI_A2A.html
@@ -661,7 +661,6 @@
-
- #number
AI_A2A.IdleCount
diff --git a/docs/Documentation/AI_A2A_Dispatcher.html b/docs/Documentation/AI_A2A_Dispatcher.html
index 2fde0002b..1a86e8d84 100644
--- a/docs/Documentation/AI_A2A_Dispatcher.html
+++ b/docs/Documentation/AI_A2A_Dispatcher.html
@@ -698,6 +698,12 @@ Per one, two, three, four?
AI_A2A_DISPATCHER:SetDefaultTakeoffInAir() |
Sets flights to default take-off in the air, as part of the defense system.
+ |
+
+
+ | AI_A2A_DISPATCHER:SetDefaultTakeoffInAirAltitude(TakeoffAltitude) |
+
+ Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
|
@@ -833,9 +839,15 @@ Per one, two, three, four?
- | AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName) |
+ AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName, TakeoffAltitude) |
Sets flights to take-off in the air, as part of the defense system.
+ |
+
+
+ | AI_A2A_DISPATCHER:SetSquadronTakeoffInAirAltitude(SquadronName, TakeoffAltitude) |
+
+ Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
|
@@ -1217,6 +1229,15 @@ And for a couple of squadrons overrides this default method.
+6.1.1. Takeoff Altitude when spawning new aircraft in the air.
+
+In the case of the AIA2ADISPATCHER.SetSquadronTakeoffInAir() there is also an other parameter that can be applied.
+That is modifying or setting the altitude from where planes spawn in the air.
+Use the method AIA2ADISPATCHER.SetSquadronTakeoffInAirAltitude() to set the altitude for a specific squadron.
+The default takeoff altitude can be modified or set using the method AIA2ADISPATCHER.SetSquadronTakeoffInAirAltitude().
+As part of the method AIA2ADISPATCHER.SetSquadronTakeoffInAir() a parameter can be specified to set the takeoff altitude.
+If this parameter is not specified, then the default altitude will be used for the squadron.
+
6.2. Set squadron landing methods
In analogy with takeoff, the landing methods are to control how squadrons land at the airfield:
@@ -3773,6 +3794,42 @@ From the airbase hot, from the airbase cold, in the air, from the runway.
-
+
+AI_A2A_DISPATCHER:SetDefaultTakeoffInAirAltitude(TakeoffAltitude)
+
+
+-
+
+
Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
+
+ Parameter
+
+ Return value
+
+#AIA2ADISPATCHER:
+
+
+ Usage:
+
+
+ local A2ADispatcher = AI_A2A_DISPATCHER:New( ... )
+
+ -- Set the default takeoff altitude when taking off in the air.
+ A2ADispatcher:SetDefaultTakeoffInAirAltitude( 2000 ) -- This makes planes start at 2000 meters above the ground.
+
+
+
+
+
+-
+
AI_A2A_DISPATCHER:SetDefaultTanker(TankerName)
@@ -4808,20 +4865,26 @@ The name of the squadron.
-
-AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName)
+AI_A2A_DISPATCHER:SetSquadronTakeoffInAir(SquadronName, TakeoffAltitude)
-
Sets flights to take-off in the air, as part of the defense system.
- Parameter
+ Parameters
-
#string SquadronName :
The name of the squadron.
+
+ -
+
+
#number TakeoffAltitude :
+(optional) The altitude in meters above the ground. If not given, the default takeoff altitude will be used.
+
Return value
@@ -4843,6 +4906,48 @@ The name of the squadron.
-
+
+AI_A2A_DISPATCHER:SetSquadronTakeoffInAirAltitude(SquadronName, TakeoffAltitude)
+
+
+-
+
+
Defines the default altitude where airplanes will spawn in the air and take-off as part of the defense system, when the take-off in the air method has been selected.
+
+ Parameters
+
+ Return value
+
+#AIA2ADISPATCHER:
+
+
+ Usage:
+
+
+ local A2ADispatcher = AI_A2A_DISPATCHER:New( ... )
+
+ -- Set the default takeoff altitude when taking off in the air.
+ A2ADispatcher:SetSquadronTakeoffInAirAltitude( "SquadronName", 2000 ) -- This makes planes start at 2000 meters above the ground.
+
+
+
+
+
+-
+
AI_A2A_DISPATCHER:SetSquadronTanker(SquadronName, TankerName)
diff --git a/docs/Documentation/Cargo.html b/docs/Documentation/Cargo.html
index 21b706849..fe4a4263b 100644
--- a/docs/Documentation/Cargo.html
+++ b/docs/Documentation/Cargo.html
@@ -3417,7 +3417,6 @@ The range till cargo will board.
-
-
CARGO_UNIT.CargoCarrier
diff --git a/docs/Documentation/Detection.html b/docs/Documentation/Detection.html
index c9238637b..c36084f27 100644
--- a/docs/Documentation/Detection.html
+++ b/docs/Documentation/Detection.html
@@ -2464,6 +2464,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemCount
@@ -2477,6 +2478,7 @@ The index of the DetectedItem.
-
+ #number
DETECTION_BASE.DetectedItemMax
diff --git a/docs/Documentation/Fsm.html b/docs/Documentation/Fsm.html
index e0276d335..177f34281 100644
--- a/docs/Documentation/Fsm.html
+++ b/docs/Documentation/Fsm.html
@@ -1598,7 +1598,7 @@ A string defining the start state.
-
-
+ #string
FSM._StartState
@@ -1897,7 +1897,6 @@ A string defining the start state.
-
-
FSM.current
diff --git a/docs/Documentation/Positionable.html b/docs/Documentation/Positionable.html
index 82d94f58f..78befb2bf 100644
--- a/docs/Documentation/Positionable.html
+++ b/docs/Documentation/Positionable.html
@@ -1838,7 +1838,6 @@ self
-
- Core.Spot#SPOT
POSITIONABLE.Spot
diff --git a/docs/Documentation/Settings.html b/docs/Documentation/Settings.html
index 6836574d8..318968720 100644
--- a/docs/Documentation/Settings.html
+++ b/docs/Documentation/Settings.html
@@ -1142,7 +1142,7 @@ true if metric.
-
- #boolean
+
SETTINGS.Metric
diff --git a/docs/Documentation/Spawn.html b/docs/Documentation/Spawn.html
index 32fc7e73f..d8d07f593 100644
--- a/docs/Documentation/Spawn.html
+++ b/docs/Documentation/Spawn.html
@@ -423,7 +423,7 @@ and any spaces before and after the resulting name are removed.
- | SPAWN:SpawnAtAirbase(Airbase, Takeoff) |
+ SPAWN:SpawnAtAirbase(Airbase, Takeoff, TakeoffAltitude) |
Will spawn a group at an airbase.
|
@@ -822,12 +822,6 @@ and any spaces before and after the resulting name are removed.
SPAWN:_TranslateRotate(SpawnIndex, SpawnRootX, SpawnRootY, SpawnX, SpawnY, SpawnAngle) |
- |
-
-
- | SPAWN.uncontrolled |
-
-
|
@@ -2269,7 +2263,7 @@ The group that was spawned. You can use this group for further actions.
-SPAWN:SpawnAtAirbase(Airbase, Takeoff)
+SPAWN:SpawnAtAirbase(Airbase, Takeoff, TakeoffAltitude)
@@ -2294,6 +2288,12 @@ The Airbase where to spawn the group.
#SPAWN.Takeoff Takeoff :
(optional) The location and takeoff method. Default is Hot.
+
+
+
+#number TakeoffAltitude :
+(optional) The altitude above the ground.
+
Return values
@@ -2732,6 +2732,9 @@ when nothing was spawned.
+
+ Overwrite unit names by default with group name.
+
@@ -2746,6 +2749,9 @@ when nothing was spawned.
+
+ By default, no InitLimit
+
@@ -2781,7 +2787,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxGroups
@@ -2798,7 +2804,7 @@ when nothing was spawned.
-
-
+ #number
SPAWN.SpawnMaxUnitsAlive
@@ -3126,7 +3132,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
-
-
+ #boolean
SPAWN.SpawnUnControlled
@@ -3150,7 +3156,7 @@ Spawn_BE_KA50 = SPAWN:New( 'BE KA-50@RAMP-Ground Defense' ):Schedule( 600, 0.5 )
-
When the first Spawn executes, all the Groups need to be made visible before start.
+ Flag that indicates if all the Groups of the SpawnGroup need to be visible when Spawned.
@@ -3730,20 +3736,6 @@ True = Continue Scheduler
-
-
-
--
-
-
-
-SPAWN.uncontrolled
-
-
--
-
-
-
diff --git a/docs/Documentation/Spot.html b/docs/Documentation/Spot.html
index ead3792db..5fdc3b305 100644
--- a/docs/Documentation/Spot.html
+++ b/docs/Documentation/Spot.html
@@ -765,6 +765,7 @@ true if it is lasing
-
+
SPOT.ScheduleID
@@ -778,6 +779,7 @@ true if it is lasing
-
+
SPOT.SpotIR
@@ -791,6 +793,7 @@ true if it is lasing
-
+
SPOT.SpotLaser
@@ -804,6 +807,7 @@ true if it is lasing
-
+
SPOT.Target
diff --git a/docs/Documentation/Task_Cargo.html b/docs/Documentation/Task_Cargo.html
index 5ccba6643..cb7e1e28f 100644
--- a/docs/Documentation/Task_Cargo.html
+++ b/docs/Documentation/Task_Cargo.html
@@ -566,7 +566,6 @@ based on the tasking capabilities defined in Task#TA
-
-
FSM_PROCESS.DeployZone