mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
AIRBOSS v0.2.7
This commit is contained in:
@@ -381,7 +381,7 @@ AIRBOSS.MenuF10={}
|
|||||||
|
|
||||||
--- Airboss class version.
|
--- Airboss class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
AIRBOSS.version="0.2.6w"
|
AIRBOSS.version="0.2.7"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@@ -449,12 +449,14 @@ function AIRBOSS:New(carriername, alias)
|
|||||||
self.beacon=BEACON:New(self.carrier)
|
self.beacon=BEACON:New(self.carrier)
|
||||||
|
|
||||||
-- Set up Airboss radio.
|
-- Set up Airboss radio.
|
||||||
self.Carrierradio=RADIO:New(self.carrier)
|
|
||||||
self:SetCarrierradio()
|
self:SetCarrierradio()
|
||||||
|
self.Carrierradio=RADIO:New(self.carrier)
|
||||||
|
self.Carrierradio:SetFrequency(self.Carrierfreq)
|
||||||
|
|
||||||
-- Set up LSO radio.
|
-- Set up LSO radio.
|
||||||
self.LSOradio=RADIO:New(self.carrier)
|
|
||||||
self:SetLSOradio()
|
self:SetLSOradio()
|
||||||
|
self.LSOradio=RADIO:New(self.carrier)
|
||||||
|
self.LSOradio:SetFrequency(self.LSOfreq)
|
||||||
|
|
||||||
-- Init carrier parameters.
|
-- Init carrier parameters.
|
||||||
if self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
if self.carriertype==AIRBOSS.CarrierType.STENNIS then
|
||||||
@@ -709,7 +711,7 @@ function AIRBOSS:onafterStart(From, Event, To)
|
|||||||
-- Handle events.
|
-- Handle events.
|
||||||
self:HandleEvent(EVENTS.Birth)
|
self:HandleEvent(EVENTS.Birth)
|
||||||
self:HandleEvent(EVENTS.Land)
|
self:HandleEvent(EVENTS.Land)
|
||||||
--self:HandleEvent(EVENTS.Crash)
|
self:HandleEvent(EVENTS.Crash)
|
||||||
|
|
||||||
-- Time stamp for checking queues.
|
-- Time stamp for checking queues.
|
||||||
self.Tqueue=timer.getTime()
|
self.Tqueue=timer.getTime()
|
||||||
@@ -819,6 +821,7 @@ end
|
|||||||
function AIRBOSS:onafterStop(From, Event, To)
|
function AIRBOSS:onafterStop(From, Event, To)
|
||||||
self:UnHandleEvent(EVENTS.Birth)
|
self:UnHandleEvent(EVENTS.Birth)
|
||||||
self:UnHandleEvent(EVENTS.Land)
|
self:UnHandleEvent(EVENTS.Land)
|
||||||
|
self:UnHandleEvent(EVENTS.Crash)
|
||||||
end
|
end
|
||||||
|
|
||||||
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -1136,10 +1139,12 @@ function AIRBOSS:_ScanCarrierZone()
|
|||||||
-- Check that it is not already in one of the queues.
|
-- Check that it is not already in one of the queues.
|
||||||
if not (self:_InQueue(self.Qmarshal, group) or self:_InQueue(self.Qpattern, group)) then
|
if not (self:_InQueue(self.Qmarshal, group) or self:_InQueue(self.Qpattern, group)) then
|
||||||
|
|
||||||
env.info("FF new marshal group="..groupname)
|
|
||||||
if self:_IsHuman(group) then
|
if self:_IsHuman(group) then
|
||||||
self:_MarshalPlayer(group)
|
env.info("FF new HUMAN marshal group (not used, register manually!)="..groupname)
|
||||||
|
--self:_MarshalPlayer(group)
|
||||||
else
|
else
|
||||||
|
env.info("FF new AI marshal group="..groupname)
|
||||||
self:_MarshalAI(group)
|
self:_MarshalAI(group)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1165,10 +1170,12 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP group Aircraft group.
|
-- @param Wrapper.Group#GROUP group Aircraft group.
|
||||||
-- @param #number flagvalue Initial user flag value.
|
-- @param #number flagvalue Initial user flag value.
|
||||||
-- @param #number alt Altitude in feet.
|
-- @param #number alt Altitude in feet.
|
||||||
function AIRBOSS:_AddFlightGroup(group)
|
-- @return #AIRBOSS.Queueitem Flight group.
|
||||||
|
function AIRBOSS:_CreateFlightGroup(group)
|
||||||
|
|
||||||
-- Flight group name
|
-- Flight group name
|
||||||
local groupname=group:GetName()
|
local groupname=group:GetName()
|
||||||
|
local human=self:_IsHuman(group)
|
||||||
|
|
||||||
-- Queue table item.
|
-- Queue table item.
|
||||||
local qitem={} --#AIRBOSS.Queueitem
|
local qitem={} --#AIRBOSS.Queueitem
|
||||||
@@ -1179,13 +1186,14 @@ function AIRBOSS:_AddFlightGroup(group)
|
|||||||
qitem.time=timer.getTime()
|
qitem.time=timer.getTime()
|
||||||
qitem.flag=USERFLAG:New(groupname)
|
qitem.flag=USERFLAG:New(groupname)
|
||||||
qitem.flag:Set(-100)
|
qitem.flag:Set(-100)
|
||||||
qitem.ai=not self:_IsHuman(group)
|
qitem.ai=not human
|
||||||
|
|
||||||
if human then
|
if human then
|
||||||
local playerData=self:_GetPlayerDataGroup(group)
|
local playerData=self:_GetPlayerDataGroup(group)
|
||||||
qitem.player=playerData
|
qitem.player=playerData
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Orbit at a specified position at a specified alititude with a specified speed.
|
--- Orbit at a specified position at a specified alititude with a specified speed.
|
||||||
@@ -1375,6 +1383,25 @@ function AIRBOSS:_CollapseMarshalStack()
|
|||||||
table.remove(self.Qmarshal, 1)
|
table.remove(self.Qmarshal, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Remove a group from a queue.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #table queue The queue from which the group will be removed.
|
||||||
|
-- @param Wrapper.Group#GROUP group Group that will be removed from queue.
|
||||||
|
function AIRBOSS:_RemoveGroupFromQueue(queue, group)
|
||||||
|
|
||||||
|
local name=group:GetName()
|
||||||
|
|
||||||
|
for i,_flight in pairs(queue) do
|
||||||
|
local flight=_flight --#AIRBOSS.Queueitem
|
||||||
|
|
||||||
|
if flight.groupname==name then
|
||||||
|
env.info(string.format("FF removing group %s from queue.", name))
|
||||||
|
table.remove(queue, i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- Remove a group from a queue.
|
--- Remove a group from a queue.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #table queue The queue from which the group will be removed.
|
-- @param #table queue The queue from which the group will be removed.
|
||||||
@@ -1449,7 +1476,7 @@ function AIRBOSS:_CheckPlayerStatus()
|
|||||||
self:I("Player status undefined. Waiting for next step.")
|
self:I("Player status undefined. Waiting for next step.")
|
||||||
|
|
||||||
-- Jump directly to CASE I straight in approach.
|
-- Jump directly to CASE I straight in approach.
|
||||||
playerData.step=AIRBOSS.PatternStep.COMMENCING
|
--playerData.step=AIRBOSS.PatternStep.COMMENCING
|
||||||
|
|
||||||
-- Jump to final/groove for testing.
|
-- Jump to final/groove for testing.
|
||||||
if self.groovedebug then
|
if self.groovedebug then
|
||||||
@@ -3091,7 +3118,7 @@ function AIRBOSS:_GS(step)
|
|||||||
local gp
|
local gp
|
||||||
if step==AIRBOSS.PatternStep.FINAL then
|
if step==AIRBOSS.PatternStep.FINAL then
|
||||||
gp="X0" -- Entering the groove.
|
gp="X0" -- Entering the groove.
|
||||||
elseif step==AIRBOSS.PatternStep then
|
elseif step==AIRBOSS.PatternStep.GROOVE_XX then
|
||||||
gp="X" -- Starting the groove.
|
gp="X" -- Starting the groove.
|
||||||
elseif step==AIRBOSS.PatternStep.GROOVE_RB then
|
elseif step==AIRBOSS.PatternStep.GROOVE_RB then
|
||||||
gp="RB" -- Roger ball call.
|
gp="RB" -- Roger ball call.
|
||||||
@@ -3438,6 +3465,9 @@ end
|
|||||||
-- @param #boolean loud If true, play loud sound file version.
|
-- @param #boolean loud If true, play loud sound file version.
|
||||||
-- @param #number delay Delay in seconds, before the message is broadcasted.
|
-- @param #number delay Delay in seconds, before the message is broadcasted.
|
||||||
function AIRBOSS:RadioTransmission(radio, call, loud, delay)
|
function AIRBOSS:RadioTransmission(radio, call, loud, delay)
|
||||||
|
self:F({radio=radio, call=call, loud=loud, delay=delay})
|
||||||
|
|
||||||
|
env.info("FF call = "..tostring(call))
|
||||||
|
|
||||||
if delay==nil or delay and delay==0 then
|
if delay==nil or delay and delay==0 then
|
||||||
|
|
||||||
@@ -3447,7 +3477,7 @@ function AIRBOSS:RadioTransmission(radio, call, loud, delay)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- New transmission.
|
-- New transmission.
|
||||||
radio:NewUnitTransmission(filename, call.subtitle, call.duration, radio.Frequency, radio.Modulation, false)
|
radio:NewUnitTransmission(filename, call.subtitle, call.duration, radio.Frequency/1000000, radio.Modulation, false)
|
||||||
|
|
||||||
-- Broadcast message.
|
-- Broadcast message.
|
||||||
radio:Broadcast()
|
radio:Broadcast()
|
||||||
@@ -3648,7 +3678,7 @@ function AIRBOSS:_AddF10Commands(_unitName)
|
|||||||
missionCommands.addCommandForGroup(_gid, "Weather Report", _rootPath, self._DisplayCarrierWeather, self, _unitName)
|
missionCommands.addCommandForGroup(_gid, "Weather Report", _rootPath, self._DisplayCarrierWeather, self, _unitName)
|
||||||
missionCommands.addCommandForGroup(_gid, "Carrier Info", _rootPath, self._DisplayCarrierInfo, self, _unitName)
|
missionCommands.addCommandForGroup(_gid, "Carrier Info", _rootPath, self._DisplayCarrierInfo, self, _unitName)
|
||||||
missionCommands.addCommandForGroup(_gid, "Request Marshal", _rootPath, self._RequestMarshal, self, _unitName)
|
missionCommands.addCommandForGroup(_gid, "Request Marshal", _rootPath, self._RequestMarshal, self, _unitName)
|
||||||
missionCommands.addCommandForGroup(_gid, "Request Straight-In", _rootPath, self._RequestStraight, self, _unitName)
|
missionCommands.addCommandForGroup(_gid, "Request Straight-In", _rootPath, self._RequestStraightIn, self, _unitName)
|
||||||
|
|
||||||
-- TODO: request straight in approach
|
-- TODO: request straight in approach
|
||||||
-- TODO: request refuelling.
|
-- TODO: request refuelling.
|
||||||
@@ -3665,6 +3695,25 @@ function AIRBOSS:_AddF10Commands(_unitName)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Request straight in approach.
|
||||||
|
-- @param #AIRBOSS self
|
||||||
|
-- @param #string _unitName Name fo the player unit.
|
||||||
|
function AIRBOSS:_RequestStraightIn(_unitName)
|
||||||
|
self:F(_unitName)
|
||||||
|
|
||||||
|
-- Get player unit and name.
|
||||||
|
local _unit, _playername = self:_GetPlayerUnitAndName(_unitName)
|
||||||
|
|
||||||
|
-- Check if we have a unit which is a player.
|
||||||
|
if _unit and _playername then
|
||||||
|
local playerData=self.players[_playername] --#AIRBOSS.PlayerData
|
||||||
|
|
||||||
|
if playerData then
|
||||||
|
self:_MarshalPlayer(_unit:GetGroup())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Request marshal.
|
--- Request marshal.
|
||||||
-- @param #AIRBOSS self
|
-- @param #AIRBOSS self
|
||||||
-- @param #string _unitName Name fo the player unit.
|
-- @param #string _unitName Name fo the player unit.
|
||||||
@@ -3855,8 +3904,12 @@ function AIRBOSS:_DisplayCarrierInfo(_unitname)
|
|||||||
text=text..string.format("BRC %d°\n", self:_BaseRecoveryCourse())
|
text=text..string.format("BRC %d°\n", self:_BaseRecoveryCourse())
|
||||||
text=text..string.format("FB %d°\n", self:_FinalBearing())
|
text=text..string.format("FB %d°\n", self:_FinalBearing())
|
||||||
text=text..string.format("Speed %d kts\n", carrierspeed)
|
text=text..string.format("Speed %d kts\n", carrierspeed)
|
||||||
|
text=text..string.format("Airboss radio %.3f MHz AM\n", self.Carrierfreq) --TODO: add modulation
|
||||||
|
text=text..string.format("LSO radio %.3f MHz AM\n", self.LSOfreq)
|
||||||
text=text..string.format("TACAN Channel %s\n", tacan)
|
text=text..string.format("TACAN Channel %s\n", tacan)
|
||||||
text=text..string.format("ICLS Channel %s", icls)
|
text=text..string.format("ICLS Channel %s\n", icls)
|
||||||
|
text=text..string.format("# A/C holding %d\n", #self.Qmarshal)
|
||||||
|
text=text..string.format("# A/C pattern %d", #self.Qpattern)
|
||||||
|
|
||||||
-- Send message.
|
-- Send message.
|
||||||
self:_SendMessageToPlayer(text, 20, playerData)
|
self:_SendMessageToPlayer(text, 20, playerData)
|
||||||
|
|||||||
Reference in New Issue
Block a user