Skip to content

Commit

Permalink
Disable SupportPowerInstances when player lost
Browse files Browse the repository at this point in the history
Fixes bots using player actor powers after defeat.
  • Loading branch information
reaperrr committed Dec 29, 2019
1 parent 1e138a9 commit 8068ef2
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions OpenRA.Mods.Common/Traits/SupportPowers/SupportPowerManager.cs
Expand Up @@ -109,7 +109,7 @@ public void ResolveOrder(Actor self, Order order)

public IEnumerable<SupportPowerInstance> GetPowersForActor(Actor a)
{
if (a.Owner != Self.Owner || !a.Info.HasTraitInfo<SupportPowerInfo>())
if (Powers.Count == 0 || a.Owner != Self.Owner || !a.Info.HasTraitInfo<SupportPowerInfo>())
return NoInstances;

return a.TraitsImplementing<SupportPower>()
Expand Down Expand Up @@ -151,7 +151,16 @@ public class SupportPowerInstance
protected int remainingSubTicks;
public int RemainingTicks { get { return remainingSubTicks / 100; } }
public bool Active { get; private set; }
public bool Disabled { get { return (!prereqsAvailable && !Manager.DevMode.AllTech) || !instancesEnabled || oneShotFired; } }
public bool Disabled
{
get
{
return Manager.Self.Owner.WinState == WinState.Lost ||
(!prereqsAvailable && !Manager.DevMode.AllTech) ||
!instancesEnabled ||
oneShotFired;
}
}

public SupportPowerInfo Info { get { return Instances.Select(i => i.Info).FirstOrDefault(); } }
public bool Ready { get { return Active && RemainingTicks == 0; } }
Expand Down

0 comments on commit 8068ef2

Please sign in to comment.