Fix Positions returned by FrozenActor targets.

Also removes redundant Targetables check from actors.
This commit is contained in:
Paul Chote
2019-01-31 20:32:08 +00:00
committed by Oliver Brakmann
parent 31f4b0a5c4
commit 5995915281
2 changed files with 3 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ namespace OpenRA.Traits
public Player Owner { get; private set; } public Player Owner { get; private set; }
public BitSet<TargetableType> TargetTypes { get; private set; } public BitSet<TargetableType> TargetTypes { get; private set; }
public WPos[] TargetablePositions { get; private set; }
public ITooltipInfo TooltipInfo { get; private set; } public ITooltipInfo TooltipInfo { get; private set; }
public Player TooltipOwner { get; private set; } public Player TooltipOwner { get; private set; }
@@ -118,6 +119,7 @@ namespace OpenRA.Traits
{ {
Owner = actor.Owner; Owner = actor.Owner;
TargetTypes = actor.GetEnabledTargetTypes(); TargetTypes = actor.GetEnabledTargetTypes();
TargetablePositions = actor.GetTargetablePositions().ToArray();
Hidden = !actor.CanBeViewedByPlayer(viewer); Hidden = !actor.CanBeViewedByPlayer(viewer);
if (health != null) if (health != null)

View File

@@ -183,12 +183,9 @@ namespace OpenRA.Traits
switch (Type) switch (Type)
{ {
case TargetType.Actor: case TargetType.Actor:
if (!actor.Targetables.Any(Exts.IsTraitEnabled))
return new[] { actor.CenterPosition };
return actor.GetTargetablePositions(); return actor.GetTargetablePositions();
case TargetType.FrozenActor: case TargetType.FrozenActor:
return new[] { frozen.CenterPosition }; return frozen.TargetablePositions;
case TargetType.Terrain: case TargetType.Terrain:
return terrainPositions; return terrainPositions;
default: default: