mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
ATIS
- ATIS MSRS uses coalition of airbase - update coalition if base was captured
This commit is contained in:
parent
77a3c7369d
commit
0e8732fd44
@ -589,7 +589,7 @@ _ATIS={}
|
|||||||
|
|
||||||
--- ATIS class version.
|
--- ATIS class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
ATIS.version="0.9.5"
|
ATIS.version="0.9.6"
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
-- TODO list
|
-- TODO list
|
||||||
@ -1143,6 +1143,7 @@ function ATIS:SetSRS(PathToSRS, Gender, Culture, Voice, Port)
|
|||||||
self.msrs:SetCulture(Culture)
|
self.msrs:SetCulture(Culture)
|
||||||
self.msrs:SetVoice(Voice)
|
self.msrs:SetVoice(Voice)
|
||||||
self.msrs:SetPort(Port)
|
self.msrs:SetPort(Port)
|
||||||
|
self.msrs:SetCoalition(self:GetCoalition())
|
||||||
if self.dTQueueCheck<=10 then
|
if self.dTQueueCheck<=10 then
|
||||||
self:SetQueueUpdateTime(90)
|
self:SetQueueUpdateTime(90)
|
||||||
end
|
end
|
||||||
@ -1157,6 +1158,14 @@ function ATIS:SetQueueUpdateTime(TimeInterval)
|
|||||||
self.dTQueueCheck=TimeInterval or 5
|
self.dTQueueCheck=TimeInterval or 5
|
||||||
end
|
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
|
-- Start & Status
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -1203,6 +1212,10 @@ function ATIS:onafterStart(From, Event, To)
|
|||||||
|
|
||||||
-- Start radio queue.
|
-- Start radio queue.
|
||||||
self.radioqueue:Start(1, 0.1)
|
self.radioqueue:Start(1, 0.1)
|
||||||
|
|
||||||
|
-- Handle airbase capture
|
||||||
|
-- Handle events.
|
||||||
|
self:HandleEvent(EVENTS.BaseCaptured)
|
||||||
|
|
||||||
-- Init status updates.
|
-- Init status updates.
|
||||||
self:__Status(-2)
|
self:__Status(-2)
|
||||||
@ -2259,6 +2272,36 @@ function ATIS:onafterReport(From, Event, To, Text)
|
|||||||
|
|
||||||
end
|
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
|
-- Misc Functions
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -150,6 +150,7 @@ function MSRS:New(PathToSRS, Frequency, Modulation)
|
|||||||
self:SetFrequencies(Frequency)
|
self:SetFrequencies(Frequency)
|
||||||
self:SetModulations(Modulation)
|
self:SetModulations(Modulation)
|
||||||
self:SetGender()
|
self:SetGender()
|
||||||
|
self:SetCoalition()
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -207,6 +208,22 @@ function MSRS:GetPort()
|
|||||||
return self.port
|
return self.port
|
||||||
end
|
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.
|
--- Set frequencies.
|
||||||
-- @param #MSRS self
|
-- @param #MSRS self
|
||||||
-- @param #table Frequencies Frequencies in MHz. Can also be given as a #number if only one frequency should be used.
|
-- @param #table Frequencies Frequencies in MHz. Can also be given as a #number if only one frequency should be used.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user