Fix Chronoshift / Demotruck interaction

This commit is contained in:
Paul Chote
2010-01-24 17:34:09 +13:00
parent c4ffd49add
commit 86df2cd0d5
3 changed files with 35 additions and 16 deletions

View File

@@ -48,20 +48,24 @@ namespace OpenRa.Traits
var chronosphere = self.World.Actors.Where(a => a.Owner == self.Owner
&& a.traits.Contains<Chronosphere>()).FirstOrDefault();
if (chronosphere != null)
chronosphere.traits.Get<RenderBuilding>().PlayCustomAnim( chronosphere, "active" );
// Trigger screen desaturate effect
foreach (var a in self.World.Actors.Where(a => a.traits.Contains<ChronoshiftPaletteEffect>()))
a.traits.Get<ChronoshiftPaletteEffect>().DoChronoshift();
Sound.Play("chrono2.aud");
order.TargetActor.traits.Get<Chronoshiftable>().Activate(order.TargetActor,
bool success = order.TargetActor.traits.Get<Chronoshiftable>().Activate(order.TargetActor,
order.TargetLocation,
(int)((Info as ChronoshiftPowerInfo).Duration * 25 * 60),
(Info as ChronoshiftPowerInfo).KillCargo,
chronosphere);
if (success)
{
Sound.Play("chrono2.aud");
// Trigger screen desaturate effect
foreach (var a in self.World.Actors.Where(a => a.traits.Contains<ChronoshiftPaletteEffect>()))
a.traits.Get<ChronoshiftPaletteEffect>().DoChronoshift();
if (chronosphere != null)
chronosphere.traits.Get<RenderBuilding>().PlayCustomAnim(chronosphere, "active");
}
Game.controller.CancelInputMode();
FinishActivate();

View File

@@ -37,7 +37,7 @@ namespace OpenRa.Traits
}
}
public virtual void Activate(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
public virtual bool Activate(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere)
{
/// Set up return-to-sender info
chronoshiftOrigin = self.Location;
@@ -57,6 +57,8 @@ namespace OpenRa.Traits
// Set up the teleport
self.CancelActivity();
self.QueueActivity(new Activities.Teleport(targetLocation));
return true;
}
}
}