Merge pull request #10576 from abcdefg30/bridgeRepaired

Add support for playing a BridgeRepaired notification
This commit is contained in:
Matthias Mailänder
2016-01-28 20:09:05 +01:00
3 changed files with 10 additions and 2 deletions

View File

@@ -16,11 +16,13 @@ namespace OpenRA.Mods.Common.Activities
class RepairBridge : Enter class RepairBridge : Enter
{ {
readonly BridgeHut hut; readonly BridgeHut hut;
readonly string notification;
public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour) public RepairBridge(Actor self, Actor target, EnterBehaviour enterBehaviour, string notification)
: base(self, target, enterBehaviour) : base(self, target, enterBehaviour)
{ {
hut = target.Trait<BridgeHut>(); hut = target.Trait<BridgeHut>();
this.notification = notification;
} }
protected override bool CanReserve(Actor self) protected override bool CanReserve(Actor self)
@@ -34,6 +36,8 @@ namespace OpenRA.Mods.Common.Activities
return; return;
hut.Repair(self); hut.Repair(self);
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", notification, self.Owner.Faction.InternalName);
} }
} }
} }

View File

@@ -31,6 +31,9 @@ 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";
[Desc("Speech notification to play when a bridge is repaired.")]
public readonly string RepairNotification = null;
public object Create(ActorInitializer init) { return new RepairsBridges(this); } public object Create(ActorInitializer init) { return new RepairsBridges(this); }
} }
@@ -82,7 +85,7 @@ namespace OpenRA.Mods.Common.Traits
self.SetTargetLine(Target.FromOrder(self.World, order), Color.Yellow); self.SetTargetLine(Target.FromOrder(self.World, order), Color.Yellow);
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(new RepairBridge(self, order.TargetActor, info.EnterBehaviour)); self.QueueActivity(new RepairBridge(self, order.TargetActor, info.EnterBehaviour, info.RepairNotification));
} }
} }

View File

@@ -55,6 +55,7 @@ ENGINEER:
PipType: Yellow PipType: Yellow
EngineerRepair: EngineerRepair:
RepairsBridges: RepairsBridges:
RepairNotification: BridgeRepaired
Captures: Captures:
CaptureTypes: building CaptureTypes: building
-AutoTarget: -AutoTarget: