From cace31f5e9d25117373fb3a2bba335ea0f559fac Mon Sep 17 00:00:00 2001 From: Taryn Hill Date: Fri, 8 May 2015 09:52:34 -0500 Subject: [PATCH] Implement WithDecorationCarryable. --- OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj | 1 + .../Traits/Render/WithDecorationCarryable.cs | 38 +++++++++++++++++++ mods/d2k/rules/vehicles.yaml | 4 ++ mods/d2k/sequences/misc.yaml | 2 + 4 files changed, 45 insertions(+) create mode 100644 OpenRA.Mods.D2k/Traits/Render/WithDecorationCarryable.cs diff --git a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj index 28bf2f6044..62e1e86805 100644 --- a/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj +++ b/OpenRA.Mods.D2k/OpenRA.Mods.D2k.csproj @@ -97,6 +97,7 @@ + diff --git a/OpenRA.Mods.D2k/Traits/Render/WithDecorationCarryable.cs b/OpenRA.Mods.D2k/Traits/Render/WithDecorationCarryable.cs new file mode 100644 index 0000000000..68f3369833 --- /dev/null +++ b/OpenRA.Mods.D2k/Traits/Render/WithDecorationCarryable.cs @@ -0,0 +1,38 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 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 COPYING. + */ +#endregion + +using System; +using OpenRA.Mods.Common.Traits; +using OpenRA.Traits; + +namespace OpenRA.Mods.D2k.Traits +{ + [Desc("Displays a sprite when the carryable actor is waiting for pickup.")] + public class WithDecorationCarryableInfo : WithDecorationInfo, Requires + { + public override object Create(ActorInitializer init) { return new WithDecorationCarryable(init.Self, this); } + } + + public class WithDecorationCarryable : WithDecoration + { + readonly Carryable carryable; + + public WithDecorationCarryable(Actor self, WithDecorationCarryableInfo info) + : base(self, info) + { + carryable = self.Trait(); + } + + public override bool ShouldRender(Actor self) + { + return carryable.Reserved; + } + } +} diff --git a/mods/d2k/rules/vehicles.yaml b/mods/d2k/rules/vehicles.yaml index 91b43bded4..1c178d084d 100644 --- a/mods/d2k/rules/vehicles.yaml +++ b/mods/d2k/rules/vehicles.yaml @@ -62,6 +62,10 @@ harvester: SearchFromProcRadius: 24 SearchFromOrderRadius: 12 Carryable: + WithDecorationCarryable: + Image: pips + Sequence: pickup-indicator + Offset: -12, -12 Health: HP: 1000 Armor: diff --git a/mods/d2k/sequences/misc.yaml b/mods/d2k/sequences/misc.yaml index 3b7c17adbb..ce15cac2cc 100644 --- a/mods/d2k/sequences/misc.yaml +++ b/mods/d2k/sequences/misc.yaml @@ -112,6 +112,8 @@ pips: groups: DATA.R8 Start: 17 Length: 10 + pickup-indicator: DATA.R8 + Start: 112 tag-primary: DATA.R8 Start: 110 pip-empty: DATA.R8