Fix various Mods.Cnc animation traits not supporting actors having multiple sprite bodies

This commit is contained in:
reaperrr
2018-05-17 09:54:00 +02:00
committed by Matthias Mailänder
parent 9d24c40f92
commit d060f885e8
4 changed files with 24 additions and 10 deletions

View File

@@ -24,6 +24,9 @@ namespace OpenRA.Mods.Cnc.Traits.Render
[SequenceReference] public readonly string CloseSequence = "close";
[SequenceReference] public readonly string UnloadSequence = "unload";
[Desc("Which sprite body to play the animation on.")]
public readonly string Body = "body";
public object Create(ActorInitializer init) { return new WithLandingCraftAnimation(init, this); }
}
@@ -42,7 +45,7 @@ namespace OpenRA.Mods.Cnc.Traits.Render
self = init.Self;
cargo = self.Trait<Cargo>();
move = self.Trait<IMove>();
wsb = init.Self.Trait<WithSpriteBody>();
wsb = init.Self.TraitsImplementing<WithSpriteBody>().Single(w => w.Info.Name == info.Body);
}
public bool ShouldBeOpen()