Merge branch 'FF/Ops' into FF/OpsDev

This commit is contained in:
Frank
2024-06-19 07:53:54 +02:00
29 changed files with 1396 additions and 638 deletions

View File

@@ -255,6 +255,7 @@
-- @field #boolean skipperUturn U-turn on/off via menu.
-- @field #number skipperOffset Holding offset angle in degrees for Case II/III manual recoveries.
-- @field #number skipperTime Recovery time in min for manual recovery.
-- @field #boolean intowindold If true, use old into wind calculation.
-- @extends Core.Fsm#FSM
--- Be the boss!
@@ -2724,6 +2725,18 @@ function AIRBOSS:SetLSOCallInterval( TimeInterval )
return self
end
--- Set if old into wind calculation is used when carrier turns into the wind for a recovery.
-- @param #AIRBOSS self
-- @param #boolean SwitchOn If `true` or `nil`, use old into wind calculation.
-- @return #AIRBOSS self
function AIRBOSS:SetIntoWindLegacy( SwitchOn )
if SwitchOn==nil then
SwitchOn=true
end
self.intowindold=SwitchOn
return self
end
--- Airboss is a rather nice guy and not strictly following the rules. Fore example, he does allow you into the landing pattern if you are not coming from the Marshal stack.
-- @param #AIRBOSS self
-- @param #boolean Switch If true or nil, Airboss bends the rules a bit.
@@ -3642,6 +3655,12 @@ function AIRBOSS:onafterStatus( From, Event, To )
local pos = self:GetCoordinate()
local speed = self.carrier:GetVelocityKNOTS()
-- Update magnetic variation if we can get it from DCS.
if require then
self.magvar=pos:GetMagneticDeclination()
--env.info(string.format("FF magvar=%.1f", self.magvar))
end
-- Check water is ahead.
local collision = false -- self:_CheckCollisionCoord(pos:Translate(self.collisiondist, hdg))
@@ -5201,6 +5220,7 @@ function AIRBOSS:_InitVoiceOvers()
TOMCAT = { file = "PILOT-Tomcat", suffix = "ogg", loud = false, subtitle = "", duration = 0.66, subduration = 5 },
HORNET = { file = "PILOT-Hornet", suffix = "ogg", loud = false, subtitle = "", duration = 0.56, subduration = 5 },
VIKING = { file = "PILOT-Viking", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
GREYHOUND = { file = "PILOT-Greyhound", suffix = "ogg", loud = false, subtitle = "", duration = 0.61, subduration = 5 },
BALL = { file = "PILOT-Ball", suffix = "ogg", loud = false, subtitle = "", duration = 0.50, subduration = 5 },
BINGOFUEL = { file = "PILOT-BingoFuel", suffix = "ogg", loud = false, subtitle = "", duration = 0.80 },
GASATDIVERT = { file = "PILOT-GasAtDivert", suffix = "ogg", loud = false, subtitle = "", duration = 1.80 },
@@ -6475,7 +6495,7 @@ function AIRBOSS:_LandAI( flight )
or flight.actype == AIRBOSS.AircraftCarrier.RHINOF
or flight.actype == AIRBOSS.AircraftCarrier.GROWLER then
Speed = UTILS.KnotsToKmph( 200 )
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D then
elseif flight.actype == AIRBOSS.AircraftCarrier.E2D or flight.actype == AIRBOSS.AircraftCarrier.C2A then
Speed = UTILS.KnotsToKmph( 150 )
elseif flight.actype == AIRBOSS.AircraftCarrier.F14A_AI or flight.actype == AIRBOSS.AircraftCarrier.F14A or flight.actype == AIRBOSS.AircraftCarrier.F14B then
Speed = UTILS.KnotsToKmph( 175 )
@@ -11476,7 +11496,7 @@ end
--- Get wind direction and speed at carrier position.
-- @param #AIRBOSS self
-- @param #number alt Altitude ASL in meters. Default 15 m.
-- @param #number alt Altitude ASL in meters. Default 18 m.
-- @param #boolean magnetic Direction including magnetic declination.
-- @param Core.Point#COORDINATE coord (Optional) Coordinate at which to get the wind. Default is current carrier position.
-- @return #number Direction the wind is blowing **from** in degrees.
@@ -11548,10 +11568,31 @@ end
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
-- @param #AIRBOSS self
-- @param #number vdeck Desired wind velocity over deck in knots.
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
-- @return #number Carrier heading in degrees.
function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
function AIRBOSS:GetHeadingIntoWind(vdeck, magnetic, coord )
if self.intowindold then
--env.info("FF use OLD into wind")
return self:GetHeadingIntoWind_old(vdeck, magnetic, coord)
else
--env.info("FF use NEW into wind")
return self:GetHeadingIntoWind_new(vdeck, magnetic, coord)
end
end
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
-- @param #AIRBOSS self
-- @param #number vdeck Desired wind velocity over deck in knots.
-- @param #boolean magnetic If true, calculate magnetic heading. By default true heading is returned.
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
-- @return #number Carrier heading in degrees.
function AIRBOSS:GetHeadingIntoWind_old( vdeck, magnetic, coord )
local function adjustDegreesForWindSpeed(windSpeed)
local degreesAdjustment = 0
@@ -11608,7 +11649,13 @@ function AIRBOSS:GetHeadingIntoWind_old( magnetic, coord )
intowind = intowind + 360
end
return intowind
-- Wind speed.
--local _, vwind = self:GetWind()
-- Speed of carrier in m/s but at least 4 knots.
local vtot = math.max(vdeck-UTILS.MpsToKnots(vwind), 4)
return intowind, vtot
end
--- Get true (or magnetic) heading of carrier into the wind. This accounts for the angled runway.
@@ -11619,7 +11666,7 @@ end
-- @param Core.Point#COORDINATE coord (Optional) Coordinate from which heading is calculated. Default is current carrier position.
-- @return #number Carrier heading in degrees.
-- @return #number Carrier speed in knots to reach desired wind speed on deck.
function AIRBOSS:GetHeadingIntoWind( vdeck, magnetic, coord )
function AIRBOSS:GetHeadingIntoWind_new( vdeck, magnetic, coord )
-- Default offset angle.
local Offset=self.carrierparam.rwyangle or 0
@@ -14280,6 +14327,8 @@ function AIRBOSS:_GetACNickname( actype )
nickname = "Harrier"
elseif actype == AIRBOSS.AircraftCarrier.E2D then
nickname = "Hawkeye"
elseif actype == AIRBOSS.AircraftCarrier.C2A then
nickname = "Greyhound"
elseif actype == AIRBOSS.AircraftCarrier.F14A_AI or actype == AIRBOSS.AircraftCarrier.F14A or actype == AIRBOSS.AircraftCarrier.F14B then
nickname = "Tomcat"
elseif actype == AIRBOSS.AircraftCarrier.FA18C or actype == AIRBOSS.AircraftCarrier.HORNET then
@@ -14317,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

View File

@@ -2109,7 +2109,7 @@ function ARMYGROUP:_InitGroup(Template, Delay)
return
end
self:I(self.lid.."FF Initializing Group")
self:T(self.lid.."FF Initializing Group")
-- Get template of group.
local template=Template or self:_GetTemplate()

View File

@@ -291,10 +291,12 @@ CSAR.AircraftType["UH-60L"] = 10
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["OH58D"] = 2
--- CSAR class version.
-- @field #string version
CSAR.version="1.0.21"
CSAR.version="1.0.24"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ToDo list
@@ -734,7 +736,7 @@ function CSAR:_SpawnPilotInField(country,point,frequency,wetfeet)
:NewWithAlias(template,alias)
:InitCoalition(coalition)
:InitCountry(country)
:InitAIOnOff(pilotcacontrol)
--:InitAIOnOff(pilotcacontrol)
:InitDelayOff()
:SpawnFromCoordinate(point)
@@ -1238,10 +1240,24 @@ function CSAR:_InitSARForPilot(_downedGroup, _GroupName, _freq, _nomessage, _pla
if not _nomessage then
if _freq ~= 0 then --shagrat
local _text = string.format("%s requests SAR at %s, beacon at %.2f KHz", _groupName, _coordinatesText, _freqk)--shagrat _groupName to prevent 'f15_Pilot_Parachute'
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
if self.coordtype ~= 2 then --not MGRS
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
else
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
local _text = string.format("%s requests SAR at %s, beacon at %.2f kilo hertz", _groupName, coordtext, _freqk)
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
end
else --shagrat CASEVAC msg
local _text = string.format("Pickup Zone at %s.", _coordinatesText )
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
if self.coordtype ~= 2 then --not MGRS
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime)
else
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,false,true)
local coordtext = UTILS.MGRSStringToSRSFriendly(_coordinatesText,true)
local _text = string.format("Pickup Zone at %s.", coordtext )
self:_DisplayToAllSAR(_text,self.coalition,self.messageTime,true,false)
end
end
end
@@ -1945,23 +1961,28 @@ end
--- (Internal) Display info to all SAR groups.
-- @param #CSAR self
-- @param #string _message Message to display.
-- @param #number _side Coalition of message.
-- @param #number _side Coalition of message.
-- @param #number _messagetime How long to show.
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime)
-- @param #boolean ToSRS If true or nil, send to SRS TTS
-- @param #boolean ToScreen If true or nil, send to Screen
function CSAR:_DisplayToAllSAR(_message, _side, _messagetime,ToSRS,ToScreen)
self:T(self.lid .. " _DisplayToAllSAR")
local messagetime = _messagetime or self.messageTime
if self.msrs then
self:T({_message,ToSRS=ToSRS,ToScreen=ToScreen})
if self.msrs and (ToSRS == true or ToSRS == nil) then
local voice = self.CSARVoice or MSRS.Voices.Google.Standard.en_GB_Standard_F
if self.msrs:GetProvider() == MSRS.Provider.WINDOWS then
voice = self.CSARVoiceMS or MSRS.Voices.Microsoft.Hedda
end
self:I("Voice = "..voice)
self:F("Voice = "..voice)
self.SRSQueue:NewTransmission(_message,duration,self.msrs,tstart,2,subgroups,subtitle,subduration,self.SRSchannel,self.SRSModulation,gender,culture,voice,volume,label,self.coordinate)
end
for _, _unitName in pairs(self.csarUnits) do
local _unit = self:_GetSARHeli(_unitName)
if _unit and not self.suppressmessages then
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
if ToScreen == true or ToScreen == nil then
for _, _unitName in pairs(self.csarUnits) do
local _unit = self:_GetSARHeli(_unitName)
if _unit and not self.suppressmessages then
self:_DisplayMessageToSAR(_unit, _message, _messagetime)
end
end
end
return self

View File

@@ -1249,11 +1249,13 @@ CTLD.UnitTypeCapabilities = {
["SH-60B"] = {type="SH-60B", crates=true, troops=true, cratelimit = 2, trooplimit = 20, length = 16, cargoweightlimit = 3500}, -- 4t cargo, 20 (unsec) seats
["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},
["OH58D"] = {type="OH58D", crates=false, troops=false, cratelimit = 0, trooplimit = 0, length = 14, cargoweightlimit = 400},
}
--- CTLD class version.
-- @field #string version
CTLD.version="1.0.51"
CTLD.version="1.0.54"
--- Instantiate a new CTLD.
-- @param #CTLD self
@@ -3607,7 +3609,7 @@ function CTLD:_MoveGroupToZone(Group)
local groupcoord = Group:GetCoordinate()
-- Get closest zone of type
local outcome, name, zone, distance = self:IsUnitInZone(Group,CTLD.CargoZoneType.MOVE)
if (distance <= self.movetroopsdistance) and zone then
if (distance <= self.movetroopsdistance) and outcome == true and zone~= nil then
-- yes, we can ;)
local groupname = Group:GetName()
local zonecoord = zone:GetRandomCoordinate(20,125) -- Core.Point#COORDINATE
@@ -4464,10 +4466,9 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
zonewidth = zoneradius
end
local distance = self:_GetDistance(zonecoord,unitcoord)
if zone:IsVec2InZone(unitVec2) and active then
self:T("Distance Zone: "..distance)
if (zone:IsVec2InZone(unitVec2) or Zonetype == CTLD.CargoZoneType.MOVE) and active == true and maxdist > distance then
outcome = true
end
if maxdist > distance then
maxdist = distance
zoneret = zone
zonenameret = zonename

View File

@@ -1078,6 +1078,13 @@ function CHIEF:SetStrategy(Strategy)
return self
end
--- Get current strategy.
-- @param #CHIEF self
-- @return #string Strategy.
function CHIEF:GetStrategy()
return self.strategy
end
--- Get defence condition.
-- @param #CHIEF self
-- @param #string Current Defence condition. See @{#CHIEF.DEFCON}, e.g. `CHIEF.DEFCON.RED`.
@@ -1456,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.
@@ -1472,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.
@@ -1499,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.
@@ -1526,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.

View File

@@ -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.

View File

@@ -62,6 +62,9 @@
-- @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 #table warnings Warnings issued to flight groups.
-- @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.
@@ -273,6 +276,7 @@ FLIGHTCONTROL = {
hpcounter = 0,
warnings = {},
nosubs = false,
Nplayers = 0,
}
--- Holding point. Contains holding stacks.
@@ -351,7 +355,7 @@ FLIGHTCONTROL.Violation={
--- FlightControl class version.
-- @field #string version
FLIGHTCONTROL.version="0.7.5"
FLIGHTCONTROL.version="0.7.7"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list
@@ -452,6 +456,16 @@ 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
-- Set SRS Port
self:SetSRSPort(port)
-- SRS for Tower.
self.msrsTower=MSRS:New(path, Frequency, Modulation)
self.msrsTower:SetPort(port)
@@ -605,6 +619,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
@@ -2242,7 +2281,7 @@ function FLIGHTCONTROL:_InitParkingSpots()
local unitname=unit and unit:GetName() or "unknown"
local isalive=unit:IsAlive()
self:T2(self.lid..string.format("FF parking spot %d is occupied by unit %s alive=%s", spot.TerminalID, unitname, tostring(isalive)))
if isalive then
@@ -4243,6 +4282,72 @@ 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
for _,_flight in pairs(self.flights) do
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
if not flight.isAI then
-- Get player element.
local playerElement=flight:GetPlayerElement()
-- Current flight status.
local flightstatus=self:GetFlightStatus(flight)
if playerElement then
-- Check if speeding while taxiing.
if (flightstatus==FLIGHTCONTROL.FlightStatus.TAXIINB or flightstatus==FLIGHTCONTROL.FlightStatus.TAXIOUT) and self.speedLimitTaxi then
-- Current speed in m/s.
local speed=playerElement.unit:GetVelocityMPS()
-- Current position.
local coord=playerElement.unit:GetCoord()
-- We do not want to check speed on runways.
local onRunway=self:IsCoordinateRunway(coord)
-- Debug output.
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=string.format("%s, slow down, you are taxiing too fast!", callsign)
-- Radio message to player.
self:TransmissionTower(text, flight)
-- Get player data.
local PlayerData=flight:_GetPlayerData()
-- Trigger FSM speeding event.
self:PlayerSpeeding(PlayerData)
end
end
end
end
end
end
-- Loop over all flights.
for _,_flight in pairs(self.flights) do
local flight=_flight --Ops.FlightGroup#FLIGHTGROUP
@@ -4749,6 +4854,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)
@@ -4815,6 +4925,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()

View File

@@ -2831,6 +2831,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()
@@ -3447,6 +3452,9 @@ function FLIGHTGROUP:onafterRefuel(From, Event, To, Coordinate)
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
--- On after "Refueled" event.
@@ -3460,6 +3468,9 @@ function FLIGHTGROUP:onafterRefueled(From, Event, To)
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)

View File

@@ -21,7 +21,7 @@
-- ===
-- @module Ops.PlayerTask
-- @image OPS_PlayerTask.jpg
-- @date Last Update Feb 2024
-- @date Last Update May 2024
do
@@ -1213,6 +1213,9 @@ do
-- AIRDEFENSE = "Airdefense",
-- SAM = "SAM",
-- GROUP = "Group",
-- ELEVATION = "\nTarget Elevation: %s %s",
-- METER = "meter",
-- FEET = "feet",
-- },
--
-- e.g.
@@ -1367,7 +1370,7 @@ PLAYERTASKCONTROLLER.Type = {
AUFTRAG.Type.PRECISIONBOMBING = "Precision Bombing"
AUFTRAG.Type.CTLD = "Combat Transport"
AUFTRAG.Type.CSAR = "Combat Rescue"
AUFTRAG.Type.CONQUER = "Conquer"
---
-- @type Scores
PLAYERTASKCONTROLLER.Scores = {
@@ -1380,7 +1383,8 @@ PLAYERTASKCONTROLLER.Scores = {
[AUFTRAG.Type.BAI] = 100,
[AUFTRAG.Type.SEAD] = 100,
[AUFTRAG.Type.BOMBING] = 100,
[AUFTRAG.Type.BOMBRUNWAY] = 100,
[AUFTRAG.Type.BOMBRUNWAY] = 100,
[AUFTRAG.Type.CONQUER] = 100,
}
---
@@ -1419,6 +1423,9 @@ PLAYERTASKCONTROLLER.Messages = {
THREATMEDIUM = "medium",
THREATLOW = "low",
THREATTEXT = "%s\nThreat: %s\nTargets left: %d\nCoord: %s",
ELEVATION = "\nTarget Elevation: %s %s",
METER = "meter",
FEET = "feet",
THREATTEXTTTS = "%s, %s. Target information for %s. Threat level %s. Targets left %d. Target location %s.",
MARKTASK = "%s, %s, copy, task %03d location marked on map!",
SMOKETASK = "%s, %s, copy, task %03d location smoked!",
@@ -1499,6 +1506,9 @@ PLAYERTASKCONTROLLER.Messages = {
THREATMEDIUM = "mittel",
THREATLOW = "niedrig",
THREATTEXT = "%s\nGefahrstufe: %s\nZiele: %d\nKoord: %s",
ELEVATION = "\nZiel Höhe: %s %s",
METER = "Meter",
FEET = "Fuss",
THREATTEXTTTS = "%s, %s. Zielinformation zu %s. Gefahrstufe %s. Ziele %d. Zielposition %s.",
MARKTASK = "%s, %s, verstanden, Zielposition %03d auf der Karte markiert!",
SMOKETASK = "%s, %s, verstanden, Zielposition %03d mit Rauch markiert!",
@@ -1561,7 +1571,7 @@ PLAYERTASKCONTROLLER.Messages = {
--- PLAYERTASK class version.
-- @field #string version
PLAYERTASKCONTROLLER.version="0.1.65"
PLAYERTASKCONTROLLER.version="0.1.66"
--- Create and run a new TASKCONTROLLER instance.
-- @param #PLAYERTASKCONTROLLER self
@@ -2113,10 +2123,12 @@ function PLAYERTASKCONTROLLER:_GetPlayerName(Client)
local ttsplayername = nil
if not self.customcallsigns[playername] then
local playergroup = Client:GetGroup()
ttsplayername = playergroup:GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations)
local newplayername = self:_GetTextForSpeech(ttsplayername)
self.customcallsigns[playername] = newplayername
ttsplayername = newplayername
if playergroup ~= nil then
ttsplayername = playergroup:GetCustomCallSign(self.ShortCallsign,self.Keepnumber,self.CallsignTranslations)
local newplayername = self:_GetTextForSpeech(ttsplayername)
self.customcallsigns[playername] = newplayername
ttsplayername = newplayername
end
else
ttsplayername = self.customcallsigns[playername]
end
@@ -3182,7 +3194,8 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
local ttsname = self.gettext:GetEntry("TASKNAMETTS",self.locale)
local taskname = string.format(tname,task.Type,task.PlayerTaskNr)
local ttstaskname = string.format(ttsname,task.TTSType,task.PlayerTaskNr)
local Coordinate = task.Target:GetCoordinate() or COORDINATE:New(0,0,0)
local Coordinate = task.Target:GetCoordinate() or COORDINATE:New(0,0,0) -- Core.Point#COORDINATE
local Elevation = Coordinate:GetLandHeight() or 0 -- meters
local CoordText = ""
local CoordTextLLDM = nil
if self.Type ~= PLAYERTASKCONTROLLER.Type.A2A then
@@ -3207,6 +3220,17 @@ function PLAYERTASKCONTROLLER:_ActiveTaskInfo(Task, Group, Client)
local ThreatGraph = "[" .. string.rep( "", ThreatLevel ) .. string.rep( "", 10 - ThreatLevel ) .. "]: "..ThreatLevel
local ThreatLocaleText = self.gettext:GetEntry("THREATTEXT",self.locale)
text = string.format(ThreatLocaleText, taskname, ThreatGraph, targets, CoordText)
local settings = _DATABASE:GetPlayerSettings(playername) or _SETTINGS -- Core.Settings#SETTINGS
local elevationmeasure = self.gettext:GetEntry("FEET",self.locale)
if settings:IsMetric() then
elevationmeasure = self.gettext:GetEntry("METER",self.locale)
--Elevation = math.floor(UTILS.MetersToFeet(Elevation))
else
Elevation = math.floor(UTILS.MetersToFeet(Elevation))
end
-- ELEVATION = "\nTarget Elevation: %s %s",
local elev = self.gettext:GetEntry("ELEVATION",self.locale)
text = text .. string.format(elev,tostring(math.floor(Elevation)),elevationmeasure)
-- Prec bombing
if task.Type == AUFTRAG.Type.PRECISIONBOMBING and self.precisionbombing then
if self.LasingDrone and self.LasingDrone.playertask then