From 33e9ad04726853a0e8831793c9c1cf0de48bad08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 5 Oct 2014 08:40:14 +0200 Subject: [PATCH 1/2] add missing HarvesterAttackNotifier closes #6671 --- mods/ts/rules/player.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/ts/rules/player.yaml b/mods/ts/rules/player.yaml index 80a376ccd8..3297945173 100644 --- a/mods/ts/rules/player.yaml +++ b/mods/ts/rules/player.yaml @@ -42,6 +42,7 @@ Player: Shroud: FrozenActorLayer: BaseAttackNotifier: + HarvesterAttackNotifier: PlayerStatistics: PlaceBeacon: From 25c89698fde2c6cea5c6ade1ec30e5785c8f4493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 5 Oct 2014 08:47:05 +0200 Subject: [PATCH 2/2] document HarvesterAttack- and BaseAttackNotifier --- OpenRA.Mods.RA/Player/BaseAttackNotifier.cs | 13 +++++++++++-- OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs b/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs index efb0b6adaf..5ffca4c8b0 100644 --- a/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs +++ b/OpenRA.Mods.RA/Player/BaseAttackNotifier.cs @@ -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); diff --git a/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs b/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs index 3f678d98dc..ad51b3eff0 100644 --- a/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs +++ b/OpenRA.Mods.RA/Player/HarvesterAttackNotifier.cs @@ -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);