Optimized the detection intervals + fixed bugs with player detection.

This commit is contained in:
FlightControl
2019-08-11 09:45:28 +02:00
parent d3c76da7a2
commit e770af9fc9
3 changed files with 7 additions and 5 deletions

View File

@@ -564,10 +564,12 @@ do -- DETECTION_BASE
-- Count alive(!) groups only. Solves issue #1173 https://github.com/FlightControl-Master/MOOSE/issues/1173
self.DetectionCount = self:CountAliveRecce()
local DetectionInterval = self.DetectionCount / ( self.RefreshTimeInterval - 1 )
self:ForEachAliveRecce(
function( DetectionGroup )
self:__Detection( DetectDelay, DetectionGroup, DetectionTimeStamp ) -- Process each detection asynchronously.
DetectDelay = DetectDelay + 1
DetectDelay = DetectDelay + DetectionInterval
end
)
@@ -1430,14 +1432,14 @@ do -- DETECTION_BASE
world.searchObjects( Object.Category.UNIT, SphereSearch, FindNearByFriendlies, TargetData )
DetectedItem.PlayersNearBy = nil
local DetectionZone = ZONE_UNIT:New( "DetectionPlayers", DetectedUnit, self.FriendliesRange )
_DATABASE:ForEachPlayer(
--- @param Wrapper.Unit#UNIT PlayerUnit
function( PlayerUnitName )
local PlayerUnit = UNIT:FindByName( PlayerUnitName )
if PlayerUnit and PlayerUnit:IsInZone(DetectionZone) then
if PlayerUnit and PlayerUnit:GetCoordinate():IsInRadius( DetectedUnitCoord, self.FriendliesRange ) then
--if PlayerUnit and PlayerUnit:IsInZone(DetectionZone) then
local PlayerUnitCategory = PlayerUnit:GetDesc().category