diff --git a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs index da2412d049..50985dbe1e 100755 --- a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs @@ -63,13 +63,17 @@ namespace OpenRA.Mods.RA.Buildings return; } - self.World.AddFrameEndTask(w => w.Add(new RepairIndicator(self))); + self.World.AddFrameEndTask( + w => w.Add(new RepairIndicator(self, Info.RepairInterval / 2))); + self.InflictDamage(self, -hpToRepair, null); + if (Health.DamageState == DamageState.Undamaged) { isRepairing = false; return; } + remainingTicks = Info.RepairInterval; } else diff --git a/OpenRA.Mods.RA/Effects/RepairIndicator.cs b/OpenRA.Mods.RA/Effects/RepairIndicator.cs index 01cff51e83..491e6f2c98 100755 --- a/OpenRA.Mods.RA/Effects/RepairIndicator.cs +++ b/OpenRA.Mods.RA/Effects/RepairIndicator.cs @@ -22,10 +22,10 @@ namespace OpenRA.Mods.RA.Effects Actor a; Animation anim = new Animation("select"); - public RepairIndicator(Actor a) + public RepairIndicator(Actor a, int frames) { - this.a = a; anim.PlayRepeating("repair"); - framesLeft = a.Info.Traits.Get().RepairInterval / 2; + this.a = a; anim.PlayRepeating("repair"); + framesLeft = frames; } public void Tick( World world ) @@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Effects public IEnumerable Render() { - if (a.IsInWorld) + if (!a.Destroyed) yield return new Renderable(anim.Image, a.CenterLocation - .5f * anim.Image.size, "chrome", (int)a.CenterLocation.Y); }