DetectCloaked: actor should be in world

This commit is contained in:
dnqbob
2023-10-17 21:18:08 +08:00
committed by Gustas
parent feced5505a
commit c427e24360

View File

@@ -261,8 +261,8 @@ namespace OpenRA.Mods.Common.Traits
if (!Cloaked || self.Owner.IsAlliedWith(viewer))
return true;
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => a.Actor.Owner.IsAlliedWith(viewer)
&& Info.DetectionTypes.Overlaps(a.Trait.Info.DetectionTypes)
return self.World.ActorsWithTrait<DetectCloaked>().Any(a => a.Actor.IsInWorld
&& a.Actor.Owner.IsAlliedWith(viewer) && Info.DetectionTypes.Overlaps(a.Trait.Info.DetectionTypes)
&& (self.CenterPosition - a.Actor.CenterPosition).LengthSquared <= a.Trait.Range.LengthSquared);
}