Improve consistency between the update rule code and descriptions.

This commit is contained in:
Paul Chote
2018-04-28 18:05:25 +00:00
committed by abcdefg30
parent 8c2f25e249
commit efc744dec3
7 changed files with 36 additions and 25 deletions

View File

@@ -21,20 +21,29 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{ {
get get
{ {
return "Map editor now requires an EditorPlayer to avoid loading all kinds of unnecessary player traits."; return "Map editor now requires an EditorPlayer to avoid loading unnecessary player traits.\n" +
"A warning is displayed if this actor has not been defined.";
} }
} }
bool messageDisplayed; bool warningRequired = true;
public override IEnumerable<string> AfterUpdate(ModData modData) public override IEnumerable<string> AfterUpdate(ModData modData)
{ {
if (!messageDisplayed) if (warningRequired)
{ {
messageDisplayed = true; warningRequired = false;
yield return "The map editor now requires an EditorPlayer actor.\n" + yield return "The map editor now requires an EditorPlayer actor.\n" +
"Please add an EditorPlayer with the traits AlwaysVisible and Shroud to player.yaml\n(or a different rules yaml file of your choice)."; "Please add an EditorPlayer with the traits AlwaysVisible and Shroud to player.yaml\n(or a different rules yaml file of your choice).";
} }
} }
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
if (actorNode.KeyMatches("EditorPlayer"))
warningRequired = false;
yield break;
}
} }
} }

View File

@@ -22,8 +22,9 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{ {
get get
{ {
return "Mod-specific default sound values have been removed from several traits.\n" + return "Mod-specific default sound values have been removed from several traits\n" +
"The original values are added back via yaml."; "(" + fields.Select(f => f.Item1 + "." + f.Item2).JoinWith(", ") + ")\n" +
"Uses of these traits are listed for inspection so the values can be overriden in yaml.";
} }
} }
@@ -38,10 +39,10 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
string BuildMessage(Tuple<string, string, string, List<string>> field) string BuildMessage(Tuple<string, string, string, List<string>> field)
{ {
return "The default value for {0}.{1} has been removed.\n".F(field.Item1, field.Item2) return "The default value for {0}.{1} has been removed.\n".F(field.Item1, field.Item2) +
+ "You may wish to explicitly define `{0}: {1}` on the `{2}` trait \n".F(field.Item2, field.Item3, field.Item1) "You may wish to explicitly define `{0}: {1}` on the `{2}` trait \n".F(field.Item2, field.Item3, field.Item1) +
+ "definitions on the following actors (if they have not already been inherited from a parent).\n" "definitions on the following actors (if they have not already been inherited from a parent).\n" +
+ UpdateUtils.FormatMessageList(field.Item4); UpdateUtils.FormatMessageList(field.Item4);
} }
public override IEnumerable<string> AfterUpdate(ModData modData) public override IEnumerable<string> AfterUpdate(ModData modData)

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
get get
{ {
return "HackyAI no longer automatically excludes actors with Harvester trait from attack squads.\n" + return "HackyAI no longer automatically excludes actors with Harvester trait from attack squads.\n" +
"They need to be explicitly added to ExcludeFromSquads."; "They need to be explicitly added to ExcludeFromSquads. HackyAI instances are listed for inspection.";
} }
} }
@@ -31,10 +31,10 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> AfterUpdate(ModData modData) public override IEnumerable<string> AfterUpdate(ModData modData)
{ {
if (locations.Any()) if (locations.Any())
yield return "The automatic exclusion of harvesters from AI squads has been removed.\n" yield return "The automatic exclusion of harvesters from AI squads has been removed.\n" +
+ "You may wish to add your harvester-type actors to `ExcludeFromSquads` under `UnitCommonNames`\n" "You may wish to add your harvester-type actors to `ExcludeFromSquads` under `UnitCommonNames`\n" +
+ "on the following definitions:\n" "on the following definitions:\n" +
+ UpdateUtils.FormatMessageList(locations); UpdateUtils.FormatMessageList(locations);
locations.Clear(); locations.Clear();
} }

View File

@@ -24,8 +24,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{ {
get get
{ {
return "Actor ids starting with '^' are now reserved for abstract\n" + return "Actor ids starting with '^' are now reserved for abstract inheritance templates.\n" +
"inheritance templates, and will not be parsed by the game."; "Definitions that may be affected are listed for inspection so that they can be renamed if necessary.";
} }
} }

View File

@@ -23,7 +23,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
get get
{ {
return "The PaletteFromCurrentTileset trait and Palette field on TileSets have been removed.\n" + return "The PaletteFromCurrentTileset trait and Palette field on TileSets have been removed.\n" +
"Terrain palettes are now explicitly defined on the world actor."; "Terrain palettes are now explicitly defined on the world actor.\n" +
"Palette definitions are generated based on the Tileset metadata.";
} }
} }

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
get get
{ {
return "WithReloadingSpriteTurret has been superseded by conditions.\n" + return "WithReloadingSpriteTurret has been superseded by conditions.\n" +
"The trait is switched for with WithSpriteTurret."; "Instances of this trait are replaced by WithSpriteTurret.";
} }
} }
@@ -31,10 +31,10 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
public override IEnumerable<string> AfterUpdate(ModData modData) public override IEnumerable<string> AfterUpdate(ModData modData)
{ {
if (locations.Any()) if (locations.Any())
yield return "WithReloadingSpriteTurret has been replaced by WithSpriteTurret\n" yield return "WithReloadingSpriteTurret has been replaced by WithSpriteTurret\n" +
+ "You should use AmmoPool.AmmoConditions to switch turret type when reloading\n" "You should use AmmoPool.AmmoConditions to switch turret type when reloading\n" +
+ "to restore the previous behaviour on the following actors:" "to restore the previous behaviour on the following actors:\n" +
+ UpdateUtils.FormatMessageList(locations); UpdateUtils.FormatMessageList(locations);
locations.Clear(); locations.Clear();
} }

View File

@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.UpdateRules.Rules
{ {
get get
{ {
return "The D2k-specific WormSpawner trait was renamed to ActorSpawner,\n" + return "The D2k-specific WormSpawner trait was renamed to ActorSpawner, generalized,\n" +
"generalized, and moved into the common mod code."; "and moved into the common mod code. Uses of the old traits are updated to account for this.";
} }
} }