mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/develop' into develop-2
This commit is contained in:
commit
cc925271aa
@ -1147,10 +1147,13 @@ end
|
||||
-- @param #string GroupName Group name.
|
||||
-- @return #table Group template table.
|
||||
function DATABASE:GetGroupTemplate( GroupName )
|
||||
local GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||
local GroupTemplate=nil
|
||||
if self.Templates.Groups[GroupName] then
|
||||
GroupTemplate = self.Templates.Groups[GroupName].Template
|
||||
GroupTemplate.SpawnCoalitionID = self.Templates.Groups[GroupName].CoalitionID
|
||||
GroupTemplate.SpawnCategoryID = self.Templates.Groups[GroupName].CategoryID
|
||||
GroupTemplate.SpawnCountryID = self.Templates.Groups[GroupName].CountryID
|
||||
end
|
||||
return GroupTemplate
|
||||
end
|
||||
|
||||
|
||||
@ -14366,32 +14366,55 @@ function AIRBOSS:_GetOnboardNumbers( group, playeronly )
|
||||
-- Debug text.
|
||||
local text = string.format( "Onboard numbers of group %s:", groupname )
|
||||
|
||||
-- Units of template group.
|
||||
local units = group:GetTemplate().units
|
||||
local template=group:GetTemplate()
|
||||
|
||||
-- Get numbers.
|
||||
local numbers = {}
|
||||
for _, unit in pairs( units ) do
|
||||
if template then
|
||||
|
||||
-- Onboard number and unit name.
|
||||
local n = tostring( unit.onboard_num )
|
||||
local name = unit.name
|
||||
local skill = unit.skill or "Unknown"
|
||||
-- Units of template group.
|
||||
local units = template.units
|
||||
|
||||
-- Debug text.
|
||||
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
||||
-- Get numbers.
|
||||
for _, unit in pairs( units ) do
|
||||
|
||||
if playeronly and skill == "Client" or skill == "Player" then
|
||||
-- There can be only one player in the group, so we skip everything else.
|
||||
return n
|
||||
-- Onboard number and unit name.
|
||||
local n = tostring( unit.onboard_num )
|
||||
local name = unit.name
|
||||
local skill = unit.skill or "Unknown"
|
||||
|
||||
-- Debug text.
|
||||
text = text .. string.format( "\n- unit %s: onboard #=%s skill=%s", name, n, tostring( skill ) )
|
||||
|
||||
if playeronly and skill == "Client" or skill == "Player" then
|
||||
-- There can be only one player in the group, so we skip everything else.
|
||||
return n
|
||||
end
|
||||
|
||||
-- Table entry.
|
||||
numbers[name] = n
|
||||
end
|
||||
|
||||
-- Table entry.
|
||||
numbers[name] = n
|
||||
end
|
||||
-- Debug info.
|
||||
self:T2( self.lid .. text )
|
||||
|
||||
-- Debug info.
|
||||
self:T2( self.lid .. text )
|
||||
else
|
||||
|
||||
if playeronly then
|
||||
return 101
|
||||
else
|
||||
|
||||
local units=group:GetUnits()
|
||||
|
||||
for i,_unit in pairs(units) do
|
||||
local name=_unit:GetName()
|
||||
|
||||
numbers[name]=100+i
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return numbers
|
||||
end
|
||||
|
||||
@ -292,7 +292,7 @@ CSAR.AircraftType["AH-64D_BLK_II"] = 2
|
||||
CSAR.AircraftType["Bronco-OV-10A"] = 2
|
||||
CSAR.AircraftType["MH-60R"] = 10
|
||||
CSAR.AircraftType["OH-6A"] = 2
|
||||
CSAR.AircraftType["OH-58D"] = 2
|
||||
CSAR.AircraftType["OH58D"] = 2
|
||||
|
||||
--- CSAR class version.
|
||||
-- @field #string version
|
||||
|
||||
@ -1250,7 +1250,7 @@ CTLD.UnitTypeCapabilities = {
|
||||
["AH-64D_BLK_II"] = {type="AH-64D_BLK_II", crates=false, troops=true, cratelimit = 0, trooplimit = 2, length = 17, cargoweightlimit = 200}, -- 2 ppl **outside** the helo
|
||||
["Bronco-OV-10A"] = {type="Bronco-OV-10A", crates= false, troops=true, cratelimit = 0, trooplimit = 5, length = 13, cargoweightlimit = 1450},
|
||||
["OH-6A"] = {type="OH-6A", crates=false, troops=true, cratelimit = 0, trooplimit = 4, length = 7, cargoweightlimit = 550},
|
||||
["OH-58D"] = {type="OH-58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400},
|
||||
["OH58D"] = {type="OH58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400},
|
||||
}
|
||||
|
||||
--- CTLD class version.
|
||||
|
||||
@ -1463,7 +1463,7 @@ end
|
||||
--- Add a CAP zone. Flights will engage detected targets inside this zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone CAP Zone. Has to be a circular zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -1479,7 +1479,7 @@ end
|
||||
--- Add a GCI CAP.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone, where the flight orbits.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -1506,7 +1506,7 @@ end
|
||||
--- Add an AWACS zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -1533,7 +1533,7 @@ end
|
||||
--- Add a refuelling tanker zone.
|
||||
-- @param #CHIEF self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
|
||||
@ -663,7 +663,7 @@ end
|
||||
--- Add a CAP zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone CapZone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -689,7 +689,7 @@ end
|
||||
--- Add a GCICAP zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone CapZone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -735,7 +735,7 @@ end
|
||||
--- Add an AWACS zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
@ -782,7 +782,7 @@ end
|
||||
--- Add a refuelling tanker zone.
|
||||
-- @param #COMMANDER self
|
||||
-- @param Core.Zone#ZONE Zone Zone.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,0000 feet.
|
||||
-- @param #number Altitude Orbit altitude in feet. Default is 12,000 feet.
|
||||
-- @param #number Speed Orbit speed in KIAS. Default 350 kts.
|
||||
-- @param #number Heading Heading of race-track pattern in degrees. Default 270 (East to West).
|
||||
-- @param #number Leg Length of race-track in NM. Default 30 NM.
|
||||
|
||||
@ -62,6 +62,8 @@
|
||||
-- @field #number runwayrepairtime Time in seconds until runway will be repaired after it was destroyed. Default is 3600 sec (one hour).
|
||||
-- @field #boolean markerParking If `true`, occupied parking spots are marked.
|
||||
-- @field #boolean nosubs If `true`, SRS TTS is without subtitles.
|
||||
-- @field #number Nplayers Number of human players. Updated at each StatusUpdate call.
|
||||
-- @field #boolean radioOnlyIfPlayers Activate to limit transmissions only if players are active at the airbase.
|
||||
-- @extends Core.Fsm#FSM
|
||||
|
||||
--- **Ground Control**: Airliner X, Good news, you are clear to taxi to the active.
|
||||
@ -272,6 +274,7 @@ FLIGHTCONTROL = {
|
||||
holdingpatterns = {},
|
||||
hpcounter = 0,
|
||||
nosubs = false,
|
||||
Nplayers = 0,
|
||||
}
|
||||
|
||||
--- Holding point. Contains holding stacks.
|
||||
@ -329,7 +332,7 @@ FLIGHTCONTROL.FlightStatus={
|
||||
|
||||
--- FlightControl class version.
|
||||
-- @field #string version
|
||||
FLIGHTCONTROL.version="0.7.5"
|
||||
FLIGHTCONTROL.version="0.7.7"
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
-- TODO list
|
||||
@ -417,6 +420,9 @@ function FLIGHTCONTROL:New(AirbaseName, Frequency, Modulation, PathToSRS, Port,
|
||||
-- Init msrs queue.
|
||||
self.msrsqueue=MSRSQUEUE:New(self.alias)
|
||||
|
||||
-- Set that transmission is only if alive players on the server.
|
||||
self:SetTransmitOnlyWithPlayers(true)
|
||||
|
||||
-- Init msrs bases
|
||||
local path = PathToSRS or MSRS.path
|
||||
local port = Port or MSRS.port or 5002
|
||||
@ -571,6 +577,31 @@ function FLIGHTCONTROL:SetVerbosity(VerbosityLevel)
|
||||
return self
|
||||
end
|
||||
|
||||
--- Limit radio transmissions only if human players are registered at the airbase.
|
||||
-- This can be used to reduce TTS messages on heavy missions.
|
||||
-- @param #FLIGHTCONTROL self
|
||||
-- @param #boolean Switch If `true` or `nil` no transmission if there are no players. Use `false` enable TTS with no players.
|
||||
-- @return #FLIGHTCONTROL self
|
||||
function FLIGHTCONTROL:SetRadioOnlyIfPlayers(Switch)
|
||||
if Switch==nil or Switch==true then
|
||||
self.radioOnlyIfPlayers=true
|
||||
else
|
||||
self.radioOnlyIfPlayers=false
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set whether to only transmit TTS messages if there are players on the server.
|
||||
-- @param #FLIGHTCONTROL self
|
||||
-- @param #boolean Switch If `true`, only send TTS messages if there are alive Players. If `false` or `nil`, transmission are done also if no players are on the server.
|
||||
-- @return #FLIGHTCONTROL self
|
||||
function FLIGHTCONTROL:SetTransmitOnlyWithPlayers(Switch)
|
||||
self.msrsqueue:SetTransmitOnlyWithPlayers(Switch)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
--- Set subtitles to appear on SRS TTS messages.
|
||||
-- @param #FLIGHTCONTROL self
|
||||
-- @return #FLIGHTCONTROL self
|
||||
@ -4082,6 +4113,15 @@ function FLIGHTCONTROL:_CheckFlights()
|
||||
end
|
||||
end
|
||||
|
||||
-- Count number of players
|
||||
self.Nplayers=0
|
||||
for _,_flight in pairs(self.flights) do
|
||||
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
|
||||
if not flight.isAI then
|
||||
self.Nplayers=self.Nplayers+1
|
||||
end
|
||||
end
|
||||
|
||||
-- Check speeding.
|
||||
if self.speedLimitTaxi then
|
||||
|
||||
@ -4314,6 +4354,11 @@ end
|
||||
-- @param #number Delay Delay in seconds before the text is transmitted. Default 0 sec.
|
||||
function FLIGHTCONTROL:TransmissionTower(Text, Flight, Delay)
|
||||
|
||||
if self.radioOnlyIfPlayers==true and self.Nplayers==0 then
|
||||
self:T(self.lid.."No players ==> skipping TOWER radio transmission")
|
||||
return
|
||||
end
|
||||
|
||||
-- Spoken text.
|
||||
local text=self:_GetTextForSpeech(Text)
|
||||
|
||||
@ -4345,6 +4390,12 @@ end
|
||||
-- @param #number Delay Delay in seconds before the text is transmitted. Default 0 sec.
|
||||
function FLIGHTCONTROL:TransmissionPilot(Text, Flight, Delay)
|
||||
|
||||
if self.radioOnlyIfPlayers==true and self.Nplayers==0 then
|
||||
self:T(self.lid.."No players ==> skipping PILOT radio transmission")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- Get player data.
|
||||
local playerData=Flight:_GetPlayerData()
|
||||
|
||||
|
||||
@ -2188,7 +2188,7 @@ function FLIGHTGROUP:onafterSpawned(From, Event, To)
|
||||
-- TODO: make this input.
|
||||
self:GetGroup():SetOption(AI.Option.Air.id.PROHIBIT_JETT, self.jettisonWeapons)
|
||||
self:GetGroup():SetOption(AI.Option.Air.id.PROHIBIT_AB, self.prohibitAB) -- Does not seem to work. AI still used the after burner.
|
||||
self:GetGroup():SetOption(AI.Option.Air.id.RTB_ON_BINGO, false)
|
||||
self:GetGroup():SetOption(AI.Option.Air.id.RTB_ON_BINGO, false)
|
||||
self:GetGroup():SetOption(AI.Option.Air.id.JETT_TANKS_IF_EMPTY, self.jettisonEmptyTanks)
|
||||
--self.group:SetOption(AI.Option.Air.id.RADAR_USING, AI.Option.Air.val.RADAR_USING.FOR_CONTINUOUS_SEARCH)
|
||||
|
||||
@ -2804,6 +2804,11 @@ function FLIGHTGROUP:_CheckGroupDone(delay, waittime)
|
||||
self:T(self.lid.."Engaging! Group NOT done...")
|
||||
return
|
||||
end
|
||||
-- Check if group is going for fuel.
|
||||
if self:IsGoing4Fuel() then
|
||||
self:T(self.lid.."Going for FUEL! Group NOT done...")
|
||||
return
|
||||
end
|
||||
|
||||
-- Number of tasks remaining.
|
||||
local nTasks=self:CountRemainingTasks()
|
||||
@ -3419,6 +3424,9 @@ function FLIGHTGROUP:onafterRefuel(From, Event, To, Coordinate)
|
||||
local wp9=Coordinate:WaypointAir("BARO", COORDINATE.WaypointType.TurningPoint, COORDINATE.WaypointAction.TurningPoint, Speed, true, nil, DCSTasks, "Refuel")
|
||||
|
||||
self:Route({wp0, wp9}, 1)
|
||||
|
||||
-- Set RTB on Bingo option. Currently DCS does not execute the refueling task if RTB_ON_BINGO is set to "NO RTB ON BINGO"
|
||||
self.group:SetOption(AI.Option.Air.id.RTB_ON_BINGO, true)
|
||||
|
||||
end
|
||||
|
||||
@ -3432,6 +3440,9 @@ function FLIGHTGROUP:onafterRefueled(From, Event, To)
|
||||
-- Debug message.
|
||||
local text=string.format("Flight group finished refuelling")
|
||||
self:T(self.lid..text)
|
||||
|
||||
-- Set RTB on Bingo option to "NO RTB ON BINGO"
|
||||
self.group:SetOption(AI.Option.Air.id.RTB_ON_BINGO, false)
|
||||
|
||||
-- Check if flight is done.
|
||||
self:_CheckGroupDone(1)
|
||||
|
||||
@ -1778,10 +1778,14 @@ end
|
||||
|
||||
--- Returns the group template from the global _DATABASE object (an instance of @{Core.Database#DATABASE}).
|
||||
-- @param #GROUP self
|
||||
-- @return #table
|
||||
-- @return #table Template table.
|
||||
function GROUP:GetTemplate()
|
||||
local GroupName = self:GetName()
|
||||
return UTILS.DeepCopy( _DATABASE:GetGroupTemplate( GroupName ) )
|
||||
local template=_DATABASE:GetGroupTemplate( GroupName )
|
||||
if template then
|
||||
return UTILS.DeepCopy( template )
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Returns the group template route.points[] (the waypoints) from the global _DATABASE object (an instance of @{Core.Database#DATABASE}).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user