mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
fc48473e40
@ -273,7 +273,7 @@ function CONDITION:_EvalConditionsAny(functions)
|
||||
end
|
||||
end
|
||||
|
||||
--- Create conditon fucntion object.
|
||||
--- Create conditon function object.
|
||||
-- @param #CONDITION self
|
||||
-- @param #function Function The function to call.
|
||||
-- @param ... (Optional) Parameters passed to the function (if any).
|
||||
|
||||
@ -378,6 +378,7 @@ do -- MENU_MISSION
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--- Refreshes a radio item for a mission
|
||||
-- @param #MENU_MISSION self
|
||||
-- @return #MENU_MISSION
|
||||
@ -832,6 +833,29 @@ do
|
||||
return self
|
||||
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.
|
||||
-- @param #MENU_GROUP self
|
||||
-- @param MenuStamp
|
||||
|
||||
@ -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 UnitCategories An array of unit categories of the objects to find in the zone. E.g. `{Unit.Category.GROUND_UNIT,Unit.Category.SHIP}`
|
||||
-- @usage
|
||||
-- self.Zone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
|
||||
-- local IsAttacked = self.Zone:IsSomeInZoneOfCoalition( self.Coalition )
|
||||
-- myzone:Scan({Object.Category.UNIT},{Unit.Category.GROUND_UNIT})
|
||||
-- local IsAttacked = myzone:IsSomeInZoneOfCoalition( self.Coalition )
|
||||
function ZONE_RADIUS:Scan( ObjectCategories, UnitCategories )
|
||||
|
||||
self.ScanData = {}
|
||||
|
||||
@ -1374,7 +1374,9 @@ do -- AI
|
||||
--- @type AI.Option.Ground
|
||||
-- @field #AI.Option.Ground.id id
|
||||
-- @field #AI.Option.Ground.val val
|
||||
|
||||
-- @field #AI.Option.Ground.mid mid
|
||||
-- @field #AI.Option.Ground.mval mval
|
||||
--
|
||||
--- @type AI.Option.Naval
|
||||
-- @field #AI.Option.Naval.id id
|
||||
-- @field #AI.Option.Naval.val val
|
||||
@ -1397,6 +1399,11 @@ do -- AI
|
||||
-- @field PROHIBIT_AG
|
||||
-- @field MISSILE_ATTACK
|
||||
-- @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
|
||||
-- @field LINE_ABREAST
|
||||
@ -1466,19 +1473,35 @@ do -- AI
|
||||
--- @type AI.Option.Ground.id
|
||||
-- @field NO_OPTION
|
||||
-- @field ROE @{#AI.Option.Ground.val.ROE}
|
||||
-- @field FORMATION
|
||||
-- @field DISPERSE_ON_ATTACK true or false
|
||||
-- @field ALARM_STATE @{#AI.Option.Ground.val.ALARM_STATE}
|
||||
-- @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
|
||||
-- @field #AI.Option.Ground.val.ROE ROE
|
||||
-- @field #AI.Option.Ground.val.ALARM_STATE ALARM_STATE
|
||||
-- @field #AI.Option.Ground.val.ENGAGE_TARGETS RESTRICT_TARGETS
|
||||
|
||||
--- @type AI.Option.Ground.val.ROE
|
||||
-- @field OPEN_FIRE
|
||||
-- @field RETURN_FIRE
|
||||
-- @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
|
||||
-- @field AUTO
|
||||
-- @field GREEN
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -74,6 +74,7 @@
|
||||
-- @image Designation.JPG
|
||||
--
|
||||
-- Date: 24 Oct 2021
|
||||
-- Last Update: Aug 2022
|
||||
--
|
||||
--- Class AUTOLASE
|
||||
-- @type AUTOLASE
|
||||
@ -110,7 +111,7 @@ AUTOLASE = {
|
||||
|
||||
--- AUTOLASE class version.
|
||||
-- @field #string version
|
||||
AUTOLASE.version = "0.0.12"
|
||||
AUTOLASE.version = "0.1.14"
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Begin Functional.Autolase.lua
|
||||
@ -192,6 +193,7 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
||||
self.SRSPath = ""
|
||||
self.SRSFreq = 251
|
||||
self.SRSMod = radio.modulation.AM
|
||||
self.NoMenus = false
|
||||
|
||||
-- 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")
|
||||
@ -207,14 +209,14 @@ function AUTOLASE:New(RecceSet, Coalition, Alias, PilotSet)
|
||||
self:AddTransition("*", "Cancel", "*") -- Stop Autolase
|
||||
|
||||
-- Menu Entry
|
||||
if not PilotSet then
|
||||
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
|
||||
else
|
||||
if PilotSet then
|
||||
self.usepilotset = true
|
||||
self.pilotset = PilotSet
|
||||
self:HandleEvent(EVENTS.PlayerEnterAircraft)
|
||||
self:SetPilotMenu()
|
||||
--self:SetPilotMenu()
|
||||
end
|
||||
--self.SetPilotMenu()
|
||||
|
||||
|
||||
self:SetClusterAnalysis(false, false)
|
||||
|
||||
@ -308,6 +310,10 @@ function AUTOLASE:SetPilotMenu()
|
||||
lasemenu:Refresh()
|
||||
end
|
||||
end
|
||||
else
|
||||
if not self.NoMenus then
|
||||
self.Menu = MENU_COALITION_COMMAND:New(self.coalition,"Autolase",nil,self.ShowStatus,self)
|
||||
end
|
||||
end
|
||||
return self
|
||||
end
|
||||
@ -356,12 +362,45 @@ end
|
||||
-- @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 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
|
||||
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation)
|
||||
self.useSRS = OnOff or true
|
||||
self.SRSPath = Path or "E:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||
self.SRSFreq = Frequency or 271
|
||||
self.SRSMod = Modulation or radio.modulation.AM
|
||||
function AUTOLASE:SetUsingSRS(OnOff,Path,Frequency,Modulation,Label,Gender,Culture,Port,Voice,Volume,PathToGoogleKey)
|
||||
if OnOff then
|
||||
self.useSRS = true
|
||||
self.SRSPath = Path or "C:\\Program Files\\DCS-SimpleRadio-Standalone"
|
||||
self.SRSFreq = Frequency or 271
|
||||
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
|
||||
end
|
||||
|
||||
@ -643,20 +682,7 @@ end
|
||||
-- end
|
||||
function AUTOLASE:NotifyPilotsWithSRS(Message)
|
||||
if self.useSRS then
|
||||
-- Create a SOUNDTEXT object.
|
||||
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)
|
||||
self.SRSQueue:NewTransmission(Message,nil,self.SRS,nil,2)
|
||||
end
|
||||
if self.debug then self:I(Message) end
|
||||
return self
|
||||
|
||||
@ -1412,7 +1412,7 @@ function RANGE:AddBombingTargets( targetnames, goodhitrange, randommove )
|
||||
elseif _isstatic == false then
|
||||
local _unit = UNIT:FindByName( name )
|
||||
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
|
||||
self:E( self.id .. string.format( "ERROR! Could not find bombing target %s.", name ) )
|
||||
end
|
||||
@ -2419,7 +2419,8 @@ end
|
||||
--- Start smoking a coordinate with a delay.
|
||||
-- @param #table _args Argements passed.
|
||||
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
|
||||
|
||||
--- Display top 10 stafing results of a specific player.
|
||||
@ -2447,7 +2448,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
|
||||
|
||||
-- Sort results table wrt number of hits.
|
||||
local _sort = function( a, b )
|
||||
return a.hits > b.hits
|
||||
return a.roundsHit > b.roundsHit
|
||||
end
|
||||
table.sort( _results, _sort )
|
||||
|
||||
@ -2464,7 +2465,7 @@ function RANGE:_DisplayMyStrafePitResults( _unitName )
|
||||
|
||||
-- Best result.
|
||||
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
|
||||
|
||||
-- 10 runs
|
||||
@ -2509,15 +2510,15 @@ function RANGE:_DisplayStrafePitResults( _unitName )
|
||||
-- Get the best result of the player.
|
||||
local _best = nil
|
||||
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
|
||||
end
|
||||
end
|
||||
|
||||
-- Add best result to table.
|
||||
if _best ~= nil then
|
||||
local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.hits, _best.zone.name, _best.text )
|
||||
table.insert( _playerResults, { msg = text, hits = _best.hits } )
|
||||
local text = string.format( "%s: Hits %i - %s - %s", _playerName, _best.roundsHit, _best.name, _best.roundsQuality )
|
||||
table.insert( _playerResults, { msg = text, hits = _best.roundsHit } )
|
||||
end
|
||||
|
||||
end
|
||||
@ -3543,6 +3544,7 @@ function RANGE:_DisplayMessageToGroup( _unit, _text, _time, _clear, display )
|
||||
|
||||
-- Group ID.
|
||||
local _gid = _unit:GetGroup():GetID()
|
||||
local _grp = _unit:GetGroup()
|
||||
|
||||
-- Get playername and player settings
|
||||
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.
|
||||
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
|
||||
|
||||
-- Send message to examiner.
|
||||
if self.examinergroupname ~= nil then
|
||||
local _examinerid = GROUP:FindByName( self.examinergroupname ):GetID()
|
||||
local _examinerid = GROUP:FindByName( self.examinergroupname )
|
||||
if _examinerid then
|
||||
trigger.action.outTextForGroup( _examinerid, _text, _time, _clear )
|
||||
local m = MESSAGE:New(_text,_time,nil,_clear):ToGroup(_examinerid)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -454,7 +454,7 @@ function OPERATION:GetPhaseStatus(Phase)
|
||||
return Phase.status
|
||||
end
|
||||
|
||||
--- Set codition when the given phase is over.
|
||||
--- Set condition when the given phase is over.
|
||||
-- @param #OPERATION self
|
||||
-- @param #OPERATION.Phase Phase The phase.
|
||||
-- @param Core.Condition#CONDITION Condition Condition when the phase is over.
|
||||
@ -624,7 +624,7 @@ end
|
||||
--- Count phases.
|
||||
-- @param #OPERATION self
|
||||
-- @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
|
||||
function OPERATION:CountPhases(Status, Branch)
|
||||
|
||||
@ -644,6 +644,7 @@ end
|
||||
|
||||
--- Add a new branch to the operation.
|
||||
-- @param #OPERATION self
|
||||
-- @param #string Name
|
||||
-- @return #OPERATION.Branch Branch table object.
|
||||
function OPERATION:AddBranch(Name)
|
||||
|
||||
@ -666,6 +667,7 @@ end
|
||||
--- Get name of the branch.
|
||||
-- @param #OPERATION self
|
||||
-- @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)
|
||||
Branch=Branch or self:GetBranchActive()
|
||||
if Branch then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1725,10 +1725,16 @@ end
|
||||
-- @return #number Os time in seconds.
|
||||
function UTILS.GetOSTime()
|
||||
if os then
|
||||
return os.clock()
|
||||
local ts = 0
|
||||
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
|
||||
end
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
--- Shuffle a table accoring to Fisher Yeates algorithm
|
||||
|
||||
@ -500,6 +500,9 @@ AIRBASE.MarianaIslands={
|
||||
-- * AIRBASE.SouthAtlantic.Punta_Arenas
|
||||
-- * AIRBASE.SouthAtlantic.Pampa_Guanaco
|
||||
-- * AIRBASE.SouthAtlantic.San_Julian
|
||||
-- * AIRBASE.SouthAtlantic.Puerto_Williams
|
||||
-- * AIRBASE.SouthAtlantic.Puerto_Natales
|
||||
-- * AIRBASE.SouthAtlantic.El_Calafate
|
||||
--
|
||||
--@field MarianaIslands
|
||||
AIRBASE.SouthAtlantic={
|
||||
@ -513,6 +516,9 @@ AIRBASE.SouthAtlantic={
|
||||
["Punta_Arenas"]="Punta Arenas",
|
||||
["Pampa_Guanaco"]="Pampa Guanaco",
|
||||
["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".
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user