mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
xxx
This commit is contained in:
parent
9eee7e8c9d
commit
42468f3505
@ -271,7 +271,7 @@ do -- CARGO_GROUP
|
|||||||
-- @param Core.Event#EVENTDATA EventData
|
-- @param Core.Event#EVENTDATA EventData
|
||||||
function CARGO_GROUP:OnEventCargoDead( EventData )
|
function CARGO_GROUP:OnEventCargoDead( EventData )
|
||||||
|
|
||||||
self:E(EventData)
|
--self:E(EventData)
|
||||||
|
|
||||||
local Destroyed = false
|
local Destroyed = false
|
||||||
|
|
||||||
|
|||||||
@ -3101,6 +3101,44 @@ do -- COORDINATE
|
|||||||
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
return "MGRS " .. UTILS.tostringMGRS( MGRS, MGRS_Accuracy )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS String
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string MGRSString MGRS String, e.g. "MGRS 37T DK 12345 12345"
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRSString( MGRSString )
|
||||||
|
local myparts = UTILS.Split(MGRSString," ")
|
||||||
|
UTILS.PrintTableToLog(myparts,1)
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = myparts[2],
|
||||||
|
MGRSDigraph = myparts[3],
|
||||||
|
Easting = tonumber(myparts[4]),
|
||||||
|
Northing = tonumber(myparts[5]),
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
return coord
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Provides a COORDINATE from an MGRS Coordinate
|
||||||
|
-- @param #COORDINATE self
|
||||||
|
-- @param #string UTMZone UTM Zone, e.g. "37T"
|
||||||
|
-- @param #string MGRSDigraph Digraph, e.g. "DK"
|
||||||
|
-- @param #number Easting Meters easting
|
||||||
|
-- @param #number Northing Meters northing
|
||||||
|
-- @return #COORDINATE self
|
||||||
|
function COORDINATE:NewFromMGRS( UTMZone, MGRSDigraph, Easting, Northing )
|
||||||
|
local MGRS = {
|
||||||
|
UTMZone = UTMZone,
|
||||||
|
MGRSDigraph = MGRSDigraph,
|
||||||
|
Easting = Easting,
|
||||||
|
Northing = Northing,
|
||||||
|
}
|
||||||
|
local lat, lon = coord.MGRStoLL(MGRS)
|
||||||
|
local point = coord.LLtoLO(lat, lon, 0)
|
||||||
|
local coord = COORDINATE:NewFromVec2({x=point.x,y=point.z})
|
||||||
|
end
|
||||||
|
|
||||||
--- Provides a coordinate string of the point, based on a coordinate format system:
|
--- Provides a coordinate string of the point, based on a coordinate format system:
|
||||||
-- * Uses default settings in COORDINATE.
|
-- * Uses default settings in COORDINATE.
|
||||||
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
-- * Can be overridden if for a GROUP containing x clients, a menu was selected to override the default.
|
||||||
|
|||||||
@ -529,6 +529,16 @@ function INTEL:SetRadarBlur(minheight,thresheight,thresblur,closing)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the accept range in kilometers from each of the recce. Only object closer than this range will be detected.
|
||||||
|
-- @param #INTEL self
|
||||||
|
-- @param #number Range Range in kilometers
|
||||||
|
-- @return #INTEL self
|
||||||
|
function INTEL:SetAcceptRange(Range)
|
||||||
|
self.RadarAcceptRange = true
|
||||||
|
self.RadarAcceptRangeKilometers = Range or 75
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Filter group categories. Valid categories are:
|
--- Filter group categories. Valid categories are:
|
||||||
--
|
--
|
||||||
-- * Group.Category.AIRPLANE
|
-- * Group.Category.AIRPLANE
|
||||||
@ -1134,37 +1144,45 @@ function INTEL:GetDetectedUnits(Unit, DetectedUnits, RecceDetecting, DetectVisua
|
|||||||
local unit=UNIT:FindByName(name)
|
local unit=UNIT:FindByName(name)
|
||||||
|
|
||||||
if unit and unit:IsAlive() then
|
if unit and unit:IsAlive() then
|
||||||
local DetectionAccepted = true
|
local DetectionAccepted = true
|
||||||
if self.RadarBlur then
|
|
||||||
local reccecoord = Unit:GetCoordinate()
|
|
||||||
local coord = unit:GetCoordinate()
|
|
||||||
local dist = math.floor(coord:Get2DDistance(reccecoord)/1000) -- km
|
|
||||||
local AGL = unit:GetAltitude(true)
|
|
||||||
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
|
||||||
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
|
||||||
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
|
||||||
--local dist = math.floor(Distance)
|
|
||||||
if dist <= self.RadarBlurClosing then
|
|
||||||
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
|
||||||
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
|
||||||
end
|
|
||||||
local fheight = math.floor(math.random(1,10000)/100)
|
|
||||||
local fblur = math.floor(math.random(1,10000)/100)
|
|
||||||
if fblur > thresblur then DetectionAccepted = false end
|
|
||||||
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
|
||||||
if self.debug or self.verbose > 1 then
|
|
||||||
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
|
||||||
MESSAGE:New("Unit "..DetectedObjectName.." is at "..math.floor(AGL).."m. Distance "..math.floor(Distance).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
|
||||||
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
|
||||||
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if DetectionAccepted then
|
if self.RadarAcceptRange then
|
||||||
DetectedUnits[name]=unit
|
local reccecoord = Unit:GetCoordinate()
|
||||||
RecceDetecting[name]=reccename
|
local coord = unit:GetCoordinate()
|
||||||
self:T(string.format("Unit %s detect by %s", name, reccename))
|
local dist = math.floor(coord:Get2DDistance(reccecoord)/1000) -- km
|
||||||
end
|
if dist > self.RadarAcceptRangeKilometers then DetectionAccepted = false end
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.RadarBlur then
|
||||||
|
local reccecoord = Unit:GetCoordinate()
|
||||||
|
local coord = unit:GetCoordinate()
|
||||||
|
local dist = math.floor(coord:Get2DDistance(reccecoord)/1000) -- km
|
||||||
|
local AGL = unit:GetAltitude(true)
|
||||||
|
local minheight = self.RadarBlurMinHeight or 250 -- meters
|
||||||
|
local thresheight = self.RadarBlurThresHeight or 90 -- 10% chance to find a low flying group
|
||||||
|
local thresblur = self.RadarBlurThresBlur or 85 -- 25% chance to escape the radar overall
|
||||||
|
--local dist = math.floor(Distance)
|
||||||
|
if dist <= self.RadarBlurClosing then
|
||||||
|
thresheight = (((dist*dist)/self.RadarBlurClosingSquare)*thresheight)
|
||||||
|
thresblur = (((dist*dist)/self.RadarBlurClosingSquare)*thresblur)
|
||||||
|
end
|
||||||
|
local fheight = math.floor(math.random(1,10000)/100)
|
||||||
|
local fblur = math.floor(math.random(1,10000)/100)
|
||||||
|
if fblur > thresblur then DetectionAccepted = false end
|
||||||
|
if AGL <= minheight and fheight < thresheight then DetectionAccepted = false end
|
||||||
|
if self.debug or self.verbose > 1 then
|
||||||
|
MESSAGE:New("Radar Blur",10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
||||||
|
MESSAGE:New("Unit "..name.." is at "..math.floor(AGL).."m. Distance "..math.floor(dist).."km.",10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
||||||
|
MESSAGE:New(string.format("fheight = %d/%d | fblur = %d/%d",fheight,thresheight,fblur,thresblur),10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
||||||
|
MESSAGE:New("Detection Accepted = "..tostring(DetectionAccepted),10):ToLogIf(self.debug):ToAllIf(self.verbose>1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if DetectionAccepted then
|
||||||
|
DetectedUnits[name]=unit
|
||||||
|
RecceDetecting[name]=reccename
|
||||||
|
self:T(string.format("Unit %s detect by %s", name, reccename))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if self.detectStatics then
|
if self.detectStatics then
|
||||||
local static=STATIC:FindByName(name, false)
|
local static=STATIC:FindByName(name, false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user