Enables "insufficient power"-speech in RA and C&C when powered-down supportpowerwidget is clicked

This commit is contained in:
Kanar
2014-01-27 04:29:32 +01:00
parent 8685ec64ae
commit 17cf890dce
10 changed files with 22 additions and 6 deletions

View File

@@ -168,7 +168,11 @@ namespace OpenRA.Mods.Cnc.Widgets
.Select(i => i.Value).FirstOrDefault();
if (clicked != null)
{
if (!clicked.Power.Active)
Sound.PlayToPlayer(spm.self.Owner, clicked.Power.Info.InsufficientPowerSound);
spm.Target(clicked.Power.Info.OrderName);
}
return true;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}
};
}
}
}

View File

@@ -9,7 +9,6 @@ Speech:
PrimaryBuildingSelected: pribldg1
BuildingCannotPlaceAudio: deploy1
NewOptions: newopt1
AbilityInsufficientPower: nopower1
Win: accom1
Lose: fail1
BaseAttack: baseatk1

View File

@@ -379,6 +379,7 @@ HQ:
LongDesc: Deploy an aerial napalm strike.\nBurns buildings and infantry along a line.
EndChargeSound: airredy1.aud
SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud
IncomingSound: enemya.aud
UnitType: a10
SupportPowerChargeBar:
@@ -443,6 +444,7 @@ EYE:
EndChargeSound: ionredy1.aud
LaunchSound: ion1.aud
SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud
SupportPowerChargeBar:
TMPL:
@@ -477,6 +479,7 @@ TMPL:
BeginChargeSound:
EndChargeSound: nukavail.aud
SelectTargetSound: select1.aud
InsufficientPowerSound: nopower1.aud
LaunchSound: nuklnch1.aud
IncomingSound: nuke1.aud
MissileWeapon: atomic

View File

@@ -12,7 +12,6 @@ Speech:
LowPower: POWER
SilosNeeded: SILOS
PrimaryBuildingSelected: PRMRY
AbilityInsufficientPower:
NewOptions: NEWOP
Win: MWIN
Lose: MFAIL

View File

@@ -6,7 +6,6 @@ Speech:
PrimaryBuildingSelected: pribldg1
BuildingCannotPlaceAudio: nodeply1
NewOptions: newopt1
AbilityInsufficientPower: nopowr1
Win: misnwon1
Lose: misnlst1
BaseAttack: baseatk1

View File

@@ -31,6 +31,7 @@ MSLO:
BeginChargeSound: aprep1.aud
EndChargeSound: aready1.aud
SelectTargetSound: slcttgt1.aud
InsufficientPowerSound: nopowr1.aud
IncomingSound: alaunch1.aud
LaunchSound:
MissileWeapon: atomic
@@ -220,6 +221,7 @@ IRON:
LongDesc: Makes a group of units invulnerable\nfor 20 seconds.
Duration: 20
SelectTargetSound: slcttgt1.aud
InsufficientPowerSound: nopowr1.aud
BeginChargeSound: ironchg1.aud
EndChargeSound: ironrdy1.aud
SupportPowerChargeBar:
@@ -257,6 +259,7 @@ PDOX:
Description: Chronoshift
LongDesc: Teleports a group of units across\nthe map for 20 seconds.
SelectTargetSound: slcttgt1.aud
InsufficientPowerSound: nopowr1.aud
BeginChargeSound: chrochr1.aud
EndChargeSound: chrordy1.aud
Duration: 20

View File

@@ -6,7 +6,6 @@ Speech:
PrimaryBuildingSelected: 00-i034
BuildingCannotPlaceAudio: 00-i016
NewOptions: 00-i032
AbilityInsufficientPower:
Win: 00-i284
Lose: 00-i286
BaseAttack: 00-i082