diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs index 6c4c3c16b6..ab227a1783 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/AttackOrderPower.cs @@ -120,7 +120,7 @@ namespace OpenRA.Mods.Cnc.Traits protected override void Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); } diff --git a/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs b/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs index 993ef21ce7..4cb0abb4ac 100644 --- a/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs +++ b/OpenRA.Mods.Cnc/Traits/SupportPowers/ChronoshiftPower.cs @@ -174,7 +174,7 @@ namespace OpenRA.Mods.Cnc.Traits protected override void Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); } @@ -274,7 +274,7 @@ namespace OpenRA.Mods.Cnc.Traits protected override void Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs index 1621cd9ea1..3ac0e372ab 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/GrantExternalConditionPower.cs @@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index d3a9d3e010..4513e2db60 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Traits void IOrderGenerator.Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); } diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs index d7ad4c4e77..5a9dbe95ce 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs @@ -309,7 +309,7 @@ namespace OpenRA.Mods.Common.Traits protected override void Tick(World world) { // Cancel the OG if we can't use the power - if (!manager.Powers.ContainsKey(order)) + if (!manager.Powers.TryGetValue(order, out var p) || !p.Active || !p.Ready) world.CancelInputMode(); }