mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Updates
**AIRBOSS** - Stennis now takes dimensions of other super carriers **FLIGHTCONTROL** - Added queue for sounds - Fixed bugs and minor improvements **ZONE** - Added defaults when getting colors if not set **SRS** - Added new class `MSRSQUEUE`
This commit is contained in:
@@ -1978,7 +1978,8 @@ function AIRBOSS:New( carriername, alias )
|
||||
|
||||
-- Init carrier parameters.
|
||||
if self.carriertype == AIRBOSS.CarrierType.STENNIS then
|
||||
self:_InitStennis()
|
||||
--self:_InitStennis()
|
||||
self:_InitNimitz()
|
||||
elseif self.carriertype == AIRBOSS.CarrierType.ROOSEVELT then
|
||||
self:_InitNimitz()
|
||||
elseif self.carriertype == AIRBOSS.CarrierType.LINCOLN then
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
-- @field Core.Spawn#SPAWN parkingGuard Parking guard spawner.
|
||||
-- @field #table holdingpatterns Holding points.
|
||||
-- @field #number hpcounter Counter for holding zones.
|
||||
-- @field Sound.SRS#MSRSQUEUE msrsqueue Queue for TTS transmissions using MSRS class.
|
||||
-- @field Sound.SRS#MSRS msrsTower Moose SRS wrapper.
|
||||
-- @field Sound.SRS#MSRS msrsPilot Moose SRS wrapper.
|
||||
-- @field #number Tlastmessage Time stamp (abs.) of last radio transmission.
|
||||
@@ -326,7 +327,7 @@ FLIGHTCONTROL.FlightStatus={
|
||||
|
||||
--- FlightControl class version.
|
||||
-- @field #string version
|
||||
FLIGHTCONTROL.version="0.7.0"
|
||||
FLIGHTCONTROL.version="0.7.1"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@@ -405,6 +406,9 @@ function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS)
|
||||
self:SetMarkHoldingPattern(true)
|
||||
self:SetRunwayRepairtime()
|
||||
|
||||
-- Init msrs queue.
|
||||
self.msrsqueue=MSRSQUEUE:New(self.alias)
|
||||
|
||||
-- SRS for Tower.
|
||||
self.msrsTower=MSRS:New(PathToSRS, Frequency, Modulation)
|
||||
self:SetSRSTower()
|
||||
@@ -977,6 +981,7 @@ end
|
||||
-- @param #FLIGHTCONTROL self
|
||||
function FLIGHTCONTROL:onbeforeStatusUpdate()
|
||||
|
||||
--[[
|
||||
if self.Tlastmessage then
|
||||
local Tnow=timer.getAbsTime()
|
||||
|
||||
@@ -1001,6 +1006,21 @@ function FLIGHTCONTROL:onbeforeStatusUpdate()
|
||||
self:T2(self.lid..string.format("Last radio sent %d>%d sec ago. Status update allowed", dT, self.dTmessage))
|
||||
end
|
||||
end
|
||||
]]
|
||||
|
||||
local Tqueue=self.msrsqueue:CalcTransmisstionDuration()
|
||||
|
||||
if Tqueue>0 then
|
||||
-- Debug info.
|
||||
local text=string.format("Still got %d messages in the radio queue. Will call status again in %.1f sec", #self.msrsqueue, Tqueue)
|
||||
self:I(self.lid..text)
|
||||
|
||||
-- Call status again in dt seconds.
|
||||
self:__StatusUpdate(-Tqueue)
|
||||
|
||||
-- Deny transition.
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
@@ -3273,8 +3293,10 @@ function FLIGHTCONTROL:_PlayerAbortLanding(groupname)
|
||||
local flight=_DATABASE:GetOpsGroup(groupname) --Ops.FlightGroup#FLIGHTGROUP
|
||||
|
||||
if flight then
|
||||
|
||||
local flightstatus=self:GetFlightStatus(flight)
|
||||
|
||||
if flight:IsLanding() and self:IsControlling(flight) then
|
||||
if (flight:IsLanding() or flightstatus==FLIGHTCONTROL.FlightStatus.LANDING) and self:IsControlling(flight) then
|
||||
|
||||
-- Call sign.
|
||||
local callsign=self:_GetCallsignName(flight)
|
||||
@@ -3357,9 +3379,12 @@ function FLIGHTCONTROL:_PlayerRequestDirectLanding(groupname)
|
||||
self:TransmissionTower(text, flight, 10)
|
||||
|
||||
else
|
||||
|
||||
-- Runway.
|
||||
local runway=self:GetActiveRunwayText()
|
||||
|
||||
-- Message text.
|
||||
local text=string.format("%s, affirmative! Confirm approach", callsign)
|
||||
local text=string.format("%s, affirmative, runway %s. Confirm approach!", callsign, runway)
|
||||
|
||||
-- Send message.
|
||||
self:TransmissionTower(text, flight, 10)
|
||||
@@ -4025,12 +4050,15 @@ function FLIGHTCONTROL:_CheckFlights()
|
||||
local onRunway=self:IsCoordinateRunway(coord)
|
||||
|
||||
-- Debug output.
|
||||
self:I(self.lid..string.format("Player %s speed %.1f knots (max=%.1f) onRunway=%s", playerElement.playerName, UTILS.MpsToKnots(speed), UTILS.MpsToKnots(self.speedLimitTaxi), tostring(onRunway)))
|
||||
self:T(self.lid..string.format("Player %s speed %.1f knots (max=%.1f) onRunway=%s", playerElement.playerName, UTILS.MpsToKnots(speed), UTILS.MpsToKnots(self.speedLimitTaxi), tostring(onRunway)))
|
||||
|
||||
if speed and speed>self.speedLimitTaxi and not onRunway then
|
||||
|
||||
-- Callsign.
|
||||
local callsign=self:_GetCallsignName(flight)
|
||||
|
||||
-- Radio text.
|
||||
local text="Slow down, you are taxiing too fast!"
|
||||
local text=string.format("%s, slow down, you are taxiing too fast!", callsign)
|
||||
|
||||
-- Radio message to player.
|
||||
self:TransmissionTower(text, flight)
|
||||
@@ -4227,18 +4255,20 @@ function FLIGHTCONTROL:TransmissionTower(Text, Flight, Delay)
|
||||
|
||||
-- Spoken text.
|
||||
local text=self:_GetTextForSpeech(Text)
|
||||
|
||||
-- Tower radio call.
|
||||
self.msrsTower:PlayText(text, Delay)
|
||||
|
||||
|
||||
-- "Subtitle".
|
||||
local subgroups=nil
|
||||
if Flight and not Flight.isAI then
|
||||
local playerData=Flight:_GetPlayerData()
|
||||
if playerData.subtitles then
|
||||
self:TextMessageToFlight(Text, Flight, 5, false, Delay)
|
||||
subgroups=subgroups or {}
|
||||
table.insert(subgroups, Flight.group)
|
||||
end
|
||||
end
|
||||
|
||||
-- New transmission.
|
||||
local transmission=self.msrsqueue:NewTransmission(text, nil, self.msrsTower, nil, 1, subgroups, Text)
|
||||
|
||||
-- Set time stamp. Can be in the future.
|
||||
self.Tlastmessage=timer.getAbsTime() + (Delay or 0)
|
||||
|
||||
@@ -4256,29 +4286,35 @@ function FLIGHTCONTROL:TransmissionPilot(Text, Flight, Delay)
|
||||
|
||||
-- Get player data.
|
||||
local playerData=Flight:_GetPlayerData()
|
||||
|
||||
|
||||
-- Check if player enabled his "voice".
|
||||
if playerData==nil or playerData.myvoice then
|
||||
|
||||
-- Spoken text.
|
||||
local text=self:_GetTextForSpeech(Text)
|
||||
|
||||
-- MSRS instance to use.
|
||||
local msrs=self.msrsPilot
|
||||
|
||||
if Flight.useSRS and Flight.msrs then
|
||||
|
||||
-- Pilot radio call using settings of the FLIGHTGROUP. We just overwrite the frequency.
|
||||
Flight.msrs:PlayTextExt(text, Delay, self.frequency, self.modulation, Gender, Culture, Voice, Volume, Label)
|
||||
|
||||
else
|
||||
|
||||
-- Pilot radio call using the default settings.
|
||||
self.msrsPilot:PlayText(text, Delay)
|
||||
|
||||
end
|
||||
|
||||
-- "Subtitle".
|
||||
if Flight and not Flight.isAI then
|
||||
self:TextMessageToFlight(Text, Flight, 5, false, Delay)
|
||||
msrs=Flight.msrs
|
||||
|
||||
end
|
||||
|
||||
-- "Subtitle".
|
||||
local subgroups=nil
|
||||
if Flight and not Flight.isAI then
|
||||
local playerData=Flight:_GetPlayerData()
|
||||
if playerData.subtitles then
|
||||
subgroups=subgroups or {}
|
||||
table.insert(subgroups, Flight.group)
|
||||
end
|
||||
end
|
||||
|
||||
-- Add transmission to msrsqueue.
|
||||
self.msrsqueue:NewTransmission(text, nil, msrs, nil, 1, subgroups, Text, nil, self.frequency, self.modulation)
|
||||
|
||||
end
|
||||
|
||||
@@ -4439,7 +4475,7 @@ end
|
||||
--- Get text for text-to-speech.
|
||||
-- Numbers are spaced out, e.g. "Heading 180" becomes "Heading 1 8 0 ".
|
||||
-- @param #FLIGHTCONTROL self
|
||||
-- @param #string text
|
||||
-- @param #string text Original text.
|
||||
-- @return #string Spoken text.
|
||||
function FLIGHTCONTROL:_GetTextForSpeech(text)
|
||||
|
||||
|
||||
@@ -576,10 +576,11 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight is parking after spawned.
|
||||
function FLIGHTGROUP:IsParking(Element)
|
||||
local is=self:Is("Parking")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.PARKING
|
||||
is=Element.status==OPSGROUP.ElementStatus.PARKING
|
||||
end
|
||||
return self:Is("Parking")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if is taxiing to the runway.
|
||||
@@ -587,10 +588,11 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight is taxiing after engine start up.
|
||||
function FLIGHTGROUP:IsTaxiing(Element)
|
||||
local is=self:Is("Taxiing")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.TAXIING
|
||||
is=Element.status==OPSGROUP.ElementStatus.TAXIING
|
||||
end
|
||||
return self:Is("Taxiing")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is airborne or cruising.
|
||||
@@ -598,17 +600,19 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight is airborne.
|
||||
function FLIGHTGROUP:IsAirborne(Element)
|
||||
local is=self:Is("Airborne") or self:Is("Cruising")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.AIRBORNE
|
||||
is=Element.status==OPSGROUP.ElementStatus.AIRBORNE
|
||||
end
|
||||
return self:Is("Airborne") or self:Is("Cruising")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is airborne or cruising.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, flight is airborne.
|
||||
function FLIGHTGROUP:IsCruising()
|
||||
return self:Is("Cruising")
|
||||
local is=self:Is("Cruising")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is landing.
|
||||
@@ -616,10 +620,11 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight is landing, i.e. on final approach.
|
||||
function FLIGHTGROUP:IsLanding(Element)
|
||||
local is=self:Is("Landing")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.LANDING
|
||||
is=Element.status==OPSGROUP.ElementStatus.LANDING
|
||||
end
|
||||
return self:Is("Landing")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight has landed and is now taxiing to its parking spot.
|
||||
@@ -627,10 +632,11 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight has landed
|
||||
function FLIGHTGROUP:IsLanded(Element)
|
||||
local is=self:Is("Landed")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.LANDED
|
||||
is=Element.status==OPSGROUP.ElementStatus.LANDED
|
||||
end
|
||||
return self:Is("Landed")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight has arrived at its destination parking spot.
|
||||
@@ -638,45 +644,51 @@ end
|
||||
-- @param Ops.OpsGroup#OPSGROUP.Element Element (Optional) Only check status for given element.
|
||||
-- @return #boolean If true, flight has arrived at its destination and is parking.
|
||||
function FLIGHTGROUP:IsArrived(Element)
|
||||
local is=self:Is("Arrived")
|
||||
if Element then
|
||||
return Element.status==OPSGROUP.ElementStatus.ARRIVED
|
||||
is=Element.status==OPSGROUP.ElementStatus.ARRIVED
|
||||
end
|
||||
return self:Is("Arrived")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is inbound and traveling to holding pattern.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, flight is holding.
|
||||
function FLIGHTGROUP:IsInbound()
|
||||
return self:Is("Inbound")
|
||||
local is=self:Is("Inbound")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is holding and waiting for landing clearance.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, flight is holding.
|
||||
function FLIGHTGROUP:IsHolding()
|
||||
return self:Is("Holding")
|
||||
local is=self:Is("Holding")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is going for fuel.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, flight is refueling.
|
||||
function FLIGHTGROUP:IsGoing4Fuel()
|
||||
return self:Is("Going4Fuel")
|
||||
local is=self:Is("Going4Fuel")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if helo(!) flight is ordered to land at a specific point.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, group has task to land somewhere.
|
||||
function FLIGHTGROUP:IsLandingAt()
|
||||
return self:Is("LandingAt")
|
||||
local is=self:Is("LandingAt")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if helo(!) flight has landed at a specific point.
|
||||
-- @param #FLIGHTGROUP self
|
||||
-- @return #boolean If true, has landed somewhere.
|
||||
function FLIGHTGROUP:IsLandedAt()
|
||||
return self:Is("LandedAt")
|
||||
is=self:Is("LandedAt")
|
||||
return is
|
||||
end
|
||||
|
||||
--- Check if flight is low on fuel.
|
||||
|
||||
Reference in New Issue
Block a user