Make Range WDist for all traits with circular ranges.
This commit is contained in:
@@ -27,10 +27,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// Check if powered
|
||||
if (self.IsDisabled()) return false;
|
||||
|
||||
var isJammed = self.World.ActorsWithTrait<JamsRadar>().Any(a => a.Actor.Owner.Stances[self.Owner] != Stance.Ally
|
||||
&& (self.Location - a.Actor.Location).Length <= a.Actor.Info.TraitInfo<JamsRadarInfo>().Range);
|
||||
|
||||
return !isJammed;
|
||||
return self.World.ActorsWithTrait<JamsRadar>().All(a => a.Actor.Owner.Stances[self.Owner] == Stance.Ally
|
||||
|| (self.CenterPosition - a.Actor.CenterPosition).HorizontalLengthSquared
|
||||
> a.Actor.Info.TraitInfo<JamsRadarInfo>().Range.LengthSquared);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class JamsRadarInfo : TraitInfo<JamsRadar>
|
||||
{
|
||||
[Desc("Range for jamming.")]
|
||||
public readonly int Range = 0;
|
||||
public readonly WDist Range = WDist.Zero;
|
||||
}
|
||||
|
||||
public class JamsRadar { }
|
||||
|
||||
Reference in New Issue
Block a user