From bd03479e7de0f86205891805a322d92964512936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 14 Feb 2016 11:56:52 +0100 Subject: [PATCH 1/2] Remove trailing space. --- mods/ts/sequences/misc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ts/sequences/misc.yaml b/mods/ts/sequences/misc.yaml index 8879f3befc..87dcaf1398 100644 --- a/mods/ts/sequences/misc.yaml +++ b/mods/ts/sequences/misc.yaml @@ -89,7 +89,7 @@ darken: Length: 1 pips: - medic: + medic: Start: 6 groups: pipsra #TODO: backfall to RA asset Start: 8 From 92e9cf2819e8ee1fafe702132bc7a3676a104b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 14 Feb 2016 12:36:45 +0100 Subject: [PATCH 2/2] Add the Tiberian Sun beacon animation. --- OpenRA.Mods.TS/Effects/AnimatedBeacon.cs | 64 +++++++++++++++++ OpenRA.Mods.TS/OpenRA.Mods.TS.csproj | 2 + OpenRA.Mods.TS/Player/PlaceSimpleBeacon.cs | 81 ++++++++++++++++++++++ mods/ts/rules/player.yaml | 2 +- mods/ts/sequences/misc.yaml | 10 +-- 5 files changed, 151 insertions(+), 8 deletions(-) create mode 100644 OpenRA.Mods.TS/Effects/AnimatedBeacon.cs create mode 100644 OpenRA.Mods.TS/Player/PlaceSimpleBeacon.cs diff --git a/OpenRA.Mods.TS/Effects/AnimatedBeacon.cs b/OpenRA.Mods.TS/Effects/AnimatedBeacon.cs new file mode 100644 index 0000000000..de5099f904 --- /dev/null +++ b/OpenRA.Mods.TS/Effects/AnimatedBeacon.cs @@ -0,0 +1,64 @@ +#region Copyright & License Information +/* + * Copyright 2007-2016 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, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using OpenRA.Effects; +using OpenRA.Graphics; +using OpenRA.Scripting; + +namespace OpenRA.Mods.TS.Effects +{ + public class AnimatedBeacon : IEffect + { + readonly Player owner; + readonly WPos position; + readonly string beaconPalette; + readonly bool isPlayerPalette; + readonly Animation beacon; + + public AnimatedBeacon(Player owner, WPos position, int duration, string beaconPalette, bool isPlayerPalette, string beaconImage, string beaconSequence) + { + this.owner = owner; + this.position = position; + this.beaconPalette = beaconPalette; + this.isPlayerPalette = isPlayerPalette; + + if (!string.IsNullOrEmpty(beaconSequence)) + { + beacon = new Animation(owner.World, beaconImage); + beacon.PlayRepeating(beaconSequence); + } + + if (duration > 0) + owner.World.Add(new DelayedAction(duration, () => owner.World.Remove(this))); + } + + public void Tick(World world) + { + if (beacon != null) + beacon.Tick(); + } + + public IEnumerable Render(WorldRenderer r) + { + if (beacon == null) + return Enumerable.Empty(); + + if (!owner.IsAlliedWith(owner.World.RenderPlayer)) + return Enumerable.Empty(); + + var palette = r.Palette(isPlayerPalette ? beaconPalette + owner.InternalName : beaconPalette); + return beacon.Render(position, palette); + } + } +} diff --git a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj index 8231450619..1c9f7a264d 100644 --- a/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj +++ b/OpenRA.Mods.TS/OpenRA.Mods.TS.csproj @@ -77,6 +77,8 @@ + +