diff --git a/OpenRA.Mods.RA/Activities/Teleport.cs b/OpenRA.Mods.RA/Activities/Teleport.cs index cd54a55119..0b58ab398e 100755 --- a/OpenRA.Mods.RA/Activities/Teleport.cs +++ b/OpenRA.Mods.RA/Activities/Teleport.cs @@ -19,18 +19,20 @@ namespace OpenRA.Mods.RA.Activities CPos destination; bool killCargo; Actor chronosphere; + string sound; - public Teleport(Actor chronosphere, CPos destination, bool killCargo) + public Teleport(Actor chronosphere, CPos destination, bool killCargo, string sound) { this.chronosphere = chronosphere; this.destination = destination; this.killCargo = killCargo; + this.sound = sound; } public override Activity Tick(Actor self) { - Sound.Play("chrono2.aud", self.CenterPosition); - Sound.Play("chrono2.aud", destination.CenterPosition); + Sound.Play(sound, self.CenterPosition); + Sound.Play(sound, destination.CenterPosition); self.Trait().SetPosition(self, destination); self.Generation++; diff --git a/OpenRA.Mods.RA/ChronoshiftDeploy.cs b/OpenRA.Mods.RA/ChronoshiftDeploy.cs index dcb38027f3..5812d05f78 100644 --- a/OpenRA.Mods.RA/ChronoshiftDeploy.cs +++ b/OpenRA.Mods.RA/ChronoshiftDeploy.cs @@ -22,6 +22,8 @@ namespace OpenRA.Mods.RA { public readonly int ChargeTime = 30; // seconds public readonly int JumpDistance = 10; + public readonly string ChronoshiftSound = "chrotnk1.aud"; + public object Create(ActorInitializer init) { return new ChronoshiftDeploy(init.self, this); } } @@ -63,7 +65,7 @@ namespace OpenRA.Mods.RA if (CanJumpTo(order.TargetLocation, true)) { self.CancelActivity(); - self.QueueActivity(new Teleport(null, order.TargetLocation, true)); + self.QueueActivity(new Teleport(null, order.TargetLocation, true, Info.ChronoshiftSound)); chargeTick = 25 * Info.ChargeTime; } } diff --git a/OpenRA.Mods.RA/Chronoshiftable.cs b/OpenRA.Mods.RA/Chronoshiftable.cs index 574320ae88..44e54bc9e4 100755 --- a/OpenRA.Mods.RA/Chronoshiftable.cs +++ b/OpenRA.Mods.RA/Chronoshiftable.cs @@ -14,9 +14,12 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA { - class ChronoshiftableInfo : TraitInfo + public class ChronoshiftableInfo : ITraitInfo { public readonly bool ExplodeInstead = false; + public readonly string ChronoshiftSound = "chrono2.aud"; + + public object Create(ActorInitializer init) { return new Chronoshiftable(this); } } public class Chronoshiftable : ITick, ISync, ISelectionBar @@ -27,6 +30,12 @@ namespace OpenRA.Mods.RA Actor chronosphere; bool killCargo; int TotalTicks; + readonly ChronoshiftableInfo info; + + public Chronoshiftable(ChronoshiftableInfo info) + { + this.info = info; + } public void Tick(Actor self) { @@ -41,7 +50,7 @@ namespace OpenRA.Mods.RA { self.CancelActivity(); // TODO: need a new Teleport method that will move to the closest available cell - self.QueueActivity(new Teleport(chronosphere, chronoshiftOrigin, killCargo)); + self.QueueActivity(new Teleport(chronosphere, chronoshiftOrigin, killCargo, info.ChronoshiftSound)); } } @@ -54,7 +63,6 @@ namespace OpenRA.Mods.RA public virtual bool Teleport(Actor self, CPos targetLocation, int duration, bool killCargo, Actor chronosphere) { - var info = self.Info.Traits.Get(); if (info.ExplodeInstead) // some things appear chronoshiftable, but instead they just die. { self.World.AddFrameEndTask(w => @@ -74,7 +82,7 @@ namespace OpenRA.Mods.RA // Set up the teleport self.CancelActivity(); - self.QueueActivity(new Teleport(chronosphere, targetLocation, killCargo)); + self.QueueActivity(new Teleport(chronosphere, targetLocation, killCargo, info.ChronoshiftSound)); return true; } diff --git a/mods/ra/bits/chrotnk1.aud b/mods/ra/bits/chrotnk1.aud new file mode 100644 index 0000000000..3a800484ff Binary files /dev/null and b/mods/ra/bits/chrotnk1.aud differ