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,11 +66,17 @@ 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);
var makeAnimation = self.TraitOrDefault<WithMakeAnimation>(); if (!info.SkipMakeAnimation)
if (makeAnimation != null) {
makeAnimation.Reverse(self, new Sell(self), false); var makeAnimation = self.TraitOrDefault<WithMakeAnimation>();
else if (makeAnimation != null)
self.QueueActivity(false, new Sell(self)); {
makeAnimation.Reverse(self, new Sell(self), false);
return;
}
}
self.QueueActivity(false, new Sell(self));
} }
public bool IsTooltipVisible(Player forPlayer) public bool IsTooltipVisible(Player forPlayer)