fixed #1232 -- bots repair their own damaged buildings
This commit is contained in:
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
--remainingTicks;
|
--remainingTicks;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AllowsBuildingRepairInfo : TraitInfo<AllowsBuildingRepair> { }
|
public class AllowsBuildingRepairInfo : TraitInfo<AllowsBuildingRepair> { }
|
||||||
public class AllowsBuildingRepair { }
|
public class AllowsBuildingRepair { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
/* a pile of hacks, which control a local player on the host. */
|
/* a pile of hacks, which control a local player on the host. */
|
||||||
|
|
||||||
class HackyAI : ITick, IBot
|
class HackyAI : ITick, IBot, INotifyDamage
|
||||||
{
|
{
|
||||||
bool enabled;
|
bool enabled;
|
||||||
int ticks;
|
int ticks;
|
||||||
@@ -507,5 +507,19 @@ namespace OpenRA.Mods.RA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Damaged(Actor self, AttackInfo e)
|
||||||
|
{
|
||||||
|
if (!enabled) return;
|
||||||
|
|
||||||
|
if (self.HasTrait<RepairableBuilding>())
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,5 @@ namespace OpenRA.Mods.RA
|
|||||||
building.Trait<RepairableBuilding>().RepairBuilding(building, self.Owner);
|
building.Trait<RepairableBuilding>().RepairBuilding(building, self.Owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user