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