fixed #2289 - missing chrono effects on return

This commit is contained in:
Chris Forbes
2012-07-01 14:21:43 +12:00
parent 0a4669b925
commit 5fee165692
4 changed files with 11 additions and 24 deletions

View File

@@ -10,6 +10,7 @@
using System.Linq; using System.Linq;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Mods.RA.Render;
namespace OpenRA.Mods.RA.Activities namespace OpenRA.Mods.RA.Activities
{ {
@@ -28,6 +29,9 @@ namespace OpenRA.Mods.RA.Activities
public override Activity Tick(Actor self) public override Activity Tick(Actor self)
{ {
Sound.Play("chrono2.aud", self.Location.ToPPos());
Sound.Play("chrono2.aud", destination.ToPPos());
self.Trait<ITeleportable>().SetPosition(self, destination); self.Trait<ITeleportable>().SetPosition(self, destination);
if (killCargo && self.HasTrait<Cargo>()) if (killCargo && self.HasTrait<Cargo>())
@@ -42,6 +46,13 @@ namespace OpenRA.Mods.RA.Activities
} }
} }
// Trigger screen desaturate effect
foreach (var a in self.World.ActorsWithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable();
if (chronosphere != null && !chronosphere.Destroyed && chronosphere.HasTrait<RenderBuilding>())
chronosphere.Trait<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
return NextActivity; return NextActivity;
} }
} }

View File

@@ -56,12 +56,7 @@ namespace OpenRA.Mods.RA
self.CancelActivity(); self.CancelActivity();
self.QueueActivity(new Teleport(null, order.TargetLocation, true)); self.QueueActivity(new Teleport(null, order.TargetLocation, true));
Sound.Play("chrotnk1.aud", self.CenterLocation);
Sound.Play("chrotnk1.aud", order.TargetLocation.ToPPos());
chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime; chargeTick = 25 * self.Info.Traits.Get<ChronoshiftDeployInfo>().ChargeTime;
foreach (var a in self.World.ActorsWithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable();
} }
} }

View File

@@ -20,15 +20,6 @@ namespace OpenRA.Scripting
{ {
public static void Chronoshift(World world, List<Pair<Actor, CPos>> units, Actor chronosphere, int duration, bool killCargo) public static void Chronoshift(World world, List<Pair<Actor, CPos>> units, Actor chronosphere, int duration, bool killCargo)
{ {
if (chronosphere != null)
chronosphere.Trait<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
// Trigger screen desaturate effect
foreach (var a in world.ActorsWithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable();
Sound.Play("chrono2.aud", units.First().First.CenterLocation);
foreach (var kv in units) foreach (var kv in units)
{ {
var target = kv.First; var target = kv.First;
@@ -37,8 +28,6 @@ namespace OpenRA.Scripting
if (cs.CanChronoshiftTo(target, targetCell, true)) if (cs.CanChronoshiftTo(target, targetCell, true))
cs.Teleport(target, targetCell, duration, killCargo,chronosphere); cs.Teleport(target, targetCell, duration, killCargo,chronosphere);
} }
} }
} }
} }

View File

@@ -39,14 +39,6 @@ namespace OpenRA.Mods.RA
public override void Activate(Actor self, Order order) public override void Activate(Actor self, Order order)
{ {
self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");
// Trigger screen desaturate effect
foreach (var a in self.World.ActorsWithTrait<ChronoshiftPaletteEffect>())
a.Trait.Enable();
Sound.Play("chrono2.aud", order.TargetLocation.ToPPos());
Sound.Play("chrono2.aud", order.ExtraLocation.ToPPos());
foreach (var target in UnitsInRange(order.ExtraLocation)) foreach (var target in UnitsInRange(order.ExtraLocation))
{ {
var cs = target.Trait<Chronoshiftable>(); var cs = target.Trait<Chronoshiftable>();