Enables "insufficient power"-speech in RA and C&C when powered-down supportpowerwidget is clicked
This commit is contained in:
@@ -24,6 +24,7 @@ namespace OpenRA.Mods.RA
|
||||
public readonly string BeginChargeSound = null;
|
||||
public readonly string EndChargeSound = null;
|
||||
public readonly string SelectTargetSound = null;
|
||||
public readonly string InsufficientPowerSound = null;
|
||||
public readonly string LaunchSound = null;
|
||||
public readonly string IncomingSound = null;
|
||||
|
||||
|
||||
@@ -370,8 +370,9 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
// Check if the item's build-limit has already been reached
|
||||
var queued = CurrentQueue.AllQueued().Count(a => a.Item == unit.Name);
|
||||
var inWorld = world.ActorsWithTrait<Buildable>().Count(a => a.Actor.Info.Name == unit.Name && a.Actor.Owner == world.LocalPlayer);
|
||||
var buildLimit = unit.Traits.Get<BuildableInfo>().BuildLimit;
|
||||
|
||||
if (!((unit.Traits.Get<BuildableInfo>().BuildLimit != 0) && (inWorld + queued >= unit.Traits.Get<BuildableInfo>().BuildLimit)))
|
||||
if (!((buildLimit != 0) && (inWorld + queued >= buildLimit)))
|
||||
Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, world.LocalPlayer.Country.Race);
|
||||
else
|
||||
Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.BlockedAudio, world.LocalPlayer.Country.Race);
|
||||
|
||||
@@ -167,7 +167,15 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
|
||||
Action<MouseInput> HandleSupportPower(string key, SupportPowerManager manager)
|
||||
{
|
||||
return mi => { if (mi.Button == MouseButton.Left) manager.Target(key); };
|
||||
return mi =>
|
||||
{
|
||||
if (mi.Button == MouseButton.Left)
|
||||
{
|
||||
if (!manager.Powers[key].Active)
|
||||
Sound.PlayToPlayer(manager.self.Owner, manager.Powers[key].Info.InsufficientPowerSound);
|
||||
manager.Target(key);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user