Merge pull request #6675 from Mailaender/ts-harvester-attack-notifier
Fixed Tiberian Sun harvester under attack notification not playing.
This commit is contained in:
@@ -15,12 +15,21 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
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 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;
|
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;
|
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); }
|
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)
|
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)
|
if (radarPings != null)
|
||||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||||
|
|||||||
@@ -14,12 +14,21 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
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 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;
|
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;
|
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); }
|
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)
|
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)
|
if (radarPings != null)
|
||||||
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ Player:
|
|||||||
Shroud:
|
Shroud:
|
||||||
FrozenActorLayer:
|
FrozenActorLayer:
|
||||||
BaseAttackNotifier:
|
BaseAttackNotifier:
|
||||||
|
HarvesterAttackNotifier:
|
||||||
PlayerStatistics:
|
PlayerStatistics:
|
||||||
PlaceBeacon:
|
PlaceBeacon:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user