mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
AIRBOSS v0.95
- Fixed bug in counting units - Carrier will only turn into the wind if wind > 0.1 m/s
This commit is contained in:
parent
e063379cd8
commit
7a075e73ca
@ -1651,7 +1651,7 @@ AIRBOSS.MenuF10Root=nil
|
|||||||
|
|
||||||
--- Airboss class version.
|
--- Airboss class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRBOSS.version="0.9.4"
|
AIRBOSS.version="0.9.5"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -4928,7 +4928,10 @@ function AIRBOSS:_AddMarshalGroup(flight, stack)
|
|||||||
|
|
||||||
-- If the carrier is supposed to turn into the wind, we take the wind coordinate.
|
-- If the carrier is supposed to turn into the wind, we take the wind coordinate.
|
||||||
if self.recoverywindow and self.recoverywindow.WIND then
|
if self.recoverywindow and self.recoverywindow.WIND then
|
||||||
brc=self:GetBRCintoWind()
|
local _,vwind=self:GetCoordinate():GetWind(50)
|
||||||
|
if vwind>0.1 then
|
||||||
|
brc=self:GetBRCintoWind()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get charlie time estimate.
|
-- Get charlie time estimate.
|
||||||
@ -5170,17 +5173,20 @@ function AIRBOSS:_GetFlightUnits(flight, onground)
|
|||||||
local group=_group --Wrapper.Group#GROUP
|
local group=_group --Wrapper.Group#GROUP
|
||||||
local units=group:GetUnits()
|
local units=group:GetUnits()
|
||||||
local n=0
|
local n=0
|
||||||
for _,_unit in pairs(units) do
|
if units then
|
||||||
local unit=_unit --Wrapper.Unit#UNIT
|
for _,_unit in pairs(units) do
|
||||||
if unit and unit:IsAlive() then
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
if inair then
|
if unit and unit:IsAlive() then
|
||||||
-- Only count units in air.
|
if inair then
|
||||||
if unit:InAir() then
|
-- Only count units in air.
|
||||||
|
if unit:InAir() then
|
||||||
|
self:T2(self.lid..string.format("Unit %s is in AIR", unit:GetName()))
|
||||||
|
n=n+1
|
||||||
|
end
|
||||||
|
else
|
||||||
|
-- Count units in air or on the ground.
|
||||||
n=n+1
|
n=n+1
|
||||||
end
|
end
|
||||||
else
|
|
||||||
-- Count units in air or on the ground.
|
|
||||||
n=n+1
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -5718,11 +5724,17 @@ function AIRBOSS:_RemoveUnitFromFlight(unit)
|
|||||||
|
|
||||||
if removed then
|
if removed then
|
||||||
|
|
||||||
-- Get number of units (excluding section members). For AI only those that are stil in air as we assume once they landed, they are out of the game.
|
-- Get number of units (excluding section members). For AI only those that are still in air as we assume once they landed, they are out of the game.
|
||||||
local _,nunits=self:_GetFlightUnits(flight, not flight.ai)
|
local _,nunits=self:_GetFlightUnits(flight, not flight.ai)
|
||||||
|
|
||||||
|
-- Number of flight elements still left.
|
||||||
|
local nelements=#flight.elements
|
||||||
|
|
||||||
|
-- Debug info.
|
||||||
|
self:T(self.lid..string.format("Removed unit %s: nunits=%d, nelements=%d", unit:GetName(), nunits, nelements))
|
||||||
|
|
||||||
-- Check if no units are left.
|
-- Check if no units are left.
|
||||||
if nunits==0 then
|
if nunits==0 or nelements==0 then
|
||||||
-- Remove flight from all queues.
|
-- Remove flight from all queues.
|
||||||
self:_RemoveFlight(flight)
|
self:_RemoveFlight(flight)
|
||||||
end
|
end
|
||||||
@ -10529,6 +10541,11 @@ function AIRBOSS:CarrierTurnIntoWind(time, vdeck)
|
|||||||
-- Wind speed.
|
-- Wind speed.
|
||||||
local _,vwind=self:GetCoordinate():GetWind(50)
|
local _,vwind=self:GetCoordinate():GetWind(50)
|
||||||
|
|
||||||
|
-- Check that wind is >= 0.1 m/s.
|
||||||
|
if vwind<0.1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- Speed of carrier in m/s.
|
-- Speed of carrier in m/s.
|
||||||
local vtot=vdeck-vwind
|
local vtot=vdeck-vwind
|
||||||
|
|
||||||
@ -12036,9 +12053,9 @@ function AIRBOSS:_AddF10Commands(_unitName)
|
|||||||
missionCommands.addCommandForGroup(gid, "Carrier Info", _kneeboardPath, self._DisplayCarrierInfo, self, _unitName) -- F2
|
missionCommands.addCommandForGroup(gid, "Carrier Info", _kneeboardPath, self._DisplayCarrierInfo, self, _unitName) -- F2
|
||||||
missionCommands.addCommandForGroup(gid, "Weather Report", _kneeboardPath, self._DisplayCarrierWeather, self, _unitName) -- F3
|
missionCommands.addCommandForGroup(gid, "Weather Report", _kneeboardPath, self._DisplayCarrierWeather, self, _unitName) -- F3
|
||||||
missionCommands.addCommandForGroup(gid, "Set Section", _kneeboardPath, self._SetSection, self, _unitName) -- F4
|
missionCommands.addCommandForGroup(gid, "Set Section", _kneeboardPath, self._SetSection, self, _unitName) -- F4
|
||||||
missionCommands.addCommandForGroup(gid, "Marshal Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, self.Qmarshal, "Marshal") -- F5
|
missionCommands.addCommandForGroup(gid, "Marshal Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, "Marshal") -- F5
|
||||||
missionCommands.addCommandForGroup(gid, "Pattern Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, self.Qpattern, "Pattern") -- F6
|
missionCommands.addCommandForGroup(gid, "Pattern Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, "Pattern") -- F6
|
||||||
missionCommands.addCommandForGroup(gid, "Waiting Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, self.Qwaiting, "Waiting") -- F7
|
missionCommands.addCommandForGroup(gid, "Waiting Queue", _kneeboardPath, self._DisplayQueue, self, _unitName, "Waiting") -- F7
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
-- F10/Airboss/<Carrier>/
|
-- F10/Airboss/<Carrier>/
|
||||||
@ -12753,9 +12770,8 @@ end
|
|||||||
--- Display marshal or pattern queue.
|
--- Display marshal or pattern queue.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #string _unitname Name of the player unit.
|
-- @param #string _unitname Name of the player unit.
|
||||||
-- @param #table queue The queue to display.
|
|
||||||
-- @param #string qname Name of the queue.
|
-- @param #string qname Name of the queue.
|
||||||
function AIRBOSS:_DisplayQueue(_unitname, queue, qname)
|
function AIRBOSS:_DisplayQueue(_unitname, qname)
|
||||||
|
|
||||||
-- Get player unit and player name.
|
-- Get player unit and player name.
|
||||||
local unit, playername = self:_GetPlayerUnitAndName(_unitname)
|
local unit, playername = self:_GetPlayerUnitAndName(_unitname)
|
||||||
@ -12768,6 +12784,16 @@ function AIRBOSS:_DisplayQueue(_unitname, queue, qname)
|
|||||||
|
|
||||||
if playerData then
|
if playerData then
|
||||||
|
|
||||||
|
-- Queue to display.
|
||||||
|
local queue=nil
|
||||||
|
if qname=="Marshal" then
|
||||||
|
queue=self.Qmarshal
|
||||||
|
elseif qname=="Pattern" then
|
||||||
|
queue=self.Qpattern
|
||||||
|
elseif qname=="Waiting" then
|
||||||
|
queue=self.Qwaiting
|
||||||
|
end
|
||||||
|
|
||||||
-- Number of group and units in queue
|
-- Number of group and units in queue
|
||||||
local Nqueue,nqueue=self:_GetQueueInfo(queue, playerData.case)
|
local Nqueue,nqueue=self:_GetQueueInfo(queue, playerData.case)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user