diff --git a/Moose Development/Moose/Ops/Awacs.lua b/Moose Development/Moose/Ops/Awacs.lua index 81c850308..e9de1b9b4 100644 --- a/Moose Development/Moose/Ops/Awacs.lua +++ b/Moose Development/Moose/Ops/Awacs.lua @@ -2092,7 +2092,7 @@ function AWACS:_StartSettings(FlightGroup,Mission) self:Started() 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 AwacsFG:SetDefaultRadio(self.Frequency,self.Modulation,false) AwacsFG:SwitchRadio(self.Frequency,self.Modulation) @@ -2962,7 +2962,7 @@ end -- @param Wrapper.Group#GROUP Group Group to use -- @return #AWACS self function AWACS:_ShowAwacsInfo(Group) - self:I(self.lid.."_ShowAwacsInfo") + self:T(self.lid.."_ShowAwacsInfo") local report = REPORT:New("Info") report:Add("====================") report:Add(string.format("AWACS %s",self.callsigntxt)) @@ -3738,7 +3738,7 @@ end -- @param #AWACS self -- @return #AWACS self 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 local stack = self.AnchorStacks:ReadByID(Name) -- #AWACS.AnchorData local marker = stack.AnchorMarker @@ -3764,7 +3764,7 @@ end -- @param #AWACS self -- @return #AWACS self 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 local station = self.AnchorStacks:PullByID(Name) -- #AWACS.AnchorData local stationtag = string.format("Station: %s\nCoordinate: %s",Name,Coord:ToStringLLDDM()) @@ -3791,7 +3791,7 @@ end -- @param #AWACS self -- @return #AWACS self function AWACS:_CreateAnchorStackFromMarker(Name,Coord) - self:I(self.lid.."_CreateAnchorStackFromMarker") + self:T(self.lid.."_CreateAnchorStackFromMarker") local AnchorStackOne = {} -- #AWACS.AnchorData AnchorStackOne.AnchorBaseAngels = self.AnchorBaseAngels AnchorStackOne.Anchors = FIFO:New() -- Utilities.FiFo#FIFO @@ -5112,7 +5112,7 @@ function AWACS:_CheckAICAPOnStation() self:_ConsistencyCheck() 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 @@ -5147,7 +5147,7 @@ function AWACS:_CheckAICAPOnStation() self.AIRequested = self.AIRequested + 1 local selectedAW = AWS[(((self.AIRequested-1) % availableAWS)+1)] selectedAW:AddMission(mission) - self:I("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested) + self:T("CAP="..capmissions.." ALERT5="..alert5missions.." Requested="..self.AIRequested) end end @@ -5693,7 +5693,7 @@ function AWACS:onafterStart(From, Event, To) local MarkerOps = MARKEROPS_BASE:New("AWACS",{"Station","Delete","Move"}) local function Handler(Keywords,Coord,Text) - self:I(Text) + self:T(Text) for _,_word in pairs (Keywords) do if string.lower(_word) == "station" then -- get the station name from the text field @@ -5988,7 +5988,7 @@ end -- @param #string To -- @return #AWACS self function AWACS:onafterStatus(From, Event, To) - self:I({From, Event, To}) + self:T({From, Event, To}) self:_SetClientMenus() @@ -6381,7 +6381,7 @@ function AWACS:onafterCheckRadioQueue(From,Event,To) self:T({RadioEntry}) if self.clientset:CountAlive() == 0 then - self:I(self.lid.."No player connected.") + self:T(self.lid.."No player connected.") self:__CheckRadioQueue(-5) return self end diff --git a/Moose Development/Moose/Utilities/Utils.lua b/Moose Development/Moose/Utilities/Utils.lua index 9f9a3e1aa..163d0f34a 100644 --- a/Moose Development/Moose/Utilities/Utils.lua +++ b/Moose Development/Moose/Utilities/Utils.lua @@ -1062,9 +1062,13 @@ end -- @return #number Distance between the vectors. 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 d=math.sqrt(c.x*c.x+c.y*c.y) + d=math.sqrt(c.x*c.x+c.y*c.y) return d end @@ -1075,10 +1079,15 @@ end -- @param DCS#Vec3 b Vector in 3D with x, y, z components. -- @return #number Distance between the vectors. 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 d=math.sqrt(UTILS.VecDot(c, c)) + d=math.sqrt(UTILS.VecDot(c, c)) return d end