Renamed EditorTilesetFilter to MapEditorData and added an update rule

This commit is contained in:
Ectras
2018-09-21 00:45:47 +02:00
committed by abcdefg30
parent 2e3f2e079a
commit d9946f63e4
31 changed files with 406 additions and 368 deletions

View File

@@ -351,7 +351,7 @@
<Compile Include="Traits\Demolishable.cs" />
<Compile Include="Traits\Demolition.cs" />
<Compile Include="Traits\DetectCloaked.cs" />
<Compile Include="Traits\EditorTilesetFilter.cs" />
<Compile Include="Traits\MapEditorData.cs" />
<Compile Include="Traits\EjectOnDeath.cs" />
<Compile Include="Traits\SpawnActorsOnSell.cs" />
<Compile Include="Traits\EngineerRepair.cs" />
@@ -866,6 +866,7 @@
<Compile Include="UpdateRules\UpdateRule.cs" />
<Compile Include="UpdateRules\UpdatePath.cs" />
<Compile Include="UpdateRules\UpdateUtils.cs" />
<Compile Include="UpdateRules\Rules\RenameEditorTilesetFilter.cs" />
<Compile Include="UpdateRules\Rules\20171014\LegacyBetaWarning.cs" />
<Compile Include="UpdateRules\Rules\20171014\RemoveMobileOnRails.cs" />
<Compile Include="UpdateRules\Rules\20171014\AircraftCanHoverGeneralization.cs" />

View File

@@ -14,12 +14,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
public class EditorTilesetFilterInfo : TraitInfo<EditorTilesetFilter>
public class MapEditorDataInfo : TraitInfo<MapEditorData>
{
public readonly HashSet<string> RequireTilesets = null;
public readonly HashSet<string> ExcludeTilesets = null;
public readonly string[] Categories;
}
public class EditorTilesetFilter { }
public class MapEditorData { }
}

View File

@@ -0,0 +1,35 @@
#region Copyright & License Information
/*
* Copyright 2007-2018 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.Collections.Generic;
namespace OpenRA.Mods.Common.UpdateRules.Rules
{
public class RenameEditorTilesetFilter : UpdateRule
{
public override string Name { get { return "EditorTilesetFilter renamed to MapEditorData"; } }
public override string Description
{
get
{
return "The name EditorTilesetFilter was misleading and was renamed to MapEditorData.";
}
}
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
{
foreach (var data in actorNode.ChildrenMatching("EditorTilesetFilter"))
data.RenameKey("MapEditorData");
yield break;
}
}
}

View File

@@ -87,6 +87,7 @@ namespace OpenRA.Mods.Common.UpdateRules
new UpdatePath("playtest-20180729", new UpdateRule[]
{
// Bleed only changes here
new RenameEditorTilesetFilter()
})
};

View File

@@ -109,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (!a.HasTraitInfo<IRenderActorPreviewInfo>())
continue;
var editorData = a.TraitInfoOrDefault<EditorTilesetFilterInfo>();
var editorData = a.TraitInfoOrDefault<MapEditorDataInfo>();
// Actor must be included in at least one category
if (editorData == null || editorData.Categories == null)