- Improved FC
This commit is contained in:
Frank 2022-05-12 08:03:08 +02:00
parent f8e5efc874
commit ddcc851951
5 changed files with 2741 additions and 13 deletions

View File

@ -101,6 +101,7 @@ __Moose.Include( 'Scripts/Moose/Ops/Chief.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Flotilla.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Fleet.lua' )
__Moose.Include( 'Scripts/Moose/Ops/Awacs.lua' )
__Moose.Include( 'Scripts/Moose/Ops/FlightControl.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Balancer.lua' )
__Moose.Include( 'Scripts/Moose/AI/AI_Air.lua' )

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@
-- @field #boolean despawnAfterLanding If `true`, group is despawned after landed at an airbase.
-- @field #boolean despawnAfterHolding If `true`, group is despawned after reaching the holding point.
-- @field #number RTBRecallCount Number that counts RTB calls.
-- @field Ops.FlightControl#FLIGHTCONTROL.HoldingStack stack Holding stack.
--
-- @extends Ops.OpsGroup#OPSGROUP
@ -379,7 +380,9 @@ function FLIGHTGROUP:SetFlightControl(flightcontrol)
self.flightcontrol=flightcontrol
-- Add flight to all flights.
table.insert(flightcontrol.flights, self)
if not flightcontrol:IsFlight(self) then
table.insert(flightcontrol.flights, self)
end
-- Update flight's F10 menu.
if self.isAI==false then
@ -800,10 +803,12 @@ function FLIGHTGROUP:Status()
-- Get distance to assigned parking spot.
local dist=element.unit:GetCoordinate():Get2DDistance(element.parking.Coordinate)
env.info(string.format("FF dist to parking spot %d = %.1f meters", element.parking.TerminalID, dist))
-- If distance >10 meters, we consider the unit as taxiing.
-- TODO: Check distance threshold! If element is taxiing, the parking spot is free again.
-- When the next plane is spawned on this spot, collisions should be avoided!
if dist>10 then
if dist>5 then
if element.status==OPSGROUP.ElementStatus.ENGINEON then
self:ElementTaxiing(element)
end
@ -1583,8 +1588,18 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
env.info("FF Spawned update menu")
-- F10 other menu.
self:_UpdateMenu()
-- Set flightcontrol.
if self.currbase then
local flightcontrol=_DATABASE:GetFlightControl(self.currbase:GetName())
if flightcontrol then
self:SetFlightControl(flightcontrol)
else
-- F10 other menu.
self:_UpdateMenu()
end
else
self:_UpdateMenu()
end
end
@ -1621,6 +1636,8 @@ function FLIGHTGROUP:onafterParking(From, Event, To)
if flightcontrol then
env.info("FF flight control!")
-- Set FC for this flight
self:SetFlightControl(flightcontrol)
@ -1635,6 +1652,9 @@ function FLIGHTGROUP:onafterParking(From, Event, To)
end
end
else
env.info("FF no flight control!")
end
end
@ -2517,15 +2537,22 @@ function FLIGHTGROUP:_LandAtAirbase(airbase, SpeedTo, SpeedHold, SpeedLand)
-- Do we have a flight control?
local fc=_DATABASE:GetFlightControl(airbase:GetName())
if fc then
-- Get holding point from flight control.
local HoldingPoint=fc:_GetHoldingpoint(self)
p0=HoldingPoint.pos0
p1=HoldingPoint.pos1
-- Debug marks.
if false then
p0:MarkToAll("Holding point P0")
p1:MarkToAll("Holding point P1")
if HoldingPoint then
-- Race track points.
p0=HoldingPoint.pos0
p1=HoldingPoint.pos1
-- Debug marks.
if true then
p0:MarkToAll(string.format("%s: Holding point P0, alt=%d meters", self:GetName(), p0.y))
p1:MarkToAll(string.format("%s: Holding point P1, alt=%d meters", self:GetName(), p0.y))
end
end
-- Set flightcontrol for this flight.

View File

@ -205,6 +205,7 @@ OPSGROUP = {
-- @field DCS#Controller controller The DCS controller of the unit.
-- @field #boolean ai If true, element is AI.
-- @field #string skill Skill level.
-- @field #string playerName Name of player if this is a client.
--
-- @field Core.Zone#ZONE_POLYGON_BASE zoneBoundingbox Bounding box zone of the element unit.
-- @field Core.Zone#ZONE_POLYGON_BASE zoneLoad Loading zone.
@ -270,6 +271,28 @@ OPSGROUP.ElementStatus={
DEAD="dead",
}
--- Status of group.
-- @type OPSGROUP.GroupStatus
-- @field #string INUTERO Not spawned yet or its status is unknown so far.
-- @field #string PARKING Parking after spawned on ramp.
-- @field #string TAXIING Taxiing after engine startup.
-- @field #string AIRBORNE Element is airborne. Either after takeoff or after air start.
-- @field #string LANDING Landing.
-- @field #string LANDED Landed and is taxiing to its parking spot.
-- @field #string ARRIVED Arrived at its parking spot and shut down its engines.
-- @field #string DEAD Element is dead after it crashed, pilot ejected or pilot dead events.
OPSGROUP.GroupStatus={
INUTERO="InUtero",
PARKING="Parking",
TAXIING="Taxiing",
AIRBORNE="Airborne",
INBOUND="Inbound",
LANDING="Landing",
LANDED="Landed",
ARRIVED="Arrived",
DEAD="Dead",
}
--- Ops group task status.
-- @type OPSGROUP.TaskStatus
-- @field #string SCHEDULED Task is scheduled.

View File

@ -96,6 +96,7 @@ Ops/Chief.lua
Ops/CSAR.lua
Ops/CTLD.lua
Ops/Awacs.lua
Ops/FlightControl.lua
AI/AI_Balancer.lua
AI/AI_Air.lua