From 25b1c991a2f2cf9d057553563422819d9edec31d Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Fri, 6 May 2016 17:51:24 +0200 Subject: [PATCH] Fix possible instant repairs by spamming Repair activities Noticeable when spam-clicking on a naval yard/sub pen. --- OpenRA.Mods.Common/Activities/Repair.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Repair.cs b/OpenRA.Mods.Common/Activities/Repair.cs index 1eb37fd904..7e147ccadf 100644 --- a/OpenRA.Mods.Common/Activities/Repair.cs +++ b/OpenRA.Mods.Common/Activities/Repair.cs @@ -32,11 +32,20 @@ namespace OpenRA.Mods.Common.Activities public override Activity Tick(Actor self) { - if (IsCanceled) return NextActivity; - if (host == null || !host.IsInWorld) return NextActivity; + if (IsCanceled) + { + if (remainingTicks-- == 0) + return NextActivity; + + return this; + } + + if (host == null || !host.IsInWorld) + return NextActivity; health = self.TraitOrDefault(); - if (health == null) return NextActivity; + if (health == null) + return NextActivity; if (health.DamageState == DamageState.Undamaged) {