This commit is contained in:
Applevangelist 2022-10-21 15:15:51 +02:00
parent 60927e6728
commit 1411309204
2 changed files with 22 additions and 13 deletions

View File

@ -2092,7 +2092,7 @@ function AWACS:_StartSettings(FlightGroup,Mission)
self:Started() self:Started()
elseif self.ShiftChangeAwacsRequested and self.AwacsMissionReplacement and self.AwacsMissionReplacement:GetName() == Mission:GetName() then elseif self.ShiftChangeAwacsRequested and self.AwacsMissionReplacement and self.AwacsMissionReplacement:GetName() == Mission:GetName() then
self:I("Setting up Awacs Replacement") self:T("Setting up Awacs Replacement")
-- manage AWACS Replacement -- manage AWACS Replacement
AwacsFG:SetDefaultRadio(self.Frequency,self.Modulation,false) AwacsFG:SetDefaultRadio(self.Frequency,self.Modulation,false)
AwacsFG:SwitchRadio(self.Frequency,self.Modulation) AwacsFG:SwitchRadio(self.Frequency,self.Modulation)
@ -2962,7 +2962,7 @@ end
-- @param Wrapper.Group#GROUP Group Group to use -- @param Wrapper.Group#GROUP Group Group to use
-- @return #AWACS self -- @return #AWACS self
function AWACS:_ShowAwacsInfo(Group) function AWACS:_ShowAwacsInfo(Group)
self:I(self.lid.."_ShowAwacsInfo") self:T(self.lid.."_ShowAwacsInfo")
local report = REPORT:New("Info") local report = REPORT:New("Info")
report:Add("====================") report:Add("====================")
report:Add(string.format("AWACS %s",self.callsigntxt)) report:Add(string.format("AWACS %s",self.callsigntxt))
@ -3738,7 +3738,7 @@ end
-- @param #AWACS self -- @param #AWACS self
-- @return #AWACS self -- @return #AWACS self
function AWACS:_DeleteAnchorStackFromMarker(Name,Coord) function AWACS:_DeleteAnchorStackFromMarker(Name,Coord)
self:I(self.lid.."_DeleteAnchorStackFromMarker") self:T(self.lid.."_DeleteAnchorStackFromMarker")
if self.AnchorStacks:HasUniqueID(Name) and self.PlayerStationName == Name then if self.AnchorStacks:HasUniqueID(Name) and self.PlayerStationName == Name then
local stack = self.AnchorStacks:ReadByID(Name) -- #AWACS.AnchorData local stack = self.AnchorStacks:ReadByID(Name) -- #AWACS.AnchorData
local marker = stack.AnchorMarker local marker = stack.AnchorMarker
@ -3764,7 +3764,7 @@ end
-- @param #AWACS self -- @param #AWACS self
-- @return #AWACS self -- @return #AWACS self
function AWACS:_MoveAnchorStackFromMarker(Name,Coord) function AWACS:_MoveAnchorStackFromMarker(Name,Coord)
self:I(self.lid.."_MoveAnchorStackFromMarker") self:T(self.lid.."_MoveAnchorStackFromMarker")
if self.AnchorStacks:HasUniqueID(Name) and self.PlayerStationName == Name then if self.AnchorStacks:HasUniqueID(Name) and self.PlayerStationName == Name then
local station = self.AnchorStacks:PullByID(Name) -- #AWACS.AnchorData local station = self.AnchorStacks:PullByID(Name) -- #AWACS.AnchorData
local stationtag = string.format("Station: %s\nCoordinate: %s",Name,Coord:ToStringLLDDM()) local stationtag = string.format("Station: %s\nCoordinate: %s",Name,Coord:ToStringLLDDM())
@ -3791,7 +3791,7 @@ end
-- @param #AWACS self -- @param #AWACS self
-- @return #AWACS self -- @return #AWACS self
function AWACS:_CreateAnchorStackFromMarker(Name,Coord) function AWACS:_CreateAnchorStackFromMarker(Name,Coord)
self:I(self.lid.."_CreateAnchorStackFromMarker") self:T(self.lid.."_CreateAnchorStackFromMarker")
local AnchorStackOne = {} -- #AWACS.AnchorData local AnchorStackOne = {} -- #AWACS.AnchorData
AnchorStackOne.AnchorBaseAngels = self.AnchorBaseAngels AnchorStackOne.AnchorBaseAngels = self.AnchorBaseAngels
AnchorStackOne.Anchors = FIFO:New() -- Utilities.FiFo#FIFO AnchorStackOne.Anchors = FIFO:New() -- Utilities.FiFo#FIFO
@ -5112,7 +5112,7 @@ function AWACS:_CheckAICAPOnStation()
self:_ConsistencyCheck() self:_ConsistencyCheck()
local capmissions, alert5missions, interceptmissions = self:_CleanUpAIMissionStack() local capmissions, alert5missions, interceptmissions = self:_CleanUpAIMissionStack()
self:I("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested) self:T("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested)
if self.MaxAIonCAP > 0 then if self.MaxAIonCAP > 0 then
@ -5147,7 +5147,7 @@ function AWACS:_CheckAICAPOnStation()
self.AIRequested = self.AIRequested + 1 self.AIRequested = self.AIRequested + 1
local selectedAW = AWS[(((self.AIRequested-1) % availableAWS)+1)] local selectedAW = AWS[(((self.AIRequested-1) % availableAWS)+1)]
selectedAW:AddMission(mission) selectedAW:AddMission(mission)
self:I("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested) self:T("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested)
end end
end end
@ -5693,7 +5693,7 @@ function AWACS:onafterStart(From, Event, To)
local MarkerOps = MARKEROPS_BASE:New("AWACS",{"Station","Delete","Move"}) local MarkerOps = MARKEROPS_BASE:New("AWACS",{"Station","Delete","Move"})
local function Handler(Keywords,Coord,Text) local function Handler(Keywords,Coord,Text)
self:I(Text) self:T(Text)
for _,_word in pairs (Keywords) do for _,_word in pairs (Keywords) do
if string.lower(_word) == "station" then if string.lower(_word) == "station" then
-- get the station name from the text field -- get the station name from the text field
@ -5988,7 +5988,7 @@ end
-- @param #string To -- @param #string To
-- @return #AWACS self -- @return #AWACS self
function AWACS:onafterStatus(From, Event, To) function AWACS:onafterStatus(From, Event, To)
self:I({From, Event, To}) self:T({From, Event, To})
self:_SetClientMenus() self:_SetClientMenus()
@ -6381,7 +6381,7 @@ function AWACS:onafterCheckRadioQueue(From,Event,To)
self:T({RadioEntry}) self:T({RadioEntry})
if self.clientset:CountAlive() == 0 then if self.clientset:CountAlive() == 0 then
self:I(self.lid.."No player connected.") self:T(self.lid.."No player connected.")
self:__CheckRadioQueue(-5) self:__CheckRadioQueue(-5)
return self return self
end end

View File

@ -1062,9 +1062,13 @@ end
-- @return #number Distance between the vectors. -- @return #number Distance between the vectors.
function UTILS.VecDist2D(a, b) function UTILS.VecDist2D(a, b)
local d = math.huge
if (not a) or (not b) then return d end
local c={x=b.x-a.x, y=b.y-a.y} local c={x=b.x-a.x, y=b.y-a.y}
local d=math.sqrt(c.x*c.x+c.y*c.y) d=math.sqrt(c.x*c.x+c.y*c.y)
return d return d
end end
@ -1076,9 +1080,14 @@ end
-- @return #number Distance between the vectors. -- @return #number Distance between the vectors.
function UTILS.VecDist3D(a, b) function UTILS.VecDist3D(a, b)
local d = math.huge
if (not a) or (not b) then return d end
local c={x=b.x-a.x, y=b.y-a.y, z=b.z-a.z} local c={x=b.x-a.x, y=b.y-a.y, z=b.z-a.z}
local d=math.sqrt(UTILS.VecDot(c, c)) d=math.sqrt(UTILS.VecDot(c, c))
return d return d
end end