Merge pull request #5865 from obrakmann/fix5861
Fix RepairBuilding not working for AI and Lua scripts
This commit is contained in:
@@ -851,9 +851,11 @@ namespace OpenRA.Mods.RA.AI
|
||||
if (!e.Attacker.HasTrait<ITargetable>())
|
||||
return;
|
||||
|
||||
if (Info.ShouldRepairBuildings && self.HasTrait<RepairableBuilding>())
|
||||
var rb = self.TraitOrDefault<RepairableBuilding>();
|
||||
|
||||
if (Info.ShouldRepairBuildings && rb != null)
|
||||
{
|
||||
if (e.DamageState > DamageState.Light && e.PreviousDamageState <= DamageState.Light)
|
||||
if (e.DamageState > DamageState.Light && e.PreviousDamageState <= DamageState.Light && !rb.RepairActive)
|
||||
{
|
||||
BotDebug("Bot noticed damage {0} {1}->{2}, repairing.",
|
||||
self, e.PreviousDamageState, e.DamageState);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
|
||||
Health Health;
|
||||
RepairableBuildingInfo Info;
|
||||
public bool RepairActive = true;
|
||||
public bool RepairActive = false;
|
||||
|
||||
public RepairableBuilding(Actor self, RepairableBuildingInfo info)
|
||||
{
|
||||
@@ -102,6 +102,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
if (Health.DamageState == DamageState.Undamaged)
|
||||
{
|
||||
Repairers.Clear();
|
||||
RepairActive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ end
|
||||
|
||||
Actor.RepairBuilding = function(actor)
|
||||
local rb = Actor.TraitOrDefault(actor, "RepairableBuilding")
|
||||
if rb ~= nil and rb.Repairer == nil then
|
||||
if rb ~= nil and not rb.RepairActive then
|
||||
rb:RepairBuilding(actor, Actor.Owner(actor))
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user