Chronosphere implementation plus supporting tweaks to Order
This commit is contained in:
@@ -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,7 @@ namespace OpenRa.Game.Traits
|
||||
{
|
||||
if (order.OrderString == "ChronosphereSelect")
|
||||
{
|
||||
Game.controller.orderGenerator = new ChronoshiftDestinationOrderGenerator(self);
|
||||
Game.controller.orderGenerator = new ChronoshiftDestinationOrderGenerator(self, order.SupportPowerImpl);
|
||||
}
|
||||
|
||||
var movement = self.traits.WithInterface<IMovement>().FirstOrDefault();
|
||||
@@ -49,37 +48,26 @@ namespace OpenRa.Game.Traits
|
||||
// Cannot chronoshift into unexplored location
|
||||
if (!Game.LocalPlayer.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");
|
||||
order.SupportPowerImpl.OnFireNotification(self, self.Location);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user