mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Optimized the detection intervals + fixed bugs with player detection.
This commit is contained in:
parent
d3c76da7a2
commit
e770af9fc9
@ -1819,7 +1819,7 @@ do -- COORDINATE
|
||||
|
||||
--- Returns if a Coordinate is in a certain Radius of this Coordinate in 2D plane using the X and Z axis.
|
||||
-- @param #COORDINATE self
|
||||
-- @param #COORDINATE ToCoordinate The coordinate that will be tested if it is in the radius of this coordinate.
|
||||
-- @param #COORDINATE Coordinate The coordinate that will be tested if it is in the radius of this coordinate.
|
||||
-- @param #number Radius The radius of the circle on the 2D plane around this coordinate.
|
||||
-- @return #boolean true if in the Radius.
|
||||
function COORDINATE:IsInRadius( Coordinate, Radius )
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ POSITIONABLE.__.Cargo = {}
|
||||
-- @param #string PositionableName The POSITIONABLE name
|
||||
-- @return #POSITIONABLE self
|
||||
function POSITIONABLE:New( PositionableName )
|
||||
local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) )
|
||||
local self = BASE:Inherit( self, IDENTIFIABLE:New( PositionableName ) ) -- #POSITIONABLE
|
||||
|
||||
self.PositionableName = PositionableName
|
||||
return self
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user