document HarvesterAttack- and BaseAttackNotifier

This commit is contained in:
Matthias Mailänder
2014-10-05 08:47:05 +02:00
parent 33e9ad0472
commit 25c89698fd
2 changed files with 22 additions and 4 deletions

View File

@@ -15,12 +15,21 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
[Desc("Plays an audio notification and shows a radar ping when a building is attacked.",
"Attach this to the player actor.")]
public class BaseAttackNotifierInfo : ITraitInfo
{
public readonly int NotifyInterval = 30; // seconds
[Desc("Minimum duration (in seconds) between notification events.")]
public readonly int NotifyInterval = 30;
public readonly Color RadarPingColor = Color.Red;
[Desc("Length of time (in ticks) to display a location ping in the minimap.")]
public readonly int RadarPingDuration = 10 * 25;
[Desc("The audio notification type to play.")]
public string Notification = "BaseAttack";
public object Create(ActorInitializer init) { return new BaseAttackNotifier(init.self, this); }
}
@@ -58,7 +67,7 @@ namespace OpenRA.Mods.RA
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "BaseAttack", self.Owner.Country.Race);
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race);
if (radarPings != null)
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);

View File

@@ -14,12 +14,21 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
[Desc("Plays an audio notification and shows a radar ping when a harvester is attacked.",
"Attach this to the player actor.")]
public class HarvesterAttackNotifierInfo : ITraitInfo
{
public readonly int NotifyInterval = 30; // seconds
[Desc("Minimum duration (in seconds) between notification events.")]
public readonly int NotifyInterval = 30;
public readonly Color RadarPingColor = Color.Red;
[Desc("Length of time (in ticks) to display a location ping in the minimap.")]
public readonly int RadarPingDuration = 10 * 25;
[Desc("The audio notification type to play.")]
public string Notification = "HarvesterAttack";
public object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.self, this); }
}
@@ -49,7 +58,7 @@ namespace OpenRA.Mods.RA
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", "HarvesterAttack", self.Owner.Country.Race);
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race);
if (radarPings != null)
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);