Add a lint test for audio notifications.

Only traits are linted - the UI still hardcodes
too many audio references for this to be worthwhile.
This commit is contained in:
Paul Chote
2018-09-25 20:42:32 +00:00
committed by abcdefg30
parent 096de8f5aa
commit 09d8aafddf
32 changed files with 148 additions and 0 deletions

View File

@@ -37,6 +37,19 @@ namespace OpenRA.Traits
[AttributeUsage(AttributeTargets.Field)] [AttributeUsage(AttributeTargets.Field)]
public sealed class LocomotorReferenceAttribute : Attribute { } public sealed class LocomotorReferenceAttribute : Attribute { }
[AttributeUsage(AttributeTargets.Field)]
public sealed class NotificationReferenceAttribute : Attribute
{
public readonly string NotificationTypeFieldName = null;
public readonly string NotificationType = null;
public NotificationReferenceAttribute(string type = null, string typeFromField = null)
{
NotificationType = type;
NotificationTypeFieldName = typeFromField;
}
}
[AttributeUsage(AttributeTargets.Field)] [AttributeUsage(AttributeTargets.Field)]
public sealed class SequenceReferenceAttribute : Attribute public sealed class SequenceReferenceAttribute : Attribute
{ {

View File

@@ -19,7 +19,10 @@ namespace OpenRA.Mods.Cnc.Traits
public class PlaceSimpleBeaconInfo : ITraitInfo public class PlaceSimpleBeaconInfo : ITraitInfo
{ {
public readonly int Duration = 30 * 25; public readonly int Duration = 30 * 25;
public readonly string NotificationType = "Sounds"; public readonly string NotificationType = "Sounds";
[NotificationReference(typeFromField: "NotificationType")]
public readonly string Notification = "Beacon"; public readonly string Notification = "Beacon";
public readonly bool IsPlayerPalette = false; public readonly bool IsPlayerPalette = false;

View File

@@ -23,7 +23,9 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Deliver the unit in production via skylift.")] [Desc("Deliver the unit in production via skylift.")]
public class ProductionAirdropInfo : ProductionInfo public class ProductionAirdropInfo : ProductionInfo
{ {
[NotificationReference("Speech")]
public readonly string ReadyAudio = "Reinforce"; public readonly string ReadyAudio = "Reinforce";
[Desc("Cargo aircraft used for delivery. Must have the `Aircraft` trait.")] [Desc("Cargo aircraft used for delivery. Must have the `Aircraft` trait.")]
[ActorReference(typeof(AircraftInfo))] public readonly string ActorType = "c17"; [ActorReference(typeof(AircraftInfo))] public readonly string ActorType = "c17";

View File

@@ -33,6 +33,7 @@ namespace OpenRA.Mods.Cnc.Traits
[Desc("Maximum amount of funds which will be stolen.")] [Desc("Maximum amount of funds which will be stolen.")]
public readonly int Maximum = int.MaxValue; public readonly int Maximum = int.MaxValue;
[NotificationReference("Speech")]
[Desc("Sound the victim will hear when they get robbed.")] [Desc("Sound the victim will hear when they get robbed.")]
public readonly string Notification = null; public readonly string Notification = null;

View File

@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Cnc.Traits
"Possible values are Exit, Suicide, Dispose.")] "Possible values are Exit, Suicide, Dispose.")]
public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose; public readonly EnterBehaviour EnterBehaviour = EnterBehaviour.Dispose;
[NotificationReference("Speech")]
[Desc("Notification to play when a building is infiltrated.")] [Desc("Notification to play when a building is infiltrated.")]
public readonly string Notification = "BuildingInfiltrated"; public readonly string Notification = "BuildingInfiltrated";

View File

@@ -0,0 +1,57 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Lint
{
class CheckNotifications : ILintRulesPass
{
public void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
{
foreach (var actorInfo in rules.Actors)
{
foreach (var traitInfo in actorInfo.Value.TraitInfos<ITraitInfo>())
{
var fields = traitInfo.GetType().GetFields();
foreach (var field in fields.Where(x => x.HasAttribute<NotificationReferenceAttribute>()))
{
string type = null;
var notificationReference = field.GetCustomAttributes<NotificationReferenceAttribute>(true).First();
if (!string.IsNullOrEmpty(notificationReference.NotificationTypeFieldName))
{
var fieldInfo = fields.First(f => f.Name == notificationReference.NotificationTypeFieldName);
type = (string)fieldInfo.GetValue(traitInfo);
}
else
type = notificationReference.NotificationType;
var notifications = LintExts.GetFieldValues(traitInfo, field, emitError);
foreach (var notification in notifications)
{
if (string.IsNullOrEmpty(notification))
continue;
SoundInfo soundInfo;
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out soundInfo) ||
!soundInfo.Notifications.ContainsKey(notification))
emitError("Undefined notification reference {0}.{1} detected at {2} for {3}".F(
type ?? "(null)", notification, traitInfo.GetType().Name, actorInfo.Key));
}
}
}
}
}
}
}

View File

@@ -148,6 +148,7 @@
<Compile Include="Effects\SpriteEffect.cs" /> <Compile Include="Effects\SpriteEffect.cs" />
<Compile Include="Graphics\RailgunRenderable.cs" /> <Compile Include="Graphics\RailgunRenderable.cs" />
<Compile Include="Effects\LaunchEffect.cs" /> <Compile Include="Effects\LaunchEffect.cs" />
<Compile Include="Lint\CheckNotifications.cs" />
<Compile Include="Projectiles\AreaBeam.cs" /> <Compile Include="Projectiles\AreaBeam.cs" />
<Compile Include="Projectiles\Bullet.cs" /> <Compile Include="Projectiles\Bullet.cs" />
<Compile Include="Projectiles\InstantHit.cs" /> <Compile Include="Projectiles\InstantHit.cs" />

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant to self while this is the primary building.")] [Desc("The condition to grant to self while this is the primary building.")]
public readonly string PrimaryCondition = null; public readonly string PrimaryCondition = null;
[NotificationReference("Speech")]
[Desc("The speech notification to play when selecting a primary building.")] [Desc("The speech notification to play when selecting a primary building.")]
public readonly string SelectionNotification = null; public readonly string SelectionNotification = null;

View File

@@ -43,6 +43,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The condition to grant to self while being repaired.")] [Desc("The condition to grant to self while being repaired.")]
public readonly string RepairCondition = null; public readonly string RepairCondition = null;
[NotificationReference("Speech")]
public readonly string RepairingNotification = null; public readonly string RepairingNotification = null;
public override object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); } public override object Create(ActorInitializer init) { return new RepairableBuilding(init.Self, this); }

View File

@@ -26,10 +26,16 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Order name that toggles the condition.")] [Desc("Order name that toggles the condition.")]
public readonly string OrderName = null; public readonly string OrderName = null;
[NotificationReference("Sounds")]
public readonly string EnabledSound = null; public readonly string EnabledSound = null;
[NotificationReference("Speech")]
public readonly string EnabledSpeech = null; public readonly string EnabledSpeech = null;
[NotificationReference("Sounds")]
public readonly string DisabledSound = null; public readonly string DisabledSound = null;
[NotificationReference("Speech")]
public readonly string DisabledSpeech = null; public readonly string DisabledSpeech = null;
public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(init.Self, this); } public override object Create(ActorInitializer init) { return new ToggleConditionOnOrder(init.Self, this); }

View File

@@ -36,6 +36,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Should the level-up animation be suppressed when actor is created?")] [Desc("Should the level-up animation be suppressed when actor is created?")]
public readonly bool SuppressLevelupAnimation = true; public readonly bool SuppressLevelupAnimation = true;
[NotificationReference("Sounds")]
public readonly string LevelUpNotification = null; public readonly string LevelUpNotification = null;
public object Create(ActorInitializer init) { return new GainsExperience(init, this); } public object Create(ActorInitializer init) { return new GainsExperience(init, this); }

View File

@@ -26,9 +26,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Length of time (in ticks) to display a location ping in the minimap.")] [Desc("Length of time (in ticks) to display a location ping in the minimap.")]
public readonly int RadarPingDuration = 10 * 25; public readonly int RadarPingDuration = 10 * 25;
[NotificationReference("Speech")]
[Desc("The audio notification type to play.")] [Desc("The audio notification type to play.")]
public string Notification = "BaseAttack"; public string Notification = "BaseAttack";
[NotificationReference("Speech")]
[Desc("The audio notification to play to allies when under attack.", [Desc("The audio notification to play to allies when under attack.",
"Won't play a notification to allies if this is null.")] "Won't play a notification to allies if this is null.")]
public string AllyNotification = null; public string AllyNotification = null;

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Length of time (in ticks) to display a location ping in the minimap.")] [Desc("Length of time (in ticks) to display a location ping in the minimap.")]
public readonly int RadarPingDuration = 10 * 25; public readonly int RadarPingDuration = 10 * 25;
[NotificationReference("Speech")]
[Desc("The audio notification type to play.")] [Desc("The audio notification type to play.")]
public string Notification = "HarvesterAttack"; public string Notification = "HarvesterAttack";

View File

@@ -48,8 +48,13 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")] [Desc("Delay between the game over condition being met, and the game actually ending, in milliseconds.")]
public readonly int GameOverDelay = 1500; public readonly int GameOverDelay = 1500;
[NotificationReference("Speech")]
public readonly string WinNotification = null; public readonly string WinNotification = null;
[NotificationReference("Speech")]
public readonly string LoseNotification = null; public readonly string LoseNotification = null;
[NotificationReference("Speech")]
public readonly string LeaveNotification = null; public readonly string LeaveNotification = null;
public object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); } public object Create(ActorInitializer init) { return new MissionObjectives(init.World, this); }

View File

@@ -18,7 +18,10 @@ namespace OpenRA.Mods.Common.Traits
public class PlaceBeaconInfo : ITraitInfo public class PlaceBeaconInfo : ITraitInfo
{ {
public readonly int Duration = 30 * 25; public readonly int Duration = 30 * 25;
public readonly string NotificationType = "Sounds"; public readonly string NotificationType = "Sounds";
[NotificationReference(typeFromField: "NotificationType")]
public readonly string Notification = "Beacon"; public readonly string Notification = "Beacon";
public readonly bool IsPlayerPalette = true; public readonly bool IsPlayerPalette = true;

View File

@@ -31,9 +31,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Play NewOptionsNotification this many ticks after building placement.")] [Desc("Play NewOptionsNotification this many ticks after building placement.")]
public readonly int NewOptionsNotificationDelay = 10; public readonly int NewOptionsNotificationDelay = 10;
[NotificationReference("Speech")]
[Desc("Notification to play after building placement if new construction options are available.")] [Desc("Notification to play after building placement if new construction options are available.")]
public readonly string NewOptionsNotification = null; public readonly string NewOptionsNotification = null;
[NotificationReference("Speech")]
public readonly string CannotPlaceNotification = null; public readonly string CannotPlaceNotification = null;
public object Create(ActorInitializer init) { return new PlaceBuilding(this); } public object Create(ActorInitializer init) { return new PlaceBuilding(this); }

View File

@@ -41,13 +41,17 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Display order for the DefaultCash option.")] [Desc("Display order for the DefaultCash option.")]
public readonly int DefaultCashDropdownDisplayOrder = 0; public readonly int DefaultCashDropdownDisplayOrder = 0;
[NotificationReference("Speech")]
[Desc("Speech notification to play when the player does not have any funds.")] [Desc("Speech notification to play when the player does not have any funds.")]
public readonly string InsufficientFundsNotification = null; public readonly string InsufficientFundsNotification = null;
[Desc("Delay (in ticks) during which warnings will be muted.")] [Desc("Delay (in ticks) during which warnings will be muted.")]
public readonly int InsufficientFundsNotificationDelay = 750; public readonly int InsufficientFundsNotificationDelay = 750;
[NotificationReference("Sounds")]
public readonly string CashTickUpNotification = null; public readonly string CashTickUpNotification = null;
[NotificationReference("Sounds")]
public readonly string CashTickDownNotification = null; public readonly string CashTickDownNotification = null;
IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules) IEnumerable<LobbyOption> ILobbyOptions.LobbyOptions(Ruleset rules)

View File

@@ -50,28 +50,34 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The build time is multiplied with this value on low power.")] [Desc("The build time is multiplied with this value on low power.")]
public readonly int LowPowerSlowdown = 3; public readonly int LowPowerSlowdown = 3;
[NotificationReference("Speech")]
[Desc("Notification played when production is complete.", [Desc("Notification played when production is complete.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string ReadyAudio = null; public readonly string ReadyAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when you can't train another actor", [Desc("Notification played when you can't train another actor",
"when the build limit exceeded or the exit is jammed.", "when the build limit exceeded or the exit is jammed.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string BlockedAudio = null; public readonly string BlockedAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when you can't queue another actor", [Desc("Notification played when you can't queue another actor",
"when the queue length limit is exceeded.", "when the queue length limit is exceeded.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string LimitedAudio = null; public readonly string LimitedAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when user clicks on the build palette icon.", [Desc("Notification played when user clicks on the build palette icon.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string QueuedAudio = null; public readonly string QueuedAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when player right-clicks on the build palette icon.", [Desc("Notification played when player right-clicks on the build palette icon.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string OnHoldAudio = null; public readonly string OnHoldAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when player right-clicks on a build palette icon that is already on hold.", [Desc("Notification played when player right-clicks on a build palette icon that is already on hold.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string CancelledAudio = null; public readonly string CancelledAudio = null;

View File

@@ -22,6 +22,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("The percentage threshold above which a warning is played.")] [Desc("The percentage threshold above which a warning is played.")]
public readonly int Threshold = 80; public readonly int Threshold = 80;
[NotificationReference("Speech")]
[Desc("The speech to play for the warning.")] [Desc("The speech to play for the warning.")]
public readonly string Notification = "SilosNeeded"; public readonly string Notification = "SilosNeeded";

View File

@@ -20,6 +20,8 @@ namespace OpenRA.Mods.Common.Traits
public class PowerManagerInfo : ITraitInfo, Requires<DeveloperModeInfo> public class PowerManagerInfo : ITraitInfo, Requires<DeveloperModeInfo>
{ {
public readonly int AdviceInterval = 250; public readonly int AdviceInterval = 250;
[NotificationReference("Speech")]
public readonly string SpeechNotification = null; public readonly string SpeechNotification = null;
public object Create(ActorInitializer init) { return new PowerManager(init.Self, this); } public object Create(ActorInitializer init) { return new PowerManager(init.Self, this); }

View File

@@ -27,6 +27,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sound to play when dropping the unit.")] [Desc("Sound to play when dropping the unit.")]
public readonly string ChuteSound = null; public readonly string ChuteSound = null;
[NotificationReference("Speech")]
[Desc("Notification to play when dropping the unit.")] [Desc("Notification to play when dropping the unit.")]
public readonly string ReadyAudio = null; public readonly string ReadyAudio = null;

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Cursor to use when repairing is denied.")] [Desc("Cursor to use when repairing is denied.")]
public readonly string TargetBlockedCursor = "goldwrench-blocked"; public readonly string TargetBlockedCursor = "goldwrench-blocked";
[NotificationReference("Speech")]
[Desc("Speech notification to play when a bridge is repaired.")] [Desc("Speech notification to play when a bridge is repaired.")]
public readonly string RepairNotification = null; public readonly string RepairNotification = null;

View File

@@ -9,6 +9,8 @@
*/ */
#endregion #endregion
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
public class RepairsUnitsInfo : PausableConditionalTraitInfo public class RepairsUnitsInfo : PausableConditionalTraitInfo
@@ -21,9 +23,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Time (in ticks) between two repair steps.")] [Desc("Time (in ticks) between two repair steps.")]
public readonly int Interval = 24; public readonly int Interval = 24;
[NotificationReference("Speech")]
[Desc("The sound played when starting to repair a unit.")] [Desc("The sound played when starting to repair a unit.")]
public readonly string StartRepairingNotification = null; public readonly string StartRepairingNotification = null;
[NotificationReference("Speech")]
[Desc("The sound played when repairing a unit is done.")] [Desc("The sound played when repairing a unit is done.")]
public readonly string FinishRepairingNotification = null; public readonly string FinishRepairingNotification = null;

View File

@@ -15,7 +15,9 @@ namespace OpenRA.Mods.Common.Traits.Sound
{ {
class ActorLostNotificationInfo : ITraitInfo class ActorLostNotificationInfo : ITraitInfo
{ {
[NotificationReference("Speech")]
public readonly string Notification = "UnitLost"; public readonly string Notification = "UnitLost";
public readonly bool NotifyAll = false; public readonly bool NotifyAll = false;
public object Create(ActorInitializer init) { return new ActorLostNotification(this); } public object Create(ActorInitializer init) { return new ActorLostNotification(this); }

View File

@@ -21,6 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
[Desc("Should there be a radar ping on enemies' radar at the actor's location when they see him")] [Desc("Should there be a radar ping on enemies' radar at the actor's location when they see him")]
public readonly bool PingRadar = false; public readonly bool PingRadar = false;
[NotificationReference("Speech")]
public readonly string Notification = null; public readonly string Notification = null;
public readonly bool AnnounceNeutrals = false; public readonly bool AnnounceNeutrals = false;

View File

@@ -15,12 +15,14 @@ namespace OpenRA.Mods.Common.Traits.Sound
{ {
public class CaptureNotificationInfo : ITraitInfo public class CaptureNotificationInfo : ITraitInfo
{ {
[NotificationReference("Speech")]
[Desc("The speech notification to play to the new owner.")] [Desc("The speech notification to play to the new owner.")]
public readonly string Notification = "BuildingCaptured"; public readonly string Notification = "BuildingCaptured";
[Desc("Specifies if Notification is played with the voice of the new owners faction.")] [Desc("Specifies if Notification is played with the voice of the new owners faction.")]
public readonly bool NewOwnerVoice = true; public readonly bool NewOwnerVoice = true;
[NotificationReference("Speech")]
[Desc("The speech notification to play to the old owner.")] [Desc("The speech notification to play to the old owner.")]
public readonly string LoseNotification = null; public readonly string LoseNotification = null;

View File

@@ -26,6 +26,7 @@ namespace OpenRA.Mods.Common.Traits
public readonly int SquadSize = 1; public readonly int SquadSize = 1;
public readonly WVec SquadOffset = new WVec(-1536, 1536, 0); public readonly WVec SquadOffset = new WVec(-1536, 1536, 0);
[NotificationReference("Speech")]
[Desc("Notification to play when entering the drop zone.")] [Desc("Notification to play when entering the drop zone.")]
public readonly string ReinforcementsArrivedSpeechNotification = null; public readonly string ReinforcementsArrivedSpeechNotification = null;

View File

@@ -26,10 +26,12 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Production queue type to use")] [Desc("Production queue type to use")]
public readonly string Type = null; public readonly string Type = null;
[NotificationReference("Speech")]
[Desc("Notification played when production is activated.", [Desc("Notification played when production is activated.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string ReadyAudio = null; public readonly string ReadyAudio = null;
[NotificationReference("Speech")]
[Desc("Notification played when the exit is jammed.", [Desc("Notification played when the exit is jammed.",
"The filename of the audio is defined per faction in notifications.yaml.")] "The filename of the audio is defined per faction in notifications.yaml.")]
public readonly string BlockedAudio = null; public readonly string BlockedAudio = null;

View File

@@ -32,16 +32,33 @@ namespace OpenRA.Mods.Common.Traits
public readonly string[] Prerequisites = { }; public readonly string[] Prerequisites = { };
public readonly string BeginChargeSound = null; public readonly string BeginChargeSound = null;
[NotificationReference("Speech")]
public readonly string BeginChargeSpeechNotification = null; public readonly string BeginChargeSpeechNotification = null;
public readonly string EndChargeSound = null; public readonly string EndChargeSound = null;
[NotificationReference("Speech")]
public readonly string EndChargeSpeechNotification = null; public readonly string EndChargeSpeechNotification = null;
public readonly string SelectTargetSound = null; public readonly string SelectTargetSound = null;
[NotificationReference("Speech")]
public readonly string SelectTargetSpeechNotification = null; public readonly string SelectTargetSpeechNotification = null;
public readonly string InsufficientPowerSound = null; public readonly string InsufficientPowerSound = null;
[NotificationReference("Speech")]
public readonly string InsufficientPowerSpeechNotification = null; public readonly string InsufficientPowerSpeechNotification = null;
public readonly string LaunchSound = null; public readonly string LaunchSound = null;
[NotificationReference("Speech")]
public readonly string LaunchSpeechNotification = null; public readonly string LaunchSpeechNotification = null;
public readonly string IncomingSound = null; public readonly string IncomingSound = null;
[NotificationReference("Speech")]
public readonly string IncomingSpeechNotification = null; public readonly string IncomingSpeechNotification = null;
[Desc("Defines to which players the timer is shown.")] [Desc("Defines to which players the timer is shown.")]

View File

@@ -34,9 +34,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Sounds to play when the transformation is blocked.")] [Desc("Sounds to play when the transformation is blocked.")]
public readonly string[] NoTransformSounds = { }; public readonly string[] NoTransformSounds = { };
[NotificationReference("Speech")]
[Desc("Notification to play when transforming.")] [Desc("Notification to play when transforming.")]
public readonly string TransformNotification = null; public readonly string TransformNotification = null;
[NotificationReference("Speech")]
[Desc("Notification to play when the transformation is blocked.")] [Desc("Notification to play when the transformation is blocked.")]
public readonly string NoTransformNotification = null; public readonly string NoTransformNotification = null;

View File

@@ -16,6 +16,7 @@ namespace OpenRA.Mods.Common.Traits
{ {
class StartGameNotificationInfo : ITraitInfo class StartGameNotificationInfo : ITraitInfo
{ {
[NotificationReference("Speech")]
public readonly string Notification = "StartGame"; public readonly string Notification = "StartGame";
public object Create(ActorInitializer init) { return new StartGameNotification(this); } public object Create(ActorInitializer init) { return new StartGameNotification(this); }

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.D2k.Traits
public readonly string WormAttackSound = "WORM.WAV"; public readonly string WormAttackSound = "WORM.WAV";
[NotificationReference("Speech")]
public readonly string WormAttackNotification = "WormAttack"; public readonly string WormAttackNotification = "WormAttack";
public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); } public override object Create(ActorInitializer init) { return new AttackSwallow(init.Self, this); }