Fix tooltips not showing for frozen actors with dead backing actors.

This also documents some old bugs.
This commit is contained in:
Paul Chote
2018-01-01 11:50:03 +00:00
committed by ltem
parent 19a9c70d5c
commit 47fa9e496d

View File

@@ -252,11 +252,17 @@ namespace OpenRA.Mods.Common.Widgets
if (frozen != null) if (frozen != null)
{ {
var actor = frozen.Actor; var actor = frozen.Actor;
if (actor != null && actor.TraitsImplementing<IVisibilityModifier>().All(t => t.IsVisible(actor, world.RenderPlayer)))
// 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; 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) if (frozen.Actor != null)
ActorTooltipExtra = frozen.Actor.TraitsImplementing<IProvideTooltipInfo>().ToArray(); ActorTooltipExtra = frozen.Actor.TraitsImplementing<IProvideTooltipInfo>().ToArray();
TooltipType = WorldTooltipType.FrozenActor; TooltipType = WorldTooltipType.FrozenActor;
return; return;
} }