diff --git a/OpenRA.Mods.Common/Traits/TooltipDescription.cs b/OpenRA.Mods.Common/Traits/TooltipDescription.cs index 11e6458834..74511ba667 100644 --- a/OpenRA.Mods.Common/Traits/TooltipDescription.cs +++ b/OpenRA.Mods.Common/Traits/TooltipDescription.cs @@ -30,6 +30,14 @@ namespace OpenRA.Mods.Common.Traits { readonly Actor self; + public Player Owner + { + get + { + return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner; + } + } + public TooltipDescription(Actor self, TooltipDescriptionInfo info) : base(info) { @@ -41,8 +49,11 @@ namespace OpenRA.Mods.Common.Traits if (IsTraitDisabled) return false; - var stance = forPlayer.Stances[self.Owner]; - if (!Info.ValidStances.HasStance(stance)) + // Visibility can't be determined for null owners or viewers + if (Owner == null || forPlayer == null) + return false; + + if (!Info.ValidStances.HasStance(Owner.Stances[forPlayer])) return false; return true; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs index 2fe4c750e6..55b39c9845 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/WorldTooltipLogic.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { foreach (var info in viewport.ActorTooltipExtra) { - if (info.IsTooltipVisible(world.LocalPlayer)) + if (info.IsTooltipVisible(world.RenderPlayer)) { if (index != 0) extraText += "\n";