diff --git a/OpenRa.Game/Chrome.cs b/OpenRa.Game/Chrome.cs index 7111bd893f..e7b55d2ad7 100644 --- a/OpenRa.Game/Chrome.cs +++ b/OpenRa.Game/Chrome.cs @@ -932,10 +932,10 @@ namespace OpenRa shpRenderer.DrawSprite(ready.Image, drawPos + new float2((64 - ready.Image.size.X) / 2, 2), PaletteType.Chrome); - - AddButton(rect, HandleSupportPower( sp )); } + AddButton(rect, HandleSupportPower(sp)); + if (rect.Contains(lastMousePos.ToPoint())) { tooltipItem = sp; diff --git a/OpenRa.Game/Traits/SupportPower.cs b/OpenRa.Game/Traits/SupportPower.cs index 1ed738baed..41f4dcd12a 100644 --- a/OpenRa.Game/Traits/SupportPower.cs +++ b/OpenRa.Game/Traits/SupportPower.cs @@ -102,6 +102,21 @@ namespace OpenRa.Traits protected virtual void OnFinishCharging() { } protected virtual void OnActivate() { } - public void Activate() { OnActivate(); } // todo: some more hax + public void Activate() + { + if (!IsAvailable || !IsReady) + { + Sound.Play("briefing.aud"); + return; + } + + if (Info.RequiresPower && Owner.GetPowerState() != PowerState.Normal) + { + Sound.Play("nopowr1.aud"); + return; + } + + OnActivate(); + } } }