Add ProductionAirdrop.ActorType update rule

This commit is contained in:
reaperrr
2019-11-25 22:21:42 +01:00
committed by Paul Chote
parent 2603a495e6
commit 948a9c9b19
3 changed files with 58 additions and 0 deletions

View File

@@ -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<Tuple<string, string>> missingActorTypes = new List<Tuple<string, string>>();
public override IEnumerable<string> 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<string> 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;
}
}
}

View File

@@ -142,6 +142,7 @@ namespace OpenRA.Mods.Common.UpdateRules
// Bleed only changes here
new RemoveYesNo(),
new RemoveInitialFacingHardcoding(),
new RemoveAirdropActorTypeDefault(),
})
};

View File

@@ -438,6 +438,7 @@ AFLD:
ExitCell: 3,1
ProductionAirdrop:
Produces: Vehicle.Nod
ActorType: c17
WithBuildingBib:
WithIdleOverlay@DISH:
RequiresCondition: !build-incomplete