Fix various Mods.Common animation traits not supporting actors having multiple sprite bodies
This commit is contained in:
committed by
Matthias Mailänder
parent
0d0d2e0ae3
commit
9d24c40f92
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits.Render
|
||||
@@ -19,6 +20,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Sequence name to use"), SequenceReference]
|
||||
public readonly string Sequence = "build";
|
||||
|
||||
[Desc("Which sprite body to play the animation on.")]
|
||||
public readonly string Body = "body";
|
||||
|
||||
public object Create(ActorInitializer init) { return new WithBuildingPlacedAnimation(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -31,7 +35,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
public WithBuildingPlacedAnimation(Actor self, WithBuildingPlacedAnimationInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
wsb = self.Trait<WithSpriteBody>();
|
||||
wsb = self.TraitsImplementing<WithSpriteBody>().Single(w => w.Info.Name == info.Body);
|
||||
buildComplete = !self.Info.HasTraitInfo<BuildingInfo>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user