Disable SupportPowerInstances when player lost

Fixes bots using player actor powers after defeat.
This commit is contained in:
reaperrr
2019-12-14 17:30:54 +01:00
committed by abcdefg30
parent 7a57f0e6ef
commit 9d7ecdbc2c

View File

@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Traits
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>()
@@ -151,7 +151,16 @@ namespace OpenRA.Mods.Common.Traits
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; } }