Use proper speech notification for InfiltrateForCash

This commit is contained in:
Oliver Brakmann
2016-01-13 21:55:19 +01:00
parent 2e157b82f4
commit a612ca9c5f
3 changed files with 14 additions and 6 deletions

View File

@@ -2910,8 +2910,16 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (!node.Value.Nodes.Any(n => n.Key == "Minimum"))
node.Value.Nodes.Add(new MiniYamlNode("Minimum", "500"));
if (!node.Value.Nodes.Any(n => n.Key == "SoundToVictim"))
node.Value.Nodes.Add(new MiniYamlNode("SoundToVictim", "credit1.aud"));
var sound = node.Value.Nodes.FirstOrDefault(n => n.Key == "SoundToVictim");
if (sound != null)
{
node.Value.Nodes.Remove(sound);
Console.WriteLine("The 'SoundToVictim' property of the 'InfiltrateForCash' trait has been");
Console.WriteLine("replaced with a 'Notification' property. Please add the sound file");
Console.WriteLine("'{0}' to your mod's audio notification yaml and".F(sound.Value.Value));
Console.WriteLine("update your mod's rules accordingly.");
Console.WriteLine();
}
}
}

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Mods.RA.Traits
public readonly int Minimum = -1;
[Desc("Sound the victim will hear when they get robbed.")]
public readonly string SoundToVictim = null;
public readonly string Notification = null;
public object Create(ActorInitializer init) { return new InfiltrateForCash(this); }
}
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.RA.Traits
targetResources.TakeCash(toTake);
spyResources.GiveCash(toGive);
if (info.SoundToVictim != null)
Game.Sound.PlayToPlayer(self.Owner, info.SoundToVictim);
if (info.Notification != null)
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, infiltrator.Owner.Color.RGB, FloatingText.FormatCashTick(toGive), 30)));
}

View File

@@ -998,7 +998,7 @@ PROC:
Facing: 64
InfiltrateForCash:
Percentage: 50
SoundToVictim: credit1.aud
Notification: CreditsStolen
WithIdleOverlay@TOP:
Sequence: idle-top
Power: