Implement WithDecorationCarryable.

This commit is contained in:
Taryn Hill
2015-05-08 09:52:34 -05:00
parent dd1cc4eb2f
commit cace31f5e9
4 changed files with 45 additions and 0 deletions

View File

@@ -97,6 +97,7 @@
<Compile Include="UtilityCommands\D2kMapImporter.cs" /> <Compile Include="UtilityCommands\D2kMapImporter.cs" />
<Compile Include="UtilityCommands\ImportD2kMapCommand.cs" /> <Compile Include="UtilityCommands\ImportD2kMapCommand.cs" />
<Compile Include="Traits\Render\WithAttackOverlay.cs" /> <Compile Include="Traits\Render\WithAttackOverlay.cs" />
<Compile Include="Traits\Render\WithDecorationCarryable.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>

View File

@@ -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<CarryableInfo>
{
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<Carryable>();
}
public override bool ShouldRender(Actor self)
{
return carryable.Reserved;
}
}
}

View File

@@ -62,6 +62,10 @@ harvester:
SearchFromProcRadius: 24 SearchFromProcRadius: 24
SearchFromOrderRadius: 12 SearchFromOrderRadius: 12
Carryable: Carryable:
WithDecorationCarryable:
Image: pips
Sequence: pickup-indicator
Offset: -12, -12
Health: Health:
HP: 1000 HP: 1000
Armor: Armor:

View File

@@ -112,6 +112,8 @@ pips:
groups: DATA.R8 groups: DATA.R8
Start: 17 Start: 17
Length: 10 Length: 10
pickup-indicator: DATA.R8
Start: 112
tag-primary: DATA.R8 tag-primary: DATA.R8
Start: 110 Start: 110
pip-empty: DATA.R8 pip-empty: DATA.R8