mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-21 11:53:30 +00:00
FG
This commit is contained in:
@@ -1525,7 +1525,7 @@ function FLIGHTGROUP:onafterHold(From, Event, To, airbase, SpeedTo, SpeedHold, S
|
|||||||
local p1=nil
|
local p1=nil
|
||||||
local wpap=nil
|
local wpap=nil
|
||||||
|
|
||||||
-- Altitude above ground for a glide slope of 3°.
|
-- Altitude above ground for a glide slope of 3�.
|
||||||
local alpha=math.rad(3)
|
local alpha=math.rad(3)
|
||||||
local x1=UTILS.NMToMeters(10)
|
local x1=UTILS.NMToMeters(10)
|
||||||
local x2=UTILS.NMToMeters(5)
|
local x2=UTILS.NMToMeters(5)
|
||||||
@@ -1610,13 +1610,14 @@ function FLIGHTGROUP:onafterHold(From, Event, To, airbase, SpeedTo, SpeedHold, S
|
|||||||
|
|
||||||
if fc then
|
if fc then
|
||||||
local n,parking=fc:_GetFreeParkingSpots()
|
local n,parking=fc:_GetFreeParkingSpots()
|
||||||
-- TODO: getsize
|
-- Get number of alive elements.
|
||||||
if n>=1 then
|
local Ne=self:GetNelements()
|
||||||
|
|
||||||
|
if n>=Ne then
|
||||||
for i,unit in pairs(Template.units) do
|
for i,unit in pairs(Template.units) do
|
||||||
local spot=parking[i] --Ops.FlightControl#FLIGHTCONTROL.ParkingSpot
|
local spot=parking[i] --Ops.FlightControl#FLIGHTCONTROL.ParkingSpot
|
||||||
spot.reserved4=unit.name
|
spot.reserved4=unit.name
|
||||||
unit.parking_landing=spot.id
|
unit.parking_landing=spot.id
|
||||||
unit.onboard_num=string.format("%03d", spot.id)
|
|
||||||
local text=string.format("FF Reserving parking spot %d for unit %s", spot.id, tostring(unit.name))
|
local text=string.format("FF Reserving parking spot %d for unit %s", spot.id, tostring(unit.name))
|
||||||
env.info(text)
|
env.info(text)
|
||||||
end
|
end
|
||||||
@@ -3111,6 +3112,28 @@ function FLIGHTGROUP:GetParkingTime()
|
|||||||
return -1
|
return -1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get number of elements alive.
|
||||||
|
-- @param #FLIGHTGROUP self
|
||||||
|
-- @param #string status (Optional) Only count number, which are in a special status.
|
||||||
|
-- @return #number Holding time in seconds or -1 if flight is not holding.
|
||||||
|
function FLIGHTGROUP:GetNelements(status)
|
||||||
|
|
||||||
|
local n=0
|
||||||
|
for _,_element in pairs(self.elements) do
|
||||||
|
local element=_element --#FLIGHTGROUP.Element
|
||||||
|
if element.status~=FLIGHTGROUP.ElementStatus.DEAD then
|
||||||
|
if element.unit and element.unit:IsAlive() then
|
||||||
|
if status==nil or element.status==status then
|
||||||
|
n=n+1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user