Have AI account for power outages
This commit is contained in:
@@ -141,11 +141,15 @@ namespace OpenRA.Mods.RA.AI
|
||||
{
|
||||
var power = GetProducibleBuilding("Power", buildableThings, a => a.Traits.Get<PowerInfo>().Amount);
|
||||
if (power != null && power.Traits.Get<PowerInfo>().Amount > 0)
|
||||
{
|
||||
// TODO: Handle the case when of when we actually do need a power plant because we don't have enough but are also suffering from a power outage
|
||||
if (playerPower.PowerOutageRemainingTicks <= 0)
|
||||
{
|
||||
HackyAI.BotDebug("AI: {0} decided to build {1}: Priority override (low power)", queue.Actor.Owner, power.Name);
|
||||
return power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Next is to build up a strong economy
|
||||
if (!ai.HasAdequateProc() || !ai.HasMinimumProc())
|
||||
@@ -205,11 +209,17 @@ namespace OpenRA.Mods.RA.AI
|
||||
// Try building a power plant instead
|
||||
var power = GetProducibleBuilding("Power", buildableThings, a => a.Traits.Get<PowerInfo>().Amount);
|
||||
if (power != null && power.Traits.Get<PowerInfo>().Amount > 0)
|
||||
{
|
||||
// TODO: Handle the case when of when we actually do need a power plant because we don't have enough but are also suffering from a power outage
|
||||
if (playerPower.PowerOutageRemainingTicks > 0)
|
||||
HackyAI.BotDebug("AI: {0} is suffering from a power outage; not going to build {1}", queue.Actor.Owner, power.Name);
|
||||
else
|
||||
{
|
||||
HackyAI.BotDebug("{0} decided to build {1}: Priority override (would be low power)", queue.Actor.Owner, power.Name);
|
||||
return power;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lets build this
|
||||
HackyAI.BotDebug("{0} decided to build {1}: Desired is {2} ({3} / {4}); current is {5} / {4}", queue.Actor.Owner, name, frac.Value, frac.Value * playerBuildings.Length, playerBuildings.Length, count);
|
||||
|
||||
Reference in New Issue
Block a user