Revert granting condition from HackyAI
In favor of using GrantConditionOnBotOwner. Updated update rule and shipping mods accordingly.
This commit is contained in:
committed by
Oliver Brakmann
parent
4c9c8bf7fc
commit
74fa8752c9
@@ -49,11 +49,6 @@ namespace OpenRA.Mods.Common.AI
|
||||
[Desc("Human-readable name this bot uses.")]
|
||||
public readonly string Name = "Unnamed Bot";
|
||||
|
||||
[FieldLoader.Require]
|
||||
[GrantedConditionReference]
|
||||
[Desc("Condition to grant. Mostly used to activate modules.")]
|
||||
public readonly string Condition = null;
|
||||
|
||||
[Desc("Minimum number of units AI must have before attacking.")]
|
||||
public readonly int SquadSize = 8;
|
||||
|
||||
@@ -269,7 +264,6 @@ namespace OpenRA.Mods.Common.AI
|
||||
readonly Predicate<Actor> unitCannotBeOrdered;
|
||||
|
||||
BotOrderManager botOrderManager;
|
||||
int conditionToken = ConditionManager.InvalidConditionToken;
|
||||
|
||||
CPos initialBaseCenter;
|
||||
PowerManager playerPower;
|
||||
@@ -350,10 +344,6 @@ namespace OpenRA.Mods.Common.AI
|
||||
resourceTypeIndices = new BitArray(tileset.TerrainInfo.Length); // Big enough
|
||||
foreach (var t in Map.Rules.Actors["world"].TraitInfos<ResourceTypeInfo>())
|
||||
resourceTypeIndices.Set(tileset.GetTerrainIndex(t.TerrainType), true);
|
||||
|
||||
var conditionManager = p.PlayerActor.TraitOrDefault<ConditionManager>();
|
||||
if (conditionManager != null && conditionToken == ConditionManager.InvalidConditionToken)
|
||||
conditionToken = conditionManager.GrantCondition(p.PlayerActor, Info.Condition);
|
||||
}
|
||||
|
||||
// DEPRECATED: Bot modules should queue orders directly.
|
||||
|
||||
@@ -66,11 +66,21 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||
var aiType = hackyAINode.LastChildMatching("Type").NodeValue<string>();
|
||||
var conditionString = "enable-" + aiType + "-ai";
|
||||
var requiresCondition = new MiniYamlNode("RequiresCondition", conditionString);
|
||||
var conditionNode = hackyAINode.LastChildMatching("Condition");
|
||||
if (conditionNode == null)
|
||||
|
||||
var addGrantConditionOnBotOwner = true;
|
||||
var grantBotConditions = actorNode.ChildrenMatching("GrantConditionOnBotOwner");
|
||||
foreach (var grant in grantBotConditions)
|
||||
if (grant.LastChildMatching("Condition").NodeValue<string>() == conditionString)
|
||||
addGrantConditionOnBotOwner = false;
|
||||
|
||||
if (addGrantConditionOnBotOwner)
|
||||
{
|
||||
var enableModule = new MiniYamlNode("Condition", conditionString);
|
||||
hackyAINode.AddNode(enableModule);
|
||||
var grantNode = new MiniYamlNode("GrantConditionOnBotOwner@" + aiType, "");
|
||||
var grantCondition = new MiniYamlNode("Condition", conditionString);
|
||||
var bot = new MiniYamlNode("Bots", aiType);
|
||||
grantNode.AddNode(grantCondition);
|
||||
grantNode.AddNode(bot);
|
||||
addNodes.Add(grantNode);
|
||||
}
|
||||
|
||||
if (harvesterFields.Any(f => hackyAINode.ChildrenMatching(f).Any()))
|
||||
|
||||
Reference in New Issue
Block a user