Fix instant-use and AllowMultiple support powers.

Fixes #2185, #6090.
This commit is contained in:
Paul Chote
2014-08-02 21:27:18 +12:00
parent f84b1c145e
commit efebb500f0
2 changed files with 5 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ namespace OpenRA.Mods.RA
Powers[order.OrderString].Activate(order); Powers[order.OrderString].Activate(order);
} }
// Deprecated. Remove after SupportPowerBinWidget is removed.
public void Target(string key) public void Target(string key)
{ {
if (Powers.ContainsKey(key)) if (Powers.ContainsKey(key))

View File

@@ -113,9 +113,10 @@ namespace OpenRA.Mods.RA.Widgets
WidgetUtils.DrawSHPCentered(p.Sprite, p.Pos + iconOffset, worldRenderer); WidgetUtils.DrawSHPCentered(p.Sprite, p.Pos + iconOffset, worldRenderer);
// Charge progress // Charge progress
var sp = p.Power;
clock.PlayFetchIndex("idle", clock.PlayFetchIndex("idle",
() => (p.Power.TotalTime - p.Power.RemainingTime) () => sp.TotalTime == 0 ? clock.CurrentSequence.Length - 1 : (sp.TotalTime - sp.RemainingTime)
* (clock.CurrentSequence.Length - 1) / p.Power.TotalTime); * (clock.CurrentSequence.Length - 1) / sp.TotalTime);
clock.Tick(); clock.Tick();
WidgetUtils.DrawSHPCentered(clock.Image, p.Pos + iconOffset, worldRenderer); WidgetUtils.DrawSHPCentered(clock.Image, p.Pos + iconOffset, worldRenderer);
@@ -184,7 +185,7 @@ namespace OpenRA.Mods.RA.Widgets
if (!clicked.Power.Active) if (!clicked.Power.Active)
Sound.PlayToPlayer(spm.self.Owner, clicked.Power.Info.InsufficientPowerSound); Sound.PlayToPlayer(spm.self.Owner, clicked.Power.Info.InsufficientPowerSound);
spm.Target(clicked.Power.Info.OrderName); clicked.Power.Target();
} }
return true; return true;