Skip to content

Commit

Permalink
DetectCloaked: actor should be in world
Browse files Browse the repository at this point in the history
  • Loading branch information
dnqbob authored and PunkPun committed Oct 17, 2023
1 parent feced55 commit c427e24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions OpenRA.Mods.Common/Traits/Cloak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ public bool IsVisible(Actor self, Player viewer)
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);
}

Expand Down

0 comments on commit c427e24

Please sign in to comment.