Convert support powers from actor disabled to pausable-conditional.

This commit is contained in:
atlimit8
2017-03-16 22:28:43 -05:00
parent 9a1ba31753
commit 431f06cd49
11 changed files with 29 additions and 18 deletions

View File

@@ -88,7 +88,7 @@ namespace OpenRA.Mods.Cnc.Traits
var pos = world.Map.CenterOfCell(cell);
var range = attack.GetMaximumRange().LengthSquared;
return instance.Instances.Where(i => !i.Self.IsDisabled()).MinByOrDefault(a => (a.Self.CenterPosition - pos).HorizontalLengthSquared).Self;
return instance.Instances.Where(i => !i.IsTraitPaused).MinByOrDefault(a => (a.Self.CenterPosition - pos).HorizontalLengthSquared).Self;
}
bool IsValidTarget(World world, CPos cell)
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Cnc.Traits
var pos = world.Map.CenterOfCell(cell);
var range = attack.GetMaximumRange().LengthSquared;
return world.Map.Contains(cell) && instance.Instances.Any(a => !a.Self.IsDisabled() && (a.Self.CenterPosition - pos).HorizontalLengthSquared < range);
return world.Map.Contains(cell) && instance.Instances.Any(a => !a.IsTraitPaused && (a.Self.CenterPosition - pos).HorizontalLengthSquared < range);
}
IEnumerable<Order> IOrderGenerator.Order(World world, CPos cell, int2 worldPixel, MouseInput mi)
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Cnc.Traits
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world)
{
foreach (var a in instance.Instances.Where(i => !i.Self.IsDisabled()))
foreach (var a in instance.Instances.Where(i => !i.IsTraitPaused))
{
yield return new RangeCircleRenderable(
a.Self.CenterPosition,

View File

@@ -101,18 +101,18 @@ namespace OpenRA.Mods.Cnc.Traits
}
bool NoActiveRadar { get { return !self.World.ActorsHavingTrait<ProvidesRadar>(r => !r.IsTraitDisabled).Any(a => a.Owner == self.Owner); } }
bool wasDisabled;
bool wasPaused;
void ITick.Tick(Actor self)
{
if (!wasDisabled && (self.IsDisabled() || (info.RequiresActiveRadar && NoActiveRadar)))
if (!wasPaused && (IsTraitPaused || (info.RequiresActiveRadar && NoActiveRadar)))
{
wasDisabled = true;
wasPaused = true;
RemoveGps(self);
}
else if (wasDisabled && !self.IsDisabled() && !(info.RequiresActiveRadar && NoActiveRadar))
else if (wasPaused && !IsTraitPaused && !(info.RequiresActiveRadar && NoActiveRadar))
{
wasDisabled = false;
wasPaused = false;
owner.GpsAdd(self);
}
}