Merge pull request #8805 from obrakmann/fix8802_enemy-unit-selection

Fix not being able to select enemy units
This commit is contained in:
Matthias Mailänder
2015-07-27 19:38:37 +02:00
2 changed files with 8 additions and 2 deletions

View File

@@ -71,7 +71,7 @@ namespace OpenRA.Mods.Common.Traits
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr) public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
{ {
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer) || self.World.FogObscures(self)) if (self.World.FogObscures(self))
yield break; yield break;
if (Info.RenderSelectionBox) if (Info.RenderSelectionBox)
@@ -80,6 +80,9 @@ namespace OpenRA.Mods.Common.Traits
if (Info.RenderSelectionBars) if (Info.RenderSelectionBars)
yield return new SelectionBarsRenderable(self); yield return new SelectionBarsRenderable(self);
if (!self.Owner.IsAlliedWith(wr.World.RenderPlayer))
yield break;
if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug) if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug)
yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green); yield return new TargetLineRenderable(ActivityTargetPath(), Color.Green);

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.RA.Traits
public class Chronoshiftable : ITick, ISync, ISelectionBar public class Chronoshiftable : ITick, ISync, ISelectionBar
{ {
readonly ChronoshiftableInfo info; readonly ChronoshiftableInfo info;
readonly Actor self;
Actor chronosphere; Actor chronosphere;
bool killCargo; bool killCargo;
int duration; int duration;
@@ -37,6 +38,7 @@ namespace OpenRA.Mods.RA.Traits
public Chronoshiftable(ActorInitializer init, ChronoshiftableInfo info) public Chronoshiftable(ActorInitializer init, ChronoshiftableInfo info)
{ {
this.info = info; this.info = info;
self = init.Self;
if (init.Contains<ChronoshiftReturnInit>()) if (init.Contains<ChronoshiftReturnInit>())
ReturnTicks = init.Get<ChronoshiftReturnInit, int>(); ReturnTicks = init.Get<ChronoshiftReturnInit, int>();
@@ -96,7 +98,8 @@ namespace OpenRA.Mods.RA.Traits
// Show the remaining time as a bar // Show the remaining time as a bar
public float GetValue() public float GetValue()
{ {
if (ReturnTicks == 0) // otherwise an empty bar is rendered all the time // otherwise an empty bar is rendered all the time
if (ReturnTicks == 0 || !self.Owner.IsAlliedWith(self.World.RenderPlayer))
return 0f; return 0f;
return (float)ReturnTicks / duration; return (float)ReturnTicks / duration;