From 40d0e20fe15b2977fffb5698c1a71cb825a6024c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 20 Jul 2014 13:55:11 +0200 Subject: [PATCH] configurable and self-documenting idle sequence name --- OpenRA.Mods.RA/Render/WithVoxelBody.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.RA/Render/WithVoxelBody.cs b/OpenRA.Mods.RA/Render/WithVoxelBody.cs index 7db92c7482..af28a54528 100755 --- a/OpenRA.Mods.RA/Render/WithVoxelBody.cs +++ b/OpenRA.Mods.RA/Render/WithVoxelBody.cs @@ -1,6 +1,6 @@ #region Copyright & License Information /* - * Copyright 2007-2013 The OpenRA Developers (see AUTHORS) + * Copyright 2007-2014 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, @@ -15,21 +15,24 @@ using OpenRA.Traits; namespace OpenRA.Mods.RA.Render { + [Desc("Also returns a default selection size that is calculated automatically from the voxel dimensions.")] public class WithVoxelBodyInfo : ITraitInfo, Requires { - public object Create(ActorInitializer init) { return new WithVoxelBody(init.self); } + public readonly string Sequence = "idle"; + + public object Create(ActorInitializer init) { return new WithVoxelBody(init.self, this); } } public class WithVoxelBody : IAutoSelectionSize { int2 size; - public WithVoxelBody(Actor self) + public WithVoxelBody(Actor self, WithVoxelBodyInfo info) { var body = self.Trait(); var rv = self.Trait(); - var voxel = VoxelProvider.GetVoxel(rv.Image, "idle"); + var voxel = VoxelProvider.GetVoxel(rv.Image, info.Sequence); rv.Add(new VoxelAnimation(voxel, () => WVec.Zero, () => new[]{ body.QuantizeOrientation(self, self.Orientation) }, () => false, () => 0));