From 8d03411096f0081211a13c74541952e33ad43130 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 5 Dec 2009 22:39:35 +1300 Subject: [PATCH] low power notif --- OpenRa.Game/Player.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/OpenRa.Game/Player.cs b/OpenRa.Game/Player.cs index 7d371a2a8b..863a7ee8e9 100644 --- a/OpenRa.Game/Player.cs +++ b/OpenRa.Game/Player.cs @@ -41,6 +41,9 @@ namespace OpenRa.Game powerProvided += dPower; if (dPower < 0) powerDrained -= dPower; + + if (powerDrained > powerProvided) + GiveAdvice("lopower1.aud"); } public float GetSiloFullness() @@ -57,6 +60,13 @@ namespace OpenRa.Game .Sum(b => b.Storage); } + void GiveAdvice(string advice) + { + // todo: store the condition or something. + // repeat after Rules.General.SpeakDelay, as long as the condition holds. + Sound.Play(advice); + } + public void GiveCash( int num ) { Cash += num; } public void GiveOre(int num) { @@ -67,7 +77,7 @@ namespace OpenRa.Game Ore = capacity; // trim off the overflow. if (Ore > .8 * capacity) - Sound.Play("silond1.aud"); + GiveAdvice("silond1.aud"); // silos needed } public bool TakeCash( int num )