Add condition support to ActorLostNotification.
This commit is contained in:
@@ -13,7 +13,7 @@ using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits.Sound
|
||||
{
|
||||
class ActorLostNotificationInfo : TraitInfo
|
||||
class ActorLostNotificationInfo : ConditionalTraitInfo
|
||||
{
|
||||
[NotificationReference("Speech")]
|
||||
public readonly string Notification = "UnitLost";
|
||||
@@ -23,18 +23,18 @@ namespace OpenRA.Mods.Common.Traits.Sound
|
||||
public override object Create(ActorInitializer init) { return new ActorLostNotification(this); }
|
||||
}
|
||||
|
||||
class ActorLostNotification : INotifyKilled
|
||||
class ActorLostNotification : ConditionalTrait<ActorLostNotificationInfo>, INotifyKilled
|
||||
{
|
||||
ActorLostNotificationInfo info;
|
||||
public ActorLostNotification(ActorLostNotificationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
: base(info) { }
|
||||
|
||||
void INotifyKilled.Killed(Actor self, AttackInfo e)
|
||||
{
|
||||
var player = info.NotifyAll ? self.World.LocalPlayer : self.Owner;
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", info.Notification, self.Owner.Faction.InternalName);
|
||||
if (IsTraitDisabled)
|
||||
return;
|
||||
|
||||
var player = Info.NotifyAll ? self.World.LocalPlayer : self.Owner;
|
||||
Game.Sound.PlayNotification(self.World.Map.Rules, player, "Speech", Info.Notification, self.Owner.Faction.InternalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user