Fix multi-turreted actors not appearing in the map editor.

This commit is contained in:
Paul Chote
2018-03-22 08:06:48 +00:00
committed by abcdefg30
parent 6b24271a17
commit 7e94fa8c8a

View File

@@ -35,7 +35,10 @@ namespace OpenRA.Mods.Common.Traits
IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type) IEnumerable<object> IActorPreviewInitInfo.ActorPreviewInits(ActorInfo ai, ActorPreviewType type)
{ {
yield return new TurretFacingInit(PreviewFacing); // HACK: The ActorInit system does not support multiple instances of the same type
// Make sure that we only return one TurretFacingInit, even for actors with multiple turrets
if (ai.TraitInfos<TurretedInfo>().FirstOrDefault() == this)
yield return new TurretFacingInit(PreviewFacing);
} }
public virtual object Create(ActorInitializer init) { return new Turreted(init, this); } public virtual object Create(ActorInitializer init) { return new Turreted(init, this); }