mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
OPS
**AIRWING** - Added option to start in air `:SetTakeoffAir()` - Added option to despawn near airbase `:SetDespawnAfterHolding()` - Added option to despawn after landing `:SetDepawnAfterLanding()` **SQUADRON** - Added option to start in air `:SetTakeoffAir()` - Added option to despawn near airbase `:SetDespawnAfterHolding()` - Added option to despawn after landing `:SetDepawnAfterLanding()` - Squadron settings overrule Airwing settings **OPSGROUP** - Improved `:Teleport()` function
This commit is contained in:
@@ -5968,6 +5968,14 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
||||
_action=COORDINATE.WaypointAction.FromParkingAreaHot
|
||||
uncontrolled=false
|
||||
end
|
||||
|
||||
local airstart=asset.takeoffType and asset.takeoffType==COORDINATE.WaypointType.TurningPoint or false
|
||||
|
||||
if airstart then
|
||||
_type=COORDINATE.WaypointType.TurningPoint
|
||||
_action=COORDINATE.WaypointAction.TurningPoint
|
||||
uncontrolled=false
|
||||
end
|
||||
|
||||
|
||||
-- Set route points.
|
||||
@@ -5975,7 +5983,15 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
||||
|
||||
-- Get flight path if the group goes to another warehouse by itself.
|
||||
if request.toself then
|
||||
local wp=self.airbase:GetCoordinate():WaypointAir("RADIO", _type, _action, 0, false, self.airbase, {}, "Parking")
|
||||
|
||||
local coord=self.airbase:GetCoordinate()
|
||||
|
||||
if airstart then
|
||||
coord:SetAltitude(math.random(1000, 2000))
|
||||
end
|
||||
|
||||
-- Single waypoint.
|
||||
local wp=coord:WaypointAir("RADIO", _type, _action, 0, false, self.airbase, {}, "Parking")
|
||||
template.route.points={wp}
|
||||
else
|
||||
template.route.points=self:_GetFlightplan(asset, self.airbase, request.warehouse.airbase)
|
||||
@@ -5999,7 +6015,7 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
||||
|
||||
else
|
||||
|
||||
if #parking<#template.units then
|
||||
if #parking<#template.units and not airstart then
|
||||
local text=string.format("ERROR: Not enough parking! Free parking = %d < %d aircraft to be spawned.", #parking, #template.units)
|
||||
self:_DebugMessage(text)
|
||||
return nil
|
||||
@@ -6021,14 +6037,25 @@ function WAREHOUSE:_SpawnAssetAircraft(alias, asset, request, parking, uncontrol
|
||||
unit.x=coord.x
|
||||
unit.y=coord.z
|
||||
unit.alt=coord.y
|
||||
|
||||
if airstart then
|
||||
unit.alt=math.random(1000, 2000)
|
||||
end
|
||||
|
||||
unit.parking_id = nil
|
||||
unit.parking = nil
|
||||
|
||||
else
|
||||
|
||||
local coord=parking[i].Coordinate --Core.Point#COORDINATE
|
||||
local terminal=parking[i].TerminalID --#number
|
||||
local coord=nil --Core.Point#COORDINATE
|
||||
local terminal=nil --#number
|
||||
|
||||
if airstart then
|
||||
coord=self.airbase:GetCoordinate():SetAltitude(math.random(1000, 2000))
|
||||
else
|
||||
coord=parking[i].Coordinate
|
||||
terminal=parking[i].TerminalID
|
||||
end
|
||||
|
||||
if self.Debug then
|
||||
coord:MarkToAll(string.format("Spawnplace unit %s terminal %d.", unit.name, terminal))
|
||||
|
||||
Reference in New Issue
Block a user