Track visibility modifiers on FrozenActors.

This commit is contained in:
Paul Chote
2018-12-10 20:44:03 +00:00
committed by Oliver Brakmann
parent 5f79c31a57
commit 224377f078
5 changed files with 42 additions and 21 deletions

View File

@@ -246,26 +246,20 @@ namespace OpenRA.Mods.Common.Widgets
}
var frozen = world.ScreenMap.FrozenActorsAtMouse(world.RenderPlayer, worldPixel)
.Where(a => a.TooltipInfo != null && a.IsValid)
.Where(a => a.TooltipInfo != null && a.IsValid && a.Visible && !a.Hidden)
.WithHighestSelectionPriority(worldPixel);
if (frozen != null)
{
var actor = frozen.Actor;
FrozenActorTooltip = frozen;
// HACK: This leaks the cloak state through the fog (cloaked buildings will not show tooltips)
if (actor == null || actor.TraitsImplementing<IVisibilityModifier>().All(t => t.IsVisible(actor, world.RenderPlayer)))
{
FrozenActorTooltip = frozen;
// HACK: This leaks the tooltip state through the fog
// This will cause issues for any downstream mods that use IProvideTooltipInfo on enemy actors
if (frozen.Actor != null)
ActorTooltipExtra = frozen.Actor.TraitsImplementing<IProvideTooltipInfo>().ToArray();
// HACK: This leaks the tooltip state through the fog
// This will cause issues for any downstream mods that use IProvideTooltipInfo on enemy actors
if (frozen.Actor != null)
ActorTooltipExtra = frozen.Actor.TraitsImplementing<IProvideTooltipInfo>().ToArray();
TooltipType = WorldTooltipType.FrozenActor;
return;
}
TooltipType = WorldTooltipType.FrozenActor;
return;
}
if (resourceLayer != null)