fixes #2918 cloaked units invisible to spectators
This commit is contained in:
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (remainingTime > 0)
|
if (remainingTime > 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (Cloaked && IsVisible(self))
|
if (Cloaked && IsVisible(self.World.RenderedShroud, self))
|
||||||
return r.Select(a => a.WithPalette(wr.Palette(info.Palette)));
|
return r.Select(a => a.WithPalette(wr.Palette(info.Palette)));
|
||||||
else
|
else
|
||||||
return Nothing;
|
return Nothing;
|
||||||
@@ -94,25 +94,23 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsVisible(Actor self)
|
|
||||||
{
|
|
||||||
return IsVisible(null, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsVisible(Shroud s, Actor self)
|
public bool IsVisible(Shroud s, Actor self)
|
||||||
{
|
{
|
||||||
if (self.World.LocalPlayer != null) {
|
if (!Cloaked)
|
||||||
if (s == null) {
|
return true;
|
||||||
if (!Cloaked || self.Owner == self.World.LocalPlayer ||
|
|
||||||
self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
|
if (s != null)
|
||||||
return true;
|
{
|
||||||
}
|
if (s == self.World.LocalShroud && s.Observing)
|
||||||
else {
|
return true;
|
||||||
if (!Cloaked || self.Owner == s.Owner ||
|
if (s.Owner != null)
|
||||||
self.Owner.Stances[s.Owner] == Stance.Ally)
|
if (self.Owner == s.Owner || self.Owner.Stances[s.Owner] == Stance.Ally)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.World.LocalPlayer != null)
|
||||||
|
if (self.Owner == self.World.LocalPlayer || self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
|
||||||
|
return true;
|
||||||
|
|
||||||
return self.World.ActorsWithTrait<DetectCloaked>().Any(a =>
|
return self.World.ActorsWithTrait<DetectCloaked>().Any(a =>
|
||||||
a.Actor.Owner.Stances[self.Owner] != Stance.Ally &&
|
a.Actor.Owner.Stances[self.Owner] != Stance.Ally &&
|
||||||
|
|||||||
@@ -21,8 +21,13 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public bool IsVisible(Shroud s, Actor self)
|
public bool IsVisible(Shroud s, Actor self)
|
||||||
{
|
{
|
||||||
return self.World.LocalPlayer == null ||
|
if (s != null && s.Observing)
|
||||||
self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally;
|
return true;
|
||||||
|
|
||||||
|
if (self.World.LocalPlayer != null && self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color RadarColorOverride(Actor self)
|
public Color RadarColorOverride(Actor self)
|
||||||
@@ -35,7 +40,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public IEnumerable<Renderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<Renderable> r)
|
public IEnumerable<Renderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<Renderable> r)
|
||||||
{
|
{
|
||||||
return IsVisible(self.Owner.Shroud, self) ? r : Nothing;
|
return IsVisible(self.World.RenderedShroud, self) ? r : Nothing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user