Fix tooltip descriptions for spectators.
This commit is contained in:
@@ -30,6 +30,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
|
|
||||||
|
public Player Owner
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return self.EffectiveOwner != null ? self.EffectiveOwner.Owner : self.Owner;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TooltipDescription(Actor self, TooltipDescriptionInfo info)
|
public TooltipDescription(Actor self, TooltipDescriptionInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
{
|
{
|
||||||
@@ -41,8 +49,11 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var stance = forPlayer.Stances[self.Owner];
|
// Visibility can't be determined for null owners or viewers
|
||||||
if (!Info.ValidStances.HasStance(stance))
|
if (Owner == null || forPlayer == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!Info.ValidStances.HasStance(Owner.Stances[forPlayer]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
foreach (var info in viewport.ActorTooltipExtra)
|
foreach (var info in viewport.ActorTooltipExtra)
|
||||||
{
|
{
|
||||||
if (info.IsTooltipVisible(world.LocalPlayer))
|
if (info.IsTooltipVisible(world.RenderPlayer))
|
||||||
{
|
{
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
extraText += "\n";
|
extraText += "\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user