diff --git a/Moose Development/Moose/Functional/Shorad.lua b/Moose Development/Moose/Functional/Shorad.lua index 82d8a1482..1dbff94f4 100644 --- a/Moose Development/Moose/Functional/Shorad.lua +++ b/Moose Development/Moose/Functional/Shorad.lua @@ -13,7 +13,7 @@ -- -- === -- --- ### Author : **applevangelist ** +-- ### Author : **applevangelist** -- -- @module Functional.Shorad -- @image Functional.Shorad.jpg @@ -94,7 +94,7 @@ SHORAD = { lid = "", DefendHarms = true, DefendMavs = true, - DefenseLowProb = 70, + DefenseLowProb = 75, DefenseHighProb = 90, UseEmOnOff = false, } diff --git a/Moose Development/Moose/Ops/ATIS.lua b/Moose Development/Moose/Ops/ATIS.lua index 368d3c488..e8b475195 100644 --- a/Moose Development/Moose/Ops/ATIS.lua +++ b/Moose Development/Moose/Ops/ATIS.lua @@ -589,7 +589,7 @@ _ATIS={} --- ATIS class version. -- @field #string version -ATIS.version="0.9.5" +ATIS.version="0.9.6" ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- TODO list @@ -1143,6 +1143,7 @@ function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port) self.msrs:SetCulture(Culture) self.msrs:SetVoice(Voice) self.msrs:SetPort(Port) + self.msrs:SetCoalition(self:GetCoalition()) if self.dTQueueCheck<=10 then self:SetQueueUpdateTime(90) end @@ -1157,6 +1158,14 @@ function ATIS:SetQueueUpdateTime(TimeInterval) self.dTQueueCheck=TimeInterval or 5 end +--- Get the coalition of the associated airbase. +-- @param #ATIS self +-- @return #number Coalition of the associcated airbase. +function ATIS:GetCoalition() + local coal=self.airbase and self.airbase:GetCoalition() or nil + return coal +end + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Start & Status ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -1203,6 +1212,10 @@ function ATIS:onafterStart(From, Event, To) -- Start radio queue. self.radioqueue:Start(1, 0.1) + + -- Handle airbase capture + -- Handle events. + self:HandleEvent(EVENTS.BaseCaptured) -- Init status updates. self:__Status(-2) @@ -2259,6 +2272,36 @@ function ATIS:onafterReport(From, Event, To, Text) end +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +-- Event Functions +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + +--- Base captured +-- @param #ATIS self +-- @param Core.Event#EVENTDATA EventData Event data. +function ATIS:OnEventBaseCaptured(EventData) + + if EventData and EventData.Place then + + -- Place is the airbase that was captured. + local airbase=EventData.Place --Wrapper.Airbase#AIRBASE + + -- Check that this airbase belongs or did belong to this warehouse. + if EventData.PlaceName==self.airbasename then + + -- New coalition of airbase after it was captured. + local NewCoalitionAirbase=airbase:GetCoalition() + + if self.useSRS and self.msrs and self.msrs.coalition~=NewCoalitionAirbase then + self.msrs:SetCoalition(NewCoalitionAirbase) + end + + end + + end + +end + ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- Misc Functions ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/Moose Development/Moose/Sound/SRS.lua b/Moose Development/Moose/Sound/SRS.lua index d4253971c..9be975a78 100644 --- a/Moose Development/Moose/Sound/SRS.lua +++ b/Moose Development/Moose/Sound/SRS.lua @@ -150,6 +150,7 @@ function MSRS:New(PathToSRS, Frequency, Modulation) self:SetFrequencies(Frequency) self:SetModulations(Modulation) self:SetGender() + self:SetCoalition() return self end @@ -207,6 +208,22 @@ function MSRS:GetPort() return self.port end +--- Set coalition. +-- @param #MSRS self +-- @param #number Coalition Coalition. Default 0. +-- @return #MSRS self +function MSRS:SetCoalition(Coalition) + self.coalition=Coalition or 0 +end + +--- Get coalition. +-- @param #MSRS self +-- @return #number Coalition. +function MSRS:GetCoalition() + return self.coalition +end + + --- Set frequencies. -- @param #MSRS self -- @param #table Frequencies Frequencies in MHz. Can also be given as a #number if only one frequency should be used.