From 8b0255e2f7991ccf281bf9c439ee7b811a5c0ebe Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 23 Nov 2010 22:53:14 +1300 Subject: [PATCH] Fix the RA shellmap. --- OpenRA.Mods.RA/Chronoshiftable.cs | 2 +- OpenRA.Mods.RA/DefaultShellmapScript.cs | 11 +++-- OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 3 +- OpenRA.Mods.RA/Scripting/RASpecialPowers.cs | 50 +++++++++++++++++++++ 4 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 OpenRA.Mods.RA/Scripting/RASpecialPowers.cs diff --git a/OpenRA.Mods.RA/Chronoshiftable.cs b/OpenRA.Mods.RA/Chronoshiftable.cs index a7bfff917e..bcb306bf33 100755 --- a/OpenRA.Mods.RA/Chronoshiftable.cs +++ b/OpenRA.Mods.RA/Chronoshiftable.cs @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA // Todo: Allow enemy units to be chronoshifted into bad terrain to kill them return self.HasTrait() && self.Trait().CanEnterCell(targetLocation) && - self.World.LocalPlayer.Shroud.IsExplored(targetLocation); + (self.World.LocalPlayer == null || self.World.LocalPlayer.Shroud.IsExplored(targetLocation)); } public virtual bool Teleport(Actor self, int2 targetLocation, int duration, bool killCargo, Actor chronosphere) diff --git a/OpenRA.Mods.RA/DefaultShellmapScript.cs b/OpenRA.Mods.RA/DefaultShellmapScript.cs index 24a1b9acad..706de03498 100755 --- a/OpenRA.Mods.RA/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/DefaultShellmapScript.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using OpenRA.Mods.RA.Air; using OpenRA.Traits; +using OpenRA.FileFormats; namespace OpenRA.Mods.RA { @@ -45,9 +46,13 @@ namespace OpenRA.Mods.RA if (ticks == 250) { - //Actors["pdox"].Trait().Teleport(Actors["ca1"], new int2(90, 70)); - //Actors["pdox"].Trait().Teleport(Actors["ca2"], new int2(92, 71)); - } + Scripting.RASpecialPowers.Chronoshift(self.World, new List>() + { + Pair.New(Actors["ca1"], new int2(90, 70)), + Pair.New(Actors["ca2"], new int2(92, 71)) + }, Actors["pdox"], -1, false); + } + if (ticks == 100) Actors["mslo1"].Trait().Attack(new int2(98, 52)); if (ticks == 140) diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index 6e7ebbbe19..3bbf53fa1b 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -1,4 +1,4 @@ - + Debug @@ -311,6 +311,7 @@ + diff --git a/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs b/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs new file mode 100644 index 0000000000..eb4dd1df71 --- /dev/null +++ b/OpenRA.Mods.RA/Scripting/RASpecialPowers.cs @@ -0,0 +1,50 @@ +#region Copyright & License Information +/* + * Copyright 2007-2010 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see LICENSE. + */ +#endregion + +using OpenRA.FileFormats; +using OpenRA.Mods.RA; +using OpenRA.Mods.RA.Render; +using System.Collections.Generic; +using System.Linq; + +namespace OpenRA.Scripting +{ + public class RASpecialPowers + { + public static void Chronoshift(World world, List>units, Actor chronosphere, int duration, bool killCargo) + { + if (chronosphere != null) + chronosphere.Trait().PlayCustomAnim(chronosphere, "active"); + + // Trigger screen desaturate effect + foreach (var a in world.Queries.WithTrait()) + a.Trait.Enable(); + + Sound.Play("chrono2.aud", units.First().First.CenterLocation); + + foreach (var kv in units) + { + var target = kv.First; + var targetCell = kv.Second; + System.Console.WriteLine("{0} {1}",target, targetCell); + + var cs = target.Trait(); + if (cs.CanChronoshiftTo(target, targetCell)) + target.Trait().Teleport(target, + targetCell, + duration, + killCargo, + chronosphere); + } + + + } + } +}