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.")]
|
[Desc("Human-readable name this bot uses.")]
|
||||||
public readonly string Name = "Unnamed Bot";
|
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.")]
|
[Desc("Minimum number of units AI must have before attacking.")]
|
||||||
public readonly int SquadSize = 8;
|
public readonly int SquadSize = 8;
|
||||||
|
|
||||||
@@ -269,7 +264,6 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
readonly Predicate<Actor> unitCannotBeOrdered;
|
readonly Predicate<Actor> unitCannotBeOrdered;
|
||||||
|
|
||||||
BotOrderManager botOrderManager;
|
BotOrderManager botOrderManager;
|
||||||
int conditionToken = ConditionManager.InvalidConditionToken;
|
|
||||||
|
|
||||||
CPos initialBaseCenter;
|
CPos initialBaseCenter;
|
||||||
PowerManager playerPower;
|
PowerManager playerPower;
|
||||||
@@ -350,10 +344,6 @@ namespace OpenRA.Mods.Common.AI
|
|||||||
resourceTypeIndices = new BitArray(tileset.TerrainInfo.Length); // Big enough
|
resourceTypeIndices = new BitArray(tileset.TerrainInfo.Length); // Big enough
|
||||||
foreach (var t in Map.Rules.Actors["world"].TraitInfos<ResourceTypeInfo>())
|
foreach (var t in Map.Rules.Actors["world"].TraitInfos<ResourceTypeInfo>())
|
||||||
resourceTypeIndices.Set(tileset.GetTerrainIndex(t.TerrainType), true);
|
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.
|
// 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 aiType = hackyAINode.LastChildMatching("Type").NodeValue<string>();
|
||||||
var conditionString = "enable-" + aiType + "-ai";
|
var conditionString = "enable-" + aiType + "-ai";
|
||||||
var requiresCondition = new MiniYamlNode("RequiresCondition", conditionString);
|
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);
|
var grantNode = new MiniYamlNode("GrantConditionOnBotOwner@" + aiType, "");
|
||||||
hackyAINode.AddNode(enableModule);
|
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()))
|
if (harvesterFields.Any(f => hackyAINode.ChildrenMatching(f).Any()))
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
Condition: enable-cabal-ai
|
|
||||||
HackyAI@Watson:
|
HackyAI@Watson:
|
||||||
Name: Watson
|
Name: Watson
|
||||||
Type: watson
|
Type: watson
|
||||||
@@ -263,7 +262,6 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
Condition: enable-watson-ai
|
|
||||||
HackyAI@HAL9001:
|
HackyAI@HAL9001:
|
||||||
Name: HAL 9001
|
Name: HAL 9001
|
||||||
Type: hal9001
|
Type: hal9001
|
||||||
@@ -397,6 +395,14 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
|
GrantConditionOnBotOwner@cabal:
|
||||||
|
Condition: enable-cabal-ai
|
||||||
|
Bots: cabal
|
||||||
|
GrantConditionOnBotOwner@watson:
|
||||||
|
Condition: enable-watson-ai
|
||||||
|
Bots: watson
|
||||||
|
GrantConditionOnBotOwner@hal9001:
|
||||||
Condition: enable-hal9001-ai
|
Condition: enable-hal9001-ai
|
||||||
|
Bots: hal9001
|
||||||
HarvesterBotModule:
|
HarvesterBotModule:
|
||||||
RequiresCondition: enable-cabal-ai || enable-watson-ai || enable-hal9001-ai
|
RequiresCondition: enable-cabal-ai || enable-watson-ai || enable-hal9001-ai
|
||||||
|
|||||||
@@ -125,7 +125,6 @@ Player:
|
|||||||
OrderName: ProduceActorPower.Fremen
|
OrderName: ProduceActorPower.Fremen
|
||||||
Consideration@1:
|
Consideration@1:
|
||||||
Against: Ally
|
Against: Ally
|
||||||
Condition: enable-omnius-ai
|
|
||||||
HackyAI@Vidius:
|
HackyAI@Vidius:
|
||||||
Name: Vidious
|
Name: Vidious
|
||||||
Type: vidious
|
Type: vidious
|
||||||
@@ -251,7 +250,6 @@ Player:
|
|||||||
OrderName: ProduceActorPower.Fremen
|
OrderName: ProduceActorPower.Fremen
|
||||||
Consideration@1:
|
Consideration@1:
|
||||||
Against: Ally
|
Against: Ally
|
||||||
Condition: enable-vidious-ai
|
|
||||||
HackyAI@Gladius:
|
HackyAI@Gladius:
|
||||||
Name: Gladius
|
Name: Gladius
|
||||||
Type: gladius
|
Type: gladius
|
||||||
@@ -376,6 +374,14 @@ Player:
|
|||||||
OrderName: ProduceActorPower.Fremen
|
OrderName: ProduceActorPower.Fremen
|
||||||
Consideration@1:
|
Consideration@1:
|
||||||
Against: Ally
|
Against: Ally
|
||||||
|
GrantConditionOnBotOwner@omnius:
|
||||||
|
Condition: enable-omnius-ai
|
||||||
|
Bots: omnius
|
||||||
|
GrantConditionOnBotOwner@vidious:
|
||||||
|
Condition: enable-vidious-ai
|
||||||
|
Bots: vidious
|
||||||
|
GrantConditionOnBotOwner@gladius:
|
||||||
Condition: enable-gladius-ai
|
Condition: enable-gladius-ai
|
||||||
|
Bots: gladius
|
||||||
HarvesterBotModule:
|
HarvesterBotModule:
|
||||||
RequiresCondition: enable-omnius-ai || enable-vidious-ai || enable-gladius-ai
|
RequiresCondition: enable-omnius-ai || enable-vidious-ai || enable-gladius-ai
|
||||||
|
|||||||
@@ -105,8 +105,6 @@ Player:
|
|||||||
DefaultCashDropdownLocked: True
|
DefaultCashDropdownLocked: True
|
||||||
DefaultCashDropdownVisible: False
|
DefaultCashDropdownVisible: False
|
||||||
DefaultCash: 50
|
DefaultCash: 50
|
||||||
-ConditionManager:
|
|
||||||
-HarvesterBotModule:
|
|
||||||
-HackyAI@RushAI:
|
-HackyAI@RushAI:
|
||||||
-HackyAI@NormalAI:
|
-HackyAI@NormalAI:
|
||||||
-HackyAI@NavalAI:
|
-HackyAI@NavalAI:
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
Condition: enable-rush-ai
|
|
||||||
HackyAI@NormalAI:
|
HackyAI@NormalAI:
|
||||||
Name: Normal AI
|
Name: Normal AI
|
||||||
Type: normal
|
Type: normal
|
||||||
@@ -262,7 +261,6 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
Condition: enable-normal-ai
|
|
||||||
HackyAI@TurtleAI:
|
HackyAI@TurtleAI:
|
||||||
Name: Turtle AI
|
Name: Turtle AI
|
||||||
Type: turtle
|
Type: turtle
|
||||||
@@ -404,7 +402,6 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
Condition: enable-turtle-ai
|
|
||||||
HackyAI@NavalAI:
|
HackyAI@NavalAI:
|
||||||
Name: Naval AI
|
Name: Naval AI
|
||||||
Type: naval
|
Type: naval
|
||||||
@@ -521,6 +518,17 @@ Player:
|
|||||||
Attractiveness: -10
|
Attractiveness: -10
|
||||||
TargetMetric: Value
|
TargetMetric: Value
|
||||||
CheckRadius: 7c0
|
CheckRadius: 7c0
|
||||||
|
GrantConditionOnBotOwner@rush:
|
||||||
|
Condition: enable-rush-ai
|
||||||
|
Bots: rush
|
||||||
|
GrantConditionOnBotOwner@normal:
|
||||||
|
Condition: enable-normal-ai
|
||||||
|
Bots: normal
|
||||||
|
GrantConditionOnBotOwner@turtle:
|
||||||
|
Condition: enable-turtle-ai
|
||||||
|
Bots: turtle
|
||||||
|
GrantConditionOnBotOwner@naval:
|
||||||
Condition: enable-naval-ai
|
Condition: enable-naval-ai
|
||||||
|
Bots: naval
|
||||||
HarvesterBotModule:
|
HarvesterBotModule:
|
||||||
RequiresCondition: enable-rush-ai || enable-normal-ai || enable-turtle-ai || enable-naval-ai
|
RequiresCondition: enable-rush-ai || enable-normal-ai || enable-turtle-ai || enable-naval-ai
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ Player:
|
|||||||
medic: 3
|
medic: 3
|
||||||
repair: 3
|
repair: 3
|
||||||
SquadSize: 20
|
SquadSize: 20
|
||||||
|
GrantConditionOnBotOwner@test:
|
||||||
Condition: enable-test-ai
|
Condition: enable-test-ai
|
||||||
|
Bots: test
|
||||||
HarvesterBotModule:
|
HarvesterBotModule:
|
||||||
RequiresCondition: enable-test-ai
|
RequiresCondition: enable-test-ai
|
||||||
|
|||||||
Reference in New Issue
Block a user