tidy up disabled handling
This commit is contained in:
@@ -131,36 +131,31 @@ namespace OpenRA.Mods.RA
|
||||
Key = key;
|
||||
}
|
||||
|
||||
static bool InstanceDisabled(SupportPower sp)
|
||||
{
|
||||
return sp.self.TraitsImplementing<IDisable>().Any(d => d.Disabled);
|
||||
}
|
||||
|
||||
bool notifiedCharging;
|
||||
bool notifiedReady;
|
||||
|
||||
public void Tick()
|
||||
{
|
||||
Active = !Disabled && Instances.Any(i => !InstanceDisabled(i));
|
||||
if (Disabled || Instances.All(i => i.self.IsDisabled()))
|
||||
return;
|
||||
|
||||
if (Active)
|
||||
if (Manager.devMode.FastCharge && RemainingTime > 25)
|
||||
RemainingTime = 25;
|
||||
|
||||
if (RemainingTime > 0) --RemainingTime;
|
||||
|
||||
var power = Instances.First();
|
||||
|
||||
if (!notifiedCharging)
|
||||
{
|
||||
var power = Instances.First();
|
||||
if (Manager.devMode.FastCharge && RemainingTime > 25)
|
||||
RemainingTime = 25;
|
||||
power.Charging(power.self, Key);
|
||||
notifiedCharging = true;
|
||||
}
|
||||
|
||||
if (RemainingTime > 0) --RemainingTime;
|
||||
if (!notifiedCharging)
|
||||
{
|
||||
power.Charging(power.self, Key);
|
||||
notifiedCharging = true;
|
||||
}
|
||||
|
||||
if (RemainingTime == 0
|
||||
&& !notifiedReady)
|
||||
{
|
||||
power.Charged(power.self, Key);
|
||||
notifiedReady = true;
|
||||
}
|
||||
if (RemainingTime == 0 && !notifiedReady)
|
||||
{
|
||||
power.Charged(power.self, Key);
|
||||
notifiedReady = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +172,7 @@ namespace OpenRA.Mods.RA
|
||||
if (!Ready)
|
||||
return;
|
||||
|
||||
var power = Instances.First(i => !InstanceDisabled(i));
|
||||
var power = Instances.First(i => !i.self.IsDisabled());
|
||||
|
||||
// Note: order.Subject is the *player* actor
|
||||
power.Activate(power.self, order);
|
||||
|
||||
Reference in New Issue
Block a user