diff --git a/OpenRA.Game/Graphics/Util.cs b/OpenRA.Game/Graphics/Util.cs index dfd873c2d4..570b5e08a3 100644 --- a/OpenRA.Game/Graphics/Util.cs +++ b/OpenRA.Game/Graphics/Util.cs @@ -27,7 +27,7 @@ using OpenRA.FileFormats.Graphics; namespace OpenRA.Graphics { - static class Util + public static class Util { public static string[] ReadAllLines(Stream s) { diff --git a/OpenRA.Mods.Cnc/Effects/IonCannon.cs b/OpenRA.Mods.Cnc/Effects/IonCannon.cs index 265f08b842..5181c0d224 100644 --- a/OpenRA.Mods.Cnc/Effects/IonCannon.cs +++ b/OpenRA.Mods.Cnc/Effects/IonCannon.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -45,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Effects public IEnumerable Render() { yield return new Renderable(anim.Image, - Util.CenterOfCell(Target) - new float2(.5f * anim.Image.size.X, anim.Image.size.Y - Game.CellSize), + Traits.Util.CenterOfCell(Target) - new float2(.5f * anim.Image.size.X, anim.Image.size.Y - Game.CellSize), "effect"); } diff --git a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs index 332b3814da..d7dbaf266f 100644 --- a/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs +++ b/OpenRA.Mods.RA/ChronoshiftPaletteEffect.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -20,6 +20,7 @@ using System.Drawing; using OpenRA.Traits; +using OpenRA.Graphics; namespace OpenRA.Mods.RA { @@ -45,17 +46,18 @@ namespace OpenRA.Mods.RA { if (remainingFrames == 0) return; - /* TODO: FIX ME + var frac = (float)remainingFrames / chronoEffectLength; - for( var y = 0; y < (int)PaletteType.Chrome; y++ ) + + // TODO: Fix me to only affect "world" palettes + for( var y = 0; y < b.Height; y++ ) for (var x = 0; x < 256; x++) { var orig = b.GetPixel(x, y); var lum = (int)(255 * orig.GetBrightness()); var desat = Color.FromArgb(orig.A, lum, lum, lum); - b.SetPixel(x, y, Graphics.Util.Lerp(frac, orig, desat)); + b.SetPixel(x, y, OpenRA.Graphics.Util.Lerp(frac, orig, desat)); } - */ } } } diff --git a/OpenRA.Mods.RA/ChronoshiftPower.cs b/OpenRA.Mods.RA/ChronoshiftPower.cs index 181139b950..5efb92f319 100644 --- a/OpenRA.Mods.RA/ChronoshiftPower.cs +++ b/OpenRA.Mods.RA/ChronoshiftPower.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -27,8 +27,6 @@ namespace OpenRA.Mods.RA { class ChronoshiftPowerInfo : SupportPowerInfo { - public readonly float Duration = 0f; - public readonly bool KillCargo = true; public override object Create(Actor self) { return new ChronoshiftPower(self,this); } } @@ -61,23 +59,7 @@ namespace OpenRA.Mods.RA .WithTrait() .Select(x => x.Actor).FirstOrDefault(); - bool success = order.TargetActor.traits.Get().Activate(order.TargetActor, - order.TargetLocation, - (int)((Info as ChronoshiftPowerInfo).Duration * 25 * 60), - (Info as ChronoshiftPowerInfo).KillCargo, - chronosphere); - - if (success) - { - Sound.Play("chrono2.aud", chronosphere.CenterLocation); - - // Trigger screen desaturate effect - foreach (var a in self.World.Queries.WithTrait()) - a.Trait.DoChronoshift(); - - if (chronosphere != null) - chronosphere.traits.Get().PlayCustomAnim(chronosphere, "active"); - } + chronosphere.traits.Get().Teleport(order.TargetActor, order.TargetLocation); FinishActivate(); } @@ -176,7 +158,37 @@ namespace OpenRA.Mods.RA } } - // tag trait to identify the building - class ChronosphereInfo : TraitInfo { } - public class Chronosphere { } + // tag trait for the building + class ChronosphereInfo : ITraitInfo + { + public readonly int Duration = 30; + public readonly bool KillCargo = true; + public object Create(Actor self) { return new Chronosphere(self); } + } + + class Chronosphere + { + Actor self; + public Chronosphere(Actor self) + { + this.self = self; + } + + public void Teleport(Actor targetActor, int2 targetLocation) + { + var info = self.Info.Traits.Get(); + bool success = targetActor.traits.Get().Activate(targetActor, targetLocation, info.Duration * 25, info.KillCargo, self); + + if (success) + { + Sound.Play("chrono2.aud", self.CenterLocation); + Sound.Play("chrono2.aud", targetActor.CenterLocation); + // Trigger screen desaturate effect + foreach (var a in self.World.Queries.WithTrait()) + a.Trait.DoChronoshift(); + + self.traits.Get().PlayCustomAnim(self, "active"); + } + } + } } diff --git a/OpenRA.Mods.RA/DefaultShellmapScript.cs b/OpenRA.Mods.RA/DefaultShellmapScript.cs index c9ce0ba372..decada2fa8 100644 --- a/OpenRA.Mods.RA/DefaultShellmapScript.cs +++ b/OpenRA.Mods.RA/DefaultShellmapScript.cs @@ -54,6 +54,8 @@ namespace OpenRA.Mods.RA int ticks = 0; public void Tick(Actor self) { + if (ticks == 250) + MapActors["pdox"].traits.Get().Teleport(MapActors["ca1"], new int2(90,70)); if (ticks == 100) MapActors["mslo1"].traits.Get().Attack(new int2(96,53)); if (ticks == 110) diff --git a/OpenRA.Mods.RA/Effects/Parachute.cs b/OpenRA.Mods.RA/Effects/Parachute.cs index 2733cefe54..85de93c4b6 100644 --- a/OpenRA.Mods.RA/Effects/Parachute.cs +++ b/OpenRA.Mods.RA/Effects/Parachute.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -72,7 +72,7 @@ namespace OpenRA.Mods.RA.Effects else { cargo.Location = loc; - cargo.CenterLocation = Util.CenterOfCell(loc); + cargo.CenterLocation = Traits.Util.CenterOfCell(loc); if (cargo.traits.Contains()) world.WorldActor.traits.Get().Add(cargo, cargo.traits.Get()); diff --git a/OpenRA.Mods.RA/RenderUnitRotor.cs b/OpenRA.Mods.RA/RenderUnitRotor.cs index e244353157..3c81870ba7 100644 --- a/OpenRA.Mods.RA/RenderUnitRotor.cs +++ b/OpenRA.Mods.RA/RenderUnitRotor.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -45,7 +45,7 @@ namespace OpenRA.Mods.RA rotorAnim.PlayRepeating("rotor"); anims.Add( "rotor_1", new AnimationWithOffset( rotorAnim, - () => Util.GetTurretPosition( self, unit, info.PrimaryOffset, 0 ), + () => Traits.Util.GetTurretPosition( self, unit, info.PrimaryOffset, 0 ), null ) { ZOffset = 1 } ); if (info.SecondaryOffset == null) return; @@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA secondRotorAnim.PlayRepeating( "rotor2" ); anims.Add( "rotor_2", new AnimationWithOffset( secondRotorAnim, - () => Util.GetTurretPosition(self, unit, info.SecondaryOffset, 0), + () => Traits.Util.GetTurretPosition(self, unit, info.SecondaryOffset, 0), null) { ZOffset = 1 }); } diff --git a/OpenRA.Mods.RA/RenderUnitSpinner.cs b/OpenRA.Mods.RA/RenderUnitSpinner.cs index 575fe94025..43f03fa51a 100644 --- a/OpenRA.Mods.RA/RenderUnitSpinner.cs +++ b/OpenRA.Mods.RA/RenderUnitSpinner.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA spinnerAnim.PlayRepeating( "spinner" ); anims.Add( "spinner", new AnimationWithOffset( spinnerAnim, - () => Util.GetTurretPosition( self, unit, info.Offset, 0 ), + () => Traits.Util.GetTurretPosition( self, unit, info.Offset, 0 ), null ) { ZOffset = 1 } ); } } diff --git a/OpenRA.Mods.RA/ThrowsParticles.cs b/OpenRA.Mods.RA/ThrowsParticles.cs index 419576fbcf..4dbeb887a0 100644 --- a/OpenRA.Mods.RA/ThrowsParticles.cs +++ b/OpenRA.Mods.RA/ThrowsParticles.cs @@ -1,4 +1,4 @@ -#region Copyright & License Information +#region Copyright & License Information /* * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. * This file is part of OpenRA. @@ -51,7 +51,7 @@ namespace OpenRA.Mods.RA if (info != null) { alt = 0; - pos = Util.GetTurretPosition(self, self.traits.Get(), info.Offset, 0); + pos = Traits.Util.GetTurretPosition(self, self.traits.Get(), info.Offset, 0); var ru = self.traits.Get(); v = Game.CosmeticRandom.Gauss2D(1) * info.Spread.RelOffset(); diff --git a/mods/ra/maps/shellmap/map.yaml b/mods/ra/maps/shellmap/map.yaml index a3acc3d90d..50d68c3c7f 100644 --- a/mods/ra/maps/shellmap/map.yaml +++ b/mods/ra/maps/shellmap/map.yaml @@ -1963,12 +1963,12 @@ Actors: Location: 89,84 Owner: Greece ActorReference@Actor385: - Id: Actor385 + Id: ca1 Type: ca Location: 119,66 Owner: GoodGuy ActorReference@Actor386: - Id: Actor386 + Id: ca2 Type: ca Location: 120,66 Owner: GoodGuy diff --git a/mods/ra/structures.yaml b/mods/ra/structures.yaml index 661db1826f..17c3200582 100644 --- a/mods/ra/structures.yaml +++ b/mods/ra/structures.yaml @@ -154,6 +154,8 @@ PDOX: Sight: 10 Bib: Chronosphere: + Duration: 180 + KillCargo: yes IronCurtainable: TSLA: diff --git a/mods/ra/system.yaml b/mods/ra/system.yaml index dc4688f3b2..caee403254 100644 --- a/mods/ra/system.yaml +++ b/mods/ra/system.yaml @@ -21,8 +21,6 @@ Player: LongDesc: Temporarily teleports a vehicle across \nthe map. Prerequisites: PDOX TechLevel: 12 - Duration: 3 - KillCargo: yes SelectTargetSound: slcttgt1.aud BeginChargeSound: chrochr1.aud EndChargeSound: chrordy1.aud