diff --git a/OpenRA.Mods.Common/UpdateRules/Rules/20191117/RemoveAirdropActorTypeDefault.cs b/OpenRA.Mods.Common/UpdateRules/Rules/20191117/RemoveAirdropActorTypeDefault.cs new file mode 100644 index 0000000000..8acbb53d9b --- /dev/null +++ b/OpenRA.Mods.Common/UpdateRules/Rules/20191117/RemoveAirdropActorTypeDefault.cs @@ -0,0 +1,56 @@ +#region Copyright & License Information +/* + * Copyright 2007-2019 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. For more + * information, see COPYING. + */ +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace OpenRA.Mods.Common.UpdateRules.Rules +{ + public class RemoveAirdropActorTypeDefault : UpdateRule + { + public override string Name { get { return "Removed internal default of ProductionAirdrop.ActorType"; } } + public override string Description + { + get + { + return "Removed internal default of 'c17' from ProductionAirdrop.ActorType."; + } + } + + readonly List> missingActorTypes = new List>(); + + public override IEnumerable AfterUpdate(ModData modData) + { + var message = "ProductionAirdrop.ActorType no longer defaults to 'c17' and must be defined explicitly.\n" + + "You may have to define it manually now in the following places:\n" + + UpdateUtils.FormatMessageList(missingActorTypes.Select(n => n.Item1 + " (" + n.Item2 + ")")); + + if (missingActorTypes.Any()) + yield return message; + + missingActorTypes.Clear(); + } + + public override IEnumerable UpdateActorNode(ModData modData, MiniYamlNode actorNode) + { + var airProd = actorNode.LastChildMatching("ProductionAirdrop"); + if (airProd != null) + { + var actorTypeNode = airProd.LastChildMatching("ActorType"); + if (actorTypeNode == null) + missingActorTypes.Add(Tuple.Create(actorNode.Key, actorNode.Location.Filename)); + } + + yield break; + } + } +} diff --git a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs index 72639cc193..071da2b37c 100644 --- a/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs +++ b/OpenRA.Mods.Common/UpdateRules/UpdatePath.cs @@ -142,6 +142,7 @@ namespace OpenRA.Mods.Common.UpdateRules // Bleed only changes here new RemoveYesNo(), new RemoveInitialFacingHardcoding(), + new RemoveAirdropActorTypeDefault(), }) }; diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 165c5bc9f0..b3de8cc1c5 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -438,6 +438,7 @@ AFLD: ExitCell: 3,1 ProductionAirdrop: Produces: Vehicle.Nod + ActorType: c17 WithBuildingBib: WithIdleOverlay@DISH: RequiresCondition: !build-incomplete