diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs index 10ed146951..2373665b29 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs @@ -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 IOrderGenerator.Order(World world, CPos cell, int2 worldPixel, MouseInput mi) @@ -122,7 +122,7 @@ namespace OpenRA.Mods.Cnc.Traits IEnumerable 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, diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/GpsPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/GpsPower.cs index b0570a57af..f3b0d0a975 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/GpsPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/GpsPower.cs @@ -101,18 +101,18 @@ namespace OpenRA.Mods.Cnc.Traits } bool NoActiveRadar { get { return !self.World.ActorsHavingTrait(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); } } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs index 15fbce2a67..052a1fb267 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPower.cs @@ -13,7 +13,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { - public abstract class SupportPowerInfo : ConditionalTraitInfo + public abstract class SupportPowerInfo : PausableConditionalTraitInfo { [Desc("Measured in seconds.")] public readonly int ChargeTime = 0; @@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits public SupportPowerInfo() { OrderName = GetType().Name + "Order"; } } - public class SupportPower : ConditionalTrait + public class SupportPower : PausableConditionalTrait { public readonly Actor Self; readonly SupportPowerInfo info; diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index 2e9567ee21..3b7e0dfe2b 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -179,11 +179,6 @@ namespace OpenRA.Mods.Common.Traits prereqsAvailable = available; } - static bool InstanceDisabled(SupportPower sp) - { - return sp.Self.IsDisabled(); - } - bool notifiedCharging; bool notifiedReady; public void Tick() @@ -192,7 +187,7 @@ namespace OpenRA.Mods.Common.Traits if (!instancesEnabled) RemainingTime = TotalTime; - Active = !Disabled && Instances.Any(i => !i.Self.IsDisabled()); + Active = !Disabled && Instances.Any(i => !i.IsTraitPaused); if (!Active) return; @@ -224,7 +219,7 @@ namespace OpenRA.Mods.Common.Traits if (!Ready) return; - var power = Instances.FirstOrDefault(); + var power = Instances.FirstOrDefault(i => !i.IsTraitPaused); if (power == null) return; @@ -236,7 +231,7 @@ namespace OpenRA.Mods.Common.Traits if (!Ready) return; - var power = Instances.Where(i => !InstanceDisabled(i)) + var power = Instances.Where(i => !i.IsTraitPaused) .MinByOrDefault(a => { if (a.Self.OccupiesSpace == null) diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index fd536ac1bf..6a2db6ccb4 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -477,6 +477,7 @@ HQ: DetectCloaked: Range: 5c0 AirstrikePower: + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons Icon: airstrike ChargeTime: 240 @@ -573,6 +574,7 @@ EYE: DetectCloaked: Range: 5c0 IonCannonPower: + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons Icon: ioncannon Cursor: ioncannon @@ -625,6 +627,7 @@ TMPL: DetectCloaked: Range: 5c0 NukePower: + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons Icon: abomb Cursor: nuke diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 13877510c2..5c6d76f698 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -950,6 +950,7 @@ palace: NukePower: Cursor: nuke Icon: deathhand + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons, ~palace.nuke ChargeTime: 300 Description: Death Hand @@ -969,6 +970,7 @@ palace: Description: Recruit Fremen LongDesc: Elite infantry unit armed with assault rifles and rockets\n Strong vs Infantry, Vehicles\n Weak vs Artillery\n Special Ability: Invisibility Icon: fremen + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons, ~palace.fremen Actors: fremen, fremen Type: Palace @@ -980,6 +982,7 @@ palace: Description: Recruit Saboteur LongDesc: Sneaky infantry, armed with explosives\n Strong vs Buildings\n Weak vs Everything\n Special Ability: destroy buildings Icon: saboteur + PauseOnCondition: disabled Prerequisites: ~techlevel.superweapons, ~palace.saboteur Actors: saboteur Type: Palace diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 6999531d0f..cbe2ae5d67 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -21,6 +21,7 @@ MSLO: RevealsShroud: Range: 5c0 NukePower: + PauseOnCondition: disabled Cursor: nuke Icon: abomb ChargeTime: 540 @@ -318,6 +319,7 @@ IRON: Bib: HasMinibib: Yes GrantExternalConditionPower@IRONCURTAIN: + PauseOnCondition: disabled Icon: invuln ChargeTime: 120 Description: Invulnerability @@ -375,6 +377,7 @@ PDOX: Prerequisite: pdox.germany ChronoshiftPower@chronoshift: OrderName: Chronoshift + PauseOnCondition: disabled Prerequisites: !pdox.germany Icon: chrono ChargeTime: 120 @@ -389,6 +392,7 @@ PDOX: DisplayRadarPing: True ChronoshiftPower@advancedchronoshift: OrderName: AdvancedChronoshift + PauseOnCondition: disabled Prerequisites: pdox.germany Icon: chrono ChargeTime: 120 @@ -811,6 +815,7 @@ ATEK: Range: 6c0 Bib: GpsPower: + PauseOnCondition: disabled Icon: gps OneShot: yes ChargeTime: 480 diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index 0ca13c3d70..a9680e79cb 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -417,6 +417,7 @@ GAPLUG: MaxHeightDelta: 3 IonCannonPower: Cursor: ioncannon + PauseOnCondition: disabled || empdisable RequiresCondition: plug.ioncannona || plug.ioncannonb Icon: ioncannon Effect: explosion @@ -431,6 +432,7 @@ GAPLUG: DisplayRadarPing: True CameraActor: camera ProduceActorPower: + PauseOnCondition: disabled || empdisable RequiresCondition: plug.hunterseekera || plug.hunterseekerb Description: Hunter Seeker LongDesc: Releases a drone that will acquire and destroy an enemy target. diff --git a/mods/ts/rules/nod-structures.yaml b/mods/ts/rules/nod-structures.yaml index cdc1b98ba7..6b484f44f3 100644 --- a/mods/ts/rules/nod-structures.yaml +++ b/mods/ts/rules/nod-structures.yaml @@ -364,6 +364,7 @@ NATMPL: RequiresCondition: !disabled Sequence: idle-lights ProduceActorPower: + PauseOnCondition: empdisable Description: Hunter Seeker LongDesc: Releases a drone that will acquire and destroy an enemy target. Prerequisites: ~techlevel.superweapons diff --git a/mods/ts/rules/nod-support.yaml b/mods/ts/rules/nod-support.yaml index 7ba4f93b96..9db185e407 100644 --- a/mods/ts/rules/nod-support.yaml +++ b/mods/ts/rules/nod-support.yaml @@ -353,6 +353,7 @@ NAMISL: ProvidesPrerequisite@buildingname: SupportPowerChargeBar: NukePower: + PauseOnCondition: disabled Cursor: nuke Icon: clustermissile ChargeTime: 540 diff --git a/mods/ts/rules/shared-support.yaml b/mods/ts/rules/shared-support.yaml index 5b6eb687ea..2d7ea414dc 100644 --- a/mods/ts/rules/shared-support.yaml +++ b/mods/ts/rules/shared-support.yaml @@ -45,6 +45,7 @@ NAPULS: ProvidesPrerequisite@gdi: ResetOnOwnerChange: true AttackOrderPower: + PauseOnCondition: empdisable || disabled Cursor: emp Icon: emp ChargeTime: 135