Use correct sound for teleporting chronotanks
This commit is contained in:
@@ -19,18 +19,20 @@ namespace OpenRA.Mods.RA.Activities
|
|||||||
CPos destination;
|
CPos destination;
|
||||||
bool killCargo;
|
bool killCargo;
|
||||||
Actor chronosphere;
|
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.chronosphere = chronosphere;
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
this.killCargo = killCargo;
|
this.killCargo = killCargo;
|
||||||
|
this.sound = sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
Sound.Play("chrono2.aud", self.CenterPosition);
|
Sound.Play(sound, self.CenterPosition);
|
||||||
Sound.Play("chrono2.aud", destination.CenterPosition);
|
Sound.Play(sound, destination.CenterPosition);
|
||||||
|
|
||||||
self.Trait<ITeleportable>().SetPosition(self, destination);
|
self.Trait<ITeleportable>().SetPosition(self, destination);
|
||||||
self.Generation++;
|
self.Generation++;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
public readonly int ChargeTime = 30; // seconds
|
public readonly int ChargeTime = 30; // seconds
|
||||||
public readonly int JumpDistance = 10;
|
public readonly int JumpDistance = 10;
|
||||||
|
public readonly string ChronoshiftSound = "chrotnk1.aud";
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ChronoshiftDeploy(init.self, this); }
|
public object Create(ActorInitializer init) { return new ChronoshiftDeploy(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +65,7 @@ namespace OpenRA.Mods.RA
|
|||||||
if (CanJumpTo(order.TargetLocation, true))
|
if (CanJumpTo(order.TargetLocation, true))
|
||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Teleport(null, order.TargetLocation, true));
|
self.QueueActivity(new Teleport(null, order.TargetLocation, true, Info.ChronoshiftSound));
|
||||||
chargeTick = 25 * Info.ChargeTime;
|
chargeTick = 25 * Info.ChargeTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,12 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class ChronoshiftableInfo : TraitInfo<Chronoshiftable>
|
public class ChronoshiftableInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly bool ExplodeInstead = false;
|
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
|
public class Chronoshiftable : ITick, ISync, ISelectionBar
|
||||||
@@ -27,6 +30,12 @@ namespace OpenRA.Mods.RA
|
|||||||
Actor chronosphere;
|
Actor chronosphere;
|
||||||
bool killCargo;
|
bool killCargo;
|
||||||
int TotalTicks;
|
int TotalTicks;
|
||||||
|
readonly ChronoshiftableInfo info;
|
||||||
|
|
||||||
|
public Chronoshiftable(ChronoshiftableInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -41,7 +50,7 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
// TODO: need a new Teleport method that will move to the closest available cell
|
// 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)
|
public virtual bool Teleport(Actor self, CPos targetLocation, int duration, bool killCargo, Actor chronosphere)
|
||||||
{
|
{
|
||||||
var info = self.Info.Traits.Get<ChronoshiftableInfo>();
|
|
||||||
if (info.ExplodeInstead) // some things appear chronoshiftable, but instead they just die.
|
if (info.ExplodeInstead) // some things appear chronoshiftable, but instead they just die.
|
||||||
{
|
{
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
@@ -74,7 +82,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
// Set up the teleport
|
// Set up the teleport
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
self.QueueActivity(new Teleport(chronosphere, targetLocation, killCargo));
|
self.QueueActivity(new Teleport(chronosphere, targetLocation, killCargo, info.ChronoshiftSound));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
mods/ra/bits/chrotnk1.aud
Normal file
BIN
mods/ra/bits/chrotnk1.aud
Normal file
Binary file not shown.
Reference in New Issue
Block a user