Merge branch 'develop' into FF/Ops

This commit is contained in:
Frank 2022-08-29 00:37:34 +02:00
commit fc48473e40
12 changed files with 2786 additions and 2972 deletions

View File

@ -273,7 +273,7 @@ function CONDITION:_EvalConditionsAny(functions)
end end
end end
--- Create conditon fucntion object. --- Create conditon function object.
-- @param #CONDITION self -- @param #CONDITION self
-- @param #function Function The function to call. -- @param #function Function The function to call.
-- @param ... (Optional) Parameters passed to the function (if any). -- @param ... (Optional) Parameters passed to the function (if any).

View File

@ -378,6 +378,7 @@ do -- MENU_MISSION
end end
end end
--- Refreshes a radio item for a mission --- Refreshes a radio item for a mission
-- @param #MENU_MISSION self -- @param #MENU_MISSION self
-- @return #MENU_MISSION -- @return #MENU_MISSION
@ -832,6 +833,29 @@ do
return self return self
end end
--- Refreshes a new radio item for a group and submenus, ordering by (numerical) MenuTag
-- @param #MENU_GROUP self
-- @return #MENU_GROUP
function MENU_GROUP:RefreshAndOrderByTag()
do
missionCommands.removeItemForGroup( self.GroupID, self.MenuPath )
missionCommands.addSubMenuForGroup( self.GroupID, self.MenuText, self.MenuParentPath )
local MenuTable = {}
for MenuText, Menu in pairs( self.Menus or {} ) do
local tag = Menu.MenuTag or math.random(1,10000)
MenuTable[#MenuTable+1] = {Tag=tag, Enty=Menu}
end
table.sort(MenuTable, function (k1, k2) return k1.tag < k2.tag end )
for _, Menu in pairs( MenuTable ) do
Menu.Entry:Refresh()
end
end
return self
end
--- Removes the sub menus recursively of this MENU_GROUP. --- Removes the sub menus recursively of this MENU_GROUP.
-- @param #MENU_GROUP self -- @param #MENU_GROUP self
-- @param MenuStamp -- @param MenuStamp

View File

@ -899,8 +899,8 @@ end
-- @param ObjectCategories An array of categories of the objects to find in the zone. E.g. `{Object.Category.UNIT}` -- @param ObjectCategories An array of categories of the objects to find in the zone. E.g. `{Object.Category.UNIT}`
-- @param UnitCategories An array of unit categories of the objects to find in the zone. E.g. `{Unit.Category.GROUND_UNIT,Unit.Category.SHIP}` -- @param UnitCategories An array of unit categories of the objects to find in the zone. E.g. `{Unit.Category.GROUND_UNIT,Unit.Category.SHIP}`
-- @usage -- @usage
-- self.Zone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT}) -- myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
-- local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition ) -- local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories ) function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
self.ScanData = {} self.ScanData = {}

View File

@ -1374,7 +1374,9 @@ do -- AI
--- @type AI.Option.Ground --- @type AI.Option.Ground
-- @field #AI.Option.Ground.id id -- @field #AI.Option.Ground.id id
-- @field #AI.Option.Ground.val val -- @field #AI.Option.Ground.val val
-- @field #AI.Option.Ground.mid mid
-- @field #AI.Option.Ground.mval mval
--
--- @type AI.Option.Naval --- @type AI.Option.Naval
-- @field #AI.Option.Naval.id id -- @field #AI.Option.Naval.id id
-- @field #AI.Option.Naval.val val -- @field #AI.Option.Naval.val val
@ -1397,6 +1399,11 @@ do -- AI
-- @field PROHIBIT_AG -- @field PROHIBIT_AG
-- @field MISSILE_ATTACK -- @field MISSILE_ATTACK
-- @field PROHIBIT_WP_PASS_REPORT -- @field PROHIBIT_WP_PASS_REPORT
-- @field OPTION_RADIO_USAGE_CONTACT
-- @field OPTION_RADIO_USAGE_ENGAGE
-- @field OPTION_RADIO_USAGE_KILL
-- @field JETT_TANKS_IF_EMPTY
-- @field FORCED_ATTACK
--- @type AI.Option.Air.id.FORMATION --- @type AI.Option.Air.id.FORMATION
-- @field LINE_ABREAST -- @field LINE_ABREAST
@ -1466,19 +1473,35 @@ do -- AI
--- @type AI.Option.Ground.id --- @type AI.Option.Ground.id
-- @field NO_OPTION -- @field NO_OPTION
-- @field ROE @{#AI.Option.Ground.val.ROE} -- @field ROE @{#AI.Option.Ground.val.ROE}
-- @field FORMATION
-- @field DISPERSE_ON_ATTACK true or false -- @field DISPERSE_ON_ATTACK true or false
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE} -- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
-- @field ENGAGE_AIR_WEAPONS -- @field ENGAGE_AIR_WEAPONS
-- @field AC_ENGAGEMENT_RANGE_RESTRICTION
--- @type AI.Option.Ground.mid -- Moose added
-- @field RESTRICT_AAA_MIN 27
-- @field RESTRICT_AAA_MAX 29
-- @field RESTRICT_TARGETS @{#AI.Option.Ground.mval.ENGAGE_TARGETS} 28
--- @type AI.Option.Ground.val --- @type AI.Option.Ground.val
-- @field #AI.Option.Ground.val.ROE ROE -- @field #AI.Option.Ground.val.ROE ROE
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE -- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
--- @type AI.Option.Ground.val.ROE --- @type AI.Option.Ground.val.ROE
-- @field OPEN_FIRE -- @field OPEN_FIRE
-- @field RETURN_FIRE -- @field RETURN_FIRE
-- @field WEAPON_HOLD -- @field WEAPON_HOLD
--- @type AI.Option.Ground.mval -- Moose added
-- @field #AI.Option.Ground.mval.ENGAGE_TARGETS ENGAGE_TARGETS
--- @type AI.Option.Ground.mval.ENGAGE_TARGETS -- Moose added
-- @field ANY_TARGET -- 0
-- @field AIR_UNITS_ONLY -- 1
-- @field GROUND_UNITS_ONLY -- 2
--- @type AI.Option.Ground.val.ALARM_STATE --- @type AI.Option.Ground.val.ALARM_STATE
-- @field AUTO -- @field AUTO
-- @field GREEN -- @field GREEN

File diff suppressed because it is too large Load Diff

View File

@ -74,6 +74,7 @@
-- @image Designation.JPG -- @image Designation.JPG
-- --
-- Date: 24 Oct 2021 -- Date: 24 Oct 2021
-- Last Update: Aug 2022
-- --
--- Class AUTOLASE --- Class AUTOLASE
-- @type AUTOLASE -- @type AUTOLASE
@ -110,7 +111,7 @@ AUTOLASE = {
--- AUTOLASE class version. --- AUTOLASE class version.
-- @field #string version -- @field #string version
AUTOLASE.version = "0.0.12" AUTOLASE.version = "0.1.14"
------------------------------------------------------------------- -------------------------------------------------------------------
-- Begin Functional.Autolase.lua -- Begin Functional.Autolase.lua
@ -192,6 +193,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self.SRSPath = "" self.SRSPath = ""
self.SRSFreq = 251 self.SRSFreq = 251
self.SRSMod = radio.modulation.AM self.SRSMod = radio.modulation.AM
self.NoMenus = false
-- Set some string id for output to DCS.log file. -- Set some string id for output to DCS.log file.
self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown") self.lid=string.format("AUTOLASE %s (%s) | ", self.alias, self.coalition and UTILS.GetCoalitionName(self.coalition) or "unknown")
@ -207,14 +209,14 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
self:AddTransition("*", "Cancel", "*") -- Stop Autolase self:AddTransition("*", "Cancel", "*") -- Stop Autolase
-- Menu Entry -- Menu Entry
if not PilotSet then if PilotSet then
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
else
self.usepilotset = true self.usepilotset = true
self.pilotset = PilotSet self.pilotset = PilotSet
self:HandleEvent(EVENTS.PlayerEnterAircraft) self:HandleEvent(EVENTS.PlayerEnterAircraft)
self:SetPilotMenu() --self:SetPilotMenu()
end end
--self.SetPilotMenu()
self:SetClusterAnalysis(false, false) self:SetClusterAnalysis(false, false)
@ -308,6 +310,10 @@ function AUTOLASE:SetPilotMenu()
lasemenu:Refresh() lasemenu:Refresh()
end end
end end
else
if not self.NoMenus then
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
end
end end
return self return self
end end
@ -356,12 +362,45 @@ end
-- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalon -- @param #string Path Path to SRS directory, e.g. C:\\Program Files\\DCS-SimpleRadio-Standalon
-- @param #number Frequency Frequency to send, e.g. 243 -- @param #number Frequency Frequency to send, e.g. 243
-- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM -- @param #number Modulation Modulation i.e. radio.modulation.AM or radio.modulation.FM
-- @param #string Label (Optional) Short label to be used on the SRS Client Overlay
-- @param #string Gender (Optional) Defaults to "male"
-- @param #string Culture (Optional) Defaults to "en-US"
-- @param #number Port (Optional) Defaults to 5002
-- @param #string Voice (Optional) Use a specifc voice with the @{Sound.SRS.SetVoice} function, e.g, `:SetVoice("Microsoft Hedda Desktop")`.
-- Note that this must be installed on your windows system. Can also be Google voice types, if you are using Google TTS.
-- @param #number Volume (Optional) Volume - between 0.0 (silent) and 1.0 (loudest)
-- @param #string PathToGoogleKey (Optional) Path to your google key if you want to use google TTS
-- @return #AUTOLASE self -- @return #AUTOLASE self
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation) function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
self.useSRS = OnOff or true if OnOff then
self.SRSPath = Path or "E:\\Program Files\\DCS-SimpleRadio-Standalone" self.useSRS = true
self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
self.SRSFreq = Frequency or 271 self.SRSFreq = Frequency or 271
self.SRSMod = Modulation or radio.modulation.AM self.SRSMod = Modulation or radio.modulation.AM
self.Gender = Gender or "male"
self.Culture = Culture or "en-US"
self.Port = Port or 5002
self.Voice = Voice
self.PathToGoogleKey = PathToGoogleKey
self.Volume = Volume or 1.0
self.Label = Label
-- set up SRS
self.SRS = MSRS:New(self.SRSPath,self.SRSFreq,self.SRSMod,self.Volume)
self.SRS:SetCoalition(self.coalition)
self.SRS:SetLabel(self.MenuName or self.Name)
self.SRS:SetGender(self.Gender)
self.SRS:SetCulture(self.Culture)
self.SRS:SetPort(self.Port)
self.SRS:SetVoice(self.Voice)
if self.PathToGoogleKey then
self.SRS:SetGoogle(self.PathToGoogleKey)
end
self.SRSQueue = MSRSQUEUE:New(self.alias)
else
self.useSRS = false
self.SRS= nil
self.SRSQueue = nil
end
return self return self
end end
@ -643,20 +682,7 @@ end
-- end -- end
function AUTOLASE:NotifyPilotsWithSRS(Message) function AUTOLASE:NotifyPilotsWithSRS(Message)
if self.useSRS then if self.useSRS then
-- Create a SOUNDTEXT object. self.SRSQueue:NewTransmission(Message,nil,self.SRS,nil,2)
if self.debug then
BASE:TraceOn()
BASE:TraceClass("SOUNDTEXT")
BASE:TraceClass("MSRS")
end
local path = self.SRSPath or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
local freq = self.SRSFreq or 271
local mod = self.SRSMod or radio.modulation.AM
local text=SOUNDTEXT:New(Message)
-- MOOSE SRS
local msrs=MSRS:New(path, freq, mod)
-- Text-to speech with default voice after 2 seconds.
msrs:PlaySoundText(text, 2)
end end
if self.debug then self:I(Message) end if self.debug then self:I(Message) end
return self return self

View File

@ -1412,7 +1412,7 @@ function RANGE:AddBombingTargets( targetnames, goodhitrange, randommove )
elseif _isstatic == false then elseif _isstatic == false then
local _unit = UNIT:FindByName( name ) local _unit = UNIT:FindByName( name )
self:T2( self.id .. string.format( "Adding unit bombing target %s with hit range %d.", name, goodhitrange, randommove ) ) self:T2( self.id .. string.format( "Adding unit bombing target %s with hit range %d.", name, goodhitrange, randommove ) )
self:AddBombingTargetUnit( _unit, goodhitrange ) self:AddBombingTargetUnit( _unit, goodhitrange, randommove )
else else
self:E( self.id .. string.format( "ERROR! Could not find bombing target %s.", name ) ) self:E( self.id .. string.format( "ERROR! Could not find bombing target %s.", name ) )
end end
@ -2419,7 +2419,8 @@ end
--- Start smoking a coordinate with a delay. --- Start smoking a coordinate with a delay.
-- @param #table _args Argements passed. -- @param #table _args Argements passed.
function RANGE._DelayedSmoke( _args ) function RANGE._DelayedSmoke( _args )
trigger.action.smoke( _args.coord:GetVec3(), _args.color ) _args.coord:Smoke(_args.color)
--trigger.action.smoke( _args.coord:GetVec3(), _args.color )
end end
--- Display top 10 stafing results of a specific player. --- Display top 10 stafing results of a specific player.
@ -2447,7 +2448,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
-- Sort results table wrt number of hits. -- Sort results table wrt number of hits.
local _sort = function( a, b ) local _sort = function( a, b )
return a.hits > b.hits return a.roundsHit > b.roundsHit
end end
table.sort( _results, _sort ) table.sort( _results, _sort )
@ -2464,7 +2465,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
-- Best result. -- Best result.
if _bestMsg == "" then if _bestMsg == "" then
_bestMsg = string.format( "Hits %d - %s - %s", _result.hits, _result.zone.name, _result.text ) _bestMsg = string.format( "Hits %d - %s - %s", result.roundsHit, result.name, result.roundsQuality)
end end
-- 10 runs -- 10 runs
@ -2509,15 +2510,15 @@ function RANGE:_DisplayStrafePitResults( _unitName )
-- Get the best result of the player. -- Get the best result of the player.
local _best = nil local _best = nil
for _, _result in pairs( _results ) do for _, _result in pairs( _results ) do
if _best == nil or _result.hits > _best.hits then if _best == nil or _result.roundsHit > _best.roundsHit then
_best = _result _best = _result
end end
end end
-- Add best result to table. -- Add best result to table.
if _best ~= nil then if _best ~= nil then
local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.hits, _best.zone.name, _best.text ) local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.roundsHit, _best.name, _best.roundsQuality )
table.insert( _playerResults, { msg = text, hits = _best.hits } ) table.insert( _playerResults, { msg = text, hits = _best.roundsHit } )
end end
end end
@ -3543,6 +3544,7 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
-- Group ID. -- Group ID.
local _gid = _unit:GetGroup():GetID() local _gid = _unit:GetGroup():GetID()
local _grp = _unit:GetGroup()
-- Get playername and player settings -- Get playername and player settings
local _, playername = self:_GetPlayerUnitAndName( _unit:GetName() ) local _, playername = self:_GetPlayerUnitAndName( _unit:GetName() )
@ -3550,14 +3552,14 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
-- Send message to player if messages enabled and not only for the examiner. -- Send message to player if messages enabled and not only for the examiner.
if _gid and (playermessage == true or display) and (not self.examinerexclusive) then if _gid and (playermessage == true or display) and (not self.examinerexclusive) then
trigger.action.outTextForGroup( _gid, _text, _time, _clear ) local m = MESSAGE:New(_text,_time,nil,_clear):ToUnit(_unit)
end end
-- Send message to examiner. -- Send message to examiner.
if self.examinergroupname ~= nil then if self.examinergroupname ~= nil then
local _examinerid = GROUP:FindByName( self.examinergroupname ):GetID() local _examinerid = GROUP:FindByName( self.examinergroupname )
if _examinerid then if _examinerid then
trigger.action.outTextForGroup( _examinerid, _text, _time, _clear ) local m = MESSAGE:New(_text,_time,nil,_clear):ToGroup(_examinerid)
end end
end end
end end

File diff suppressed because it is too large Load Diff

View File

@ -454,7 +454,7 @@ function OPERATION:GetPhaseStatus(Phase)
return Phase.status return Phase.status
end end
--- Set codition when the given phase is over. --- Set condition when the given phase is over.
-- @param #OPERATION self -- @param #OPERATION self
-- @param #OPERATION.Phase Phase The phase. -- @param #OPERATION.Phase Phase The phase.
-- @param Core.Condition#CONDITION Condition Condition when the phase is over. -- @param Core.Condition#CONDITION Condition Condition when the phase is over.
@ -624,7 +624,7 @@ end
--- Count phases. --- Count phases.
-- @param #OPERATION self -- @param #OPERATION self
-- @param #string Status (Optional) Only count phases in a certain status, e.g. `OPERATION.PhaseStatus.PLANNED`. -- @param #string Status (Optional) Only count phases in a certain status, e.g. `OPERATION.PhaseStatus.PLANNED`.
-- @param #OPERATION.Branch (Optional) Branch. -- @param #OPERATION.Branch Branch (Optional) Branch.
-- @return #number Number of phases -- @return #number Number of phases
function OPERATION:CountPhases(Status, Branch) function OPERATION:CountPhases(Status, Branch)
@ -644,6 +644,7 @@ end
--- Add a new branch to the operation. --- Add a new branch to the operation.
-- @param #OPERATION self -- @param #OPERATION self
-- @param #string Name
-- @return #OPERATION.Branch Branch table object. -- @return #OPERATION.Branch Branch table object.
function OPERATION:AddBranch(Name) function OPERATION:AddBranch(Name)
@ -666,6 +667,7 @@ end
--- Get name of the branch. --- Get name of the branch.
-- @param #OPERATION self -- @param #OPERATION self
-- @param #OPERATION.Branch Branch The branch of which the name is requested. Default is the currently active or master branch. -- @param #OPERATION.Branch Branch The branch of which the name is requested. Default is the currently active or master branch.
-- @return #string Name Name or "None"
function OPERATION:GetBranchName(Branch) function OPERATION:GetBranchName(Branch)
Branch=Branch or self:GetBranchActive() Branch=Branch or self:GetBranchActive()
if Branch then if Branch then

File diff suppressed because it is too large Load Diff

View File

@ -1725,11 +1725,17 @@ end
-- @return #number Os time in seconds. -- @return #number Os time in seconds.
function UTILS.GetOSTime() function UTILS.GetOSTime()
if os then if os then
return os.clock() local ts = 0
end local t = os.date("*t")
local s = t.sec
local m = t.min * 60
local h = t.hour * 3600
ts = s+m+h
return ts
else
return nil return nil
end end
end
--- Shuffle a table accoring to Fisher Yeates algorithm --- Shuffle a table accoring to Fisher Yeates algorithm
--@param #table t Table to be shuffled. --@param #table t Table to be shuffled.

View File

@ -500,6 +500,9 @@ AIRBASE.MarianaIslands={
-- * AIRBASE.SouthAtlantic.Punta_Arenas -- * AIRBASE.SouthAtlantic.Punta_Arenas
-- * AIRBASE.SouthAtlantic.Pampa_Guanaco -- * AIRBASE.SouthAtlantic.Pampa_Guanaco
-- * AIRBASE.SouthAtlantic.San_Julian -- * AIRBASE.SouthAtlantic.San_Julian
-- * AIRBASE.SouthAtlantic.Puerto_Williams
-- * AIRBASE.SouthAtlantic.Puerto_Natales
-- * AIRBASE.SouthAtlantic.El_Calafate
-- --
--@field MarianaIslands --@field MarianaIslands
AIRBASE.SouthAtlantic={ AIRBASE.SouthAtlantic={
@ -513,6 +516,9 @@ AIRBASE.SouthAtlantic={
["Punta_Arenas"]="Punta Arenas", ["Punta_Arenas"]="Punta Arenas",
["Pampa_Guanaco"]="Pampa Guanaco", ["Pampa_Guanaco"]="Pampa Guanaco",
["San_Julian"]="San Julian", ["San_Julian"]="San Julian",
["Puerto_Williams"]="Puerto Williams",
["Puerto_Natales"]="Puerto Natales",
["El_Calafate"]="El Calafate",
} }
--- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy". --- AIRBASE.ParkingSpot ".Coordinate, ".TerminalID", ".TerminalType", ".TOAC", ".Free", ".TerminalID0", ".DistToRwy".