Prevent chronoshifting an empty selection

This commit is contained in:
abcdefg30
2019-10-02 12:32:24 +02:00
committed by teinarss
parent 023750db06
commit 34f4c9bdaa

View File

@@ -318,8 +318,13 @@ namespace OpenRA.Mods.Cnc.Traits
bool IsValidTarget(CPos xy)
{
// Don't teleport if there are no units in range (either all moved out of range, or none yet moved into range)
var unitsInRange = power.UnitsInRange(sourceLocation);
if (!unitsInRange.Any())
return false;
var canTeleport = false;
foreach (var unit in power.UnitsInRange(sourceLocation))
foreach (var unit in unitsInRange)
{
var targetCell = unit.Location + (xy - sourceLocation);
if (manager.Self.Owner.Shroud.IsExplored(targetCell) && unit.Trait<Chronoshiftable>().CanChronoshiftTo(unit, targetCell))