Merge pull request #5539 from deniz1a/repair-pause

Closes #5322
This commit is contained in:
Matthias Mailänder
2014-06-09 16:24:34 +02:00
2 changed files with 4 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Buildings
Health Health;
RepairableBuildingInfo Info;
public bool RepairActive = true;
public RepairableBuilding(Actor self, RepairableBuildingInfo info)
{
@@ -81,7 +82,8 @@ namespace OpenRA.Mods.RA.Buildings
var hpToRepair = Math.Min(Info.RepairStep, Health.MaxHP - Health.HP);
var cost = Math.Max(1, (hpToRepair * Info.RepairPercent * buildingValue) / (Health.MaxHP * 100));
if (!Repairer.PlayerActor.Trait<PlayerResources>().TakeCash(cost))
RepairActive = Repairer.PlayerActor.Trait<PlayerResources>().TakeCash(cost);
if (!RepairActive)
{
remainingTicks = 1;
return;

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Effects
rb = building.TraitOrDefault<RepairableBuilding>();
anim = new Animation(building.World, "allyrepair");
anim.Paused = () => !rb.RepairActive;
anim.PlayRepeating("repair");
}