From 8914227811dbd7d78b16b9e960b26a7c3b8cc33a Mon Sep 17 00:00:00 2001 From: Mustafa Alperen Seki Date: Fri, 3 Nov 2017 19:34:10 +0300 Subject: [PATCH] Add ShowTicks to sellable --- OpenRA.Mods.Common/Activities/Sell.cs | 6 ++++-- OpenRA.Mods.Common/Traits/Sellable.cs | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Sell.cs b/OpenRA.Mods.Common/Activities/Sell.cs index 746fd01134..c33eb812a5 100644 --- a/OpenRA.Mods.Common/Activities/Sell.cs +++ b/OpenRA.Mods.Common/Activities/Sell.cs @@ -21,9 +21,11 @@ namespace OpenRA.Mods.Common.Activities readonly Health health; readonly SellableInfo sellableInfo; readonly PlayerResources playerResources; + bool showTicks; - public Sell(Actor self) + public Sell(Actor self, bool showTicks) { + this.showTicks = showTicks; health = self.TraitOrDefault(); sellableInfo = self.Info.TraitInfo(); playerResources = self.Owner.PlayerActor.Trait(); @@ -40,7 +42,7 @@ namespace OpenRA.Mods.Common.Activities foreach (var ns in self.TraitsImplementing()) ns.Sold(self); - if (refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer)) + if (showTicks && refund > 0 && self.Owner.IsAlliedWith(self.World.RenderPlayer)) self.World.AddFrameEndTask(w => w.Add(new FloatingText(self.CenterPosition, self.Owner.Color.RGB, FloatingText.FormatCashTick(refund), 30))); self.Dispose(); diff --git a/OpenRA.Mods.Common/Traits/Sellable.cs b/OpenRA.Mods.Common/Traits/Sellable.cs index fd926e367f..d3c4278360 100644 --- a/OpenRA.Mods.Common/Traits/Sellable.cs +++ b/OpenRA.Mods.Common/Traits/Sellable.cs @@ -22,6 +22,7 @@ namespace OpenRA.Mods.Common.Traits { public readonly int RefundPercent = 50; public readonly string[] SellSounds = { }; + public readonly bool ShowTicks = true; [Desc("Skip playing (reversed) make animation.")] public readonly bool SkipMakeAnimation = false; @@ -71,12 +72,12 @@ namespace OpenRA.Mods.Common.Traits var makeAnimation = self.TraitOrDefault(); if (makeAnimation != null) { - makeAnimation.Reverse(self, new Sell(self), false); + makeAnimation.Reverse(self, new Sell(self, info.ShowTicks), false); return; } } - self.QueueActivity(false, new Sell(self)); + self.QueueActivity(false, new Sell(self, info.ShowTicks)); } public bool IsTooltipVisible(Player forPlayer)