Make actors outside map borders selectable for their owner
PR #5967 only made planes not lose their selection when they strayed outside the map border. This PR makes it possible to select them when they already are outside the map. It also ensures that the selection decorations are drawn. Rank designations, however, will disappear when a unit leaves the map. Fixes #5651 for real, then.
This commit is contained in:
@@ -61,7 +61,7 @@ namespace OpenRA
|
|||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
{
|
{
|
||||||
actors.RemoveAll(a => !a.IsInWorld || (a.Owner != world.LocalPlayer && world.FogObscures(a)));
|
actors.RemoveAll(a => !a.IsInWorld || (!a.Owner.IsAlliedWith(world.LocalPlayer) && world.FogObscures(a)));
|
||||||
|
|
||||||
foreach (var cg in controlGroups.Values)
|
foreach (var cg in controlGroups.Values)
|
||||||
// note: NOT `!a.IsInWorld`, since that would remove things that are in transports.
|
// note: NOT `!a.IsInWorld`, since that would remove things that are in transports.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
|
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (self.World.FogObscures(self))
|
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) && self.World.FogObscures(self))
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
var b = self.Bounds.Value;
|
var b = self.Bounds.Value;
|
||||||
@@ -74,9 +74,6 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
IEnumerable<IRenderable> DrawPips(WorldRenderer wr, Actor self, int2 basePosition)
|
IEnumerable<IRenderable> DrawPips(WorldRenderer wr, Actor self, int2 basePosition)
|
||||||
{
|
{
|
||||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
|
||||||
yield break;
|
|
||||||
|
|
||||||
var pipSources = self.TraitsImplementing<IPips>();
|
var pipSources = self.TraitsImplementing<IPips>();
|
||||||
if (!pipSources.Any())
|
if (!pipSources.Any())
|
||||||
yield break;
|
yield break;
|
||||||
@@ -118,9 +115,6 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
IEnumerable<IRenderable> DrawTags(WorldRenderer wr, Actor self, int2 basePosition)
|
IEnumerable<IRenderable> DrawTags(WorldRenderer wr, Actor self, int2 basePosition)
|
||||||
{
|
{
|
||||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
|
||||||
yield break;
|
|
||||||
|
|
||||||
var tagImages = new Animation(self.World, "pips");
|
var tagImages = new Animation(self.World, "pips");
|
||||||
var pal = wr.Palette(Info.Palette);
|
var pal = wr.Palette(Info.Palette);
|
||||||
var tagxyOffset = new int2(0, 6);
|
var tagxyOffset = new int2(0, 6);
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ namespace OpenRA.Widgets
|
|||||||
static IEnumerable<Actor> SelectActorsInBox(World world, int2 a, int2 b, Func<Actor, bool> cond)
|
static IEnumerable<Actor> SelectActorsInBox(World world, int2 a, int2 b, Func<Actor, bool> cond)
|
||||||
{
|
{
|
||||||
return world.ScreenMap.ActorsInBox(a, b)
|
return world.ScreenMap.ActorsInBox(a, b)
|
||||||
.Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable && !world.FogObscures(x) && cond(x))
|
.Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable && (x.Owner.IsAlliedWith(world.RenderPlayer) || !world.FogObscures(x)) && cond(x))
|
||||||
.GroupBy(x => x.GetSelectionPriority())
|
.GroupBy(x => x.GetSelectionPriority())
|
||||||
.OrderByDescending(g => g.Key)
|
.OrderByDescending(g => g.Key)
|
||||||
.Select(g => g.AsEnumerable())
|
.Select(g => g.AsEnumerable())
|
||||||
|
|||||||
Reference in New Issue
Block a user