diff --git a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs index 534c8a2ea9..2ad78658aa 100755 --- a/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs +++ b/OpenRA.Mods.RA/Buildings/RepairableBuilding.cs @@ -93,7 +93,7 @@ namespace OpenRA.Mods.RA.Buildings --remainingTicks; } } + public class AllowsBuildingRepairInfo : TraitInfo { } public class AllowsBuildingRepair { } - } diff --git a/OpenRA.Mods.RA/HackyAI.cs b/OpenRA.Mods.RA/HackyAI.cs index 754617b2a8..ec974202bd 100644 --- a/OpenRA.Mods.RA/HackyAI.cs +++ b/OpenRA.Mods.RA/HackyAI.cs @@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA /* a pile of hacks, which control a local player on the host. */ - class HackyAI : ITick, IBot + class HackyAI : ITick, IBot, INotifyDamage { bool enabled; int ticks; @@ -507,5 +507,19 @@ namespace OpenRA.Mods.RA } } } + + public void Damaged(Actor self, AttackInfo e) + { + if (!enabled) return; + + if (self.HasTrait()) + if (e.DamageState > DamageState.Light && e.PreviousDamageState <= DamageState.Light) + { + BotDebug("Bot noticed damage {0} {1}->{2}, repairing.", + self, e.PreviousDamageState, e.DamageState); + world.IssueOrder(new Order("RepairBuilding", self.Owner.PlayerActor, false) + { TargetActor = self }); + } + } } } diff --git a/OpenRA.Mods.RA/Player/AllyRepair.cs b/OpenRA.Mods.RA/Player/AllyRepair.cs index 58227318e8..191f754043 100644 --- a/OpenRA.Mods.RA/Player/AllyRepair.cs +++ b/OpenRA.Mods.RA/Player/AllyRepair.cs @@ -30,6 +30,5 @@ namespace OpenRA.Mods.RA building.Trait().RepairBuilding(building, self.Owner); } } - } }