merged. may not actually work yet.

This commit is contained in:
Chris Forbes
2010-01-09 11:34:44 +13:00
10 changed files with 66 additions and 65 deletions

View File

@@ -2,7 +2,6 @@
using OpenRa.Game.Orders;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
namespace OpenRa.Game.Traits
{
@@ -40,7 +39,8 @@ namespace OpenRa.Game.Traits
{
if (order.OrderString == "ChronosphereSelect")
{
Game.controller.orderGenerator = new ChronoshiftDestinationOrderGenerator(self);
var power = self.Owner.SupportPowers[order.TargetString];
Game.controller.orderGenerator = new ChronoshiftDestinationOrderGenerator(self, power);
}
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
@@ -49,38 +49,28 @@ namespace OpenRa.Game.Traits
// Cannot chronoshift into unexplored location
if (!self.Owner.Shroud.IsExplored(order.TargetLocation))
return;
// Set up return-to-sender info
chronoshiftOrigin = self.Location;
chronoshiftReturnTicks = (int)(Rules.General.ChronoDuration * 60 * 25);
var chronosphere = Game.world.Actors.Where(a => a.Owner == order.Subject.Owner
&& a.traits.Contains<Chronosphere>()).FirstOrDefault();
// Kill cargo
if (Rules.General.ChronoKillCargo && self.traits.Contains<Cargo>())
{
var cargo = self.traits.Get<Cargo>();
while (!cargo.IsEmpty(self))
{
if (chronosphere != null)
chronosphere.Owner.Kills++;
order.Player.Kills++;
cargo.Unload(self);
}
}
// Set up the teleport
Game.controller.CancelInputMode();
self.CancelActivity();
self.QueueActivity(new Activities.Teleport(order.TargetLocation));
Sound.Play("chrono2.aud");
foreach (var a in Game.world.Actors.Where(a => a.traits.Contains<ChronoshiftPaletteEffect>()))
a.traits.Get<ChronoshiftPaletteEffect>().DoChronoshift();
// Play chronosphere active anim
if (chronosphere != null)
chronosphere.traits.Get<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
var power = self.Owner.SupportPowers[order.TargetString].Impl;
power.OnFireNotification(self, self.Location);
}
}