Allow skipping 'sell'/reversed make anim on Sell

This commit is contained in:
reaperrr
2017-08-10 19:58:18 +02:00
committed by Paul Chote
parent eb5fb5abba
commit f3f2621eeb

View File

@@ -23,6 +23,9 @@ namespace OpenRA.Mods.Common.Traits
public readonly int RefundPercent = 50; public readonly int RefundPercent = 50;
public readonly string[] SellSounds = { }; public readonly string[] SellSounds = { };
[Desc("Skip playing (reversed) make animation.")]
public readonly bool SkipMakeAnimation = false;
public override object Create(ActorInitializer init) { return new Sellable(init.Self, this); } public override object Create(ActorInitializer init) { return new Sellable(init.Self, this); }
} }
@@ -63,10 +66,16 @@ namespace OpenRA.Mods.Common.Traits
foreach (var ns in self.TraitsImplementing<INotifySold>()) foreach (var ns in self.TraitsImplementing<INotifySold>())
ns.Selling(self); ns.Selling(self);
if (!info.SkipMakeAnimation)
{
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>(); var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
if (makeAnimation != null) if (makeAnimation != null)
{
makeAnimation.Reverse(self, new Sell(self), false); makeAnimation.Reverse(self, new Sell(self), false);
else return;
}
}
self.QueueActivity(false, new Sell(self)); self.QueueActivity(false, new Sell(self));
} }