Allow multiple terrain (tile) categories
This commit is contained in:
@@ -84,7 +84,7 @@ namespace OpenRA
|
|||||||
public readonly int[] Frames;
|
public readonly int[] Frames;
|
||||||
public readonly int2 Size;
|
public readonly int2 Size;
|
||||||
public readonly bool PickAny;
|
public readonly bool PickAny;
|
||||||
public readonly string Category;
|
public readonly string[] Categories;
|
||||||
public readonly string Palette;
|
public readonly string Palette;
|
||||||
|
|
||||||
readonly TerrainTileInfo[] tileInfo;
|
readonly TerrainTileInfo[] tileInfo;
|
||||||
|
|||||||
@@ -867,7 +867,17 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
{
|
{
|
||||||
foreach (var node in nodes)
|
foreach (var node in nodes)
|
||||||
{
|
{
|
||||||
// Add rules here
|
// Renamed Category to Categories in Template.
|
||||||
|
if (engineVersion < 20170623)
|
||||||
|
{
|
||||||
|
if (node.Key == "Template" || node.Key.StartsWith("Template@", StringComparison.Ordinal))
|
||||||
|
{
|
||||||
|
var category = node.Value.Nodes.FirstOrDefault(n => n.Key == "Category");
|
||||||
|
if (category != null)
|
||||||
|
category.Key = "Categories";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeTileset(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeTileset(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
panel.RemoveChildren();
|
panel.RemoveChildren();
|
||||||
|
|
||||||
var tileIds = tileset.Templates
|
var categoryTiles = tileset.Templates.Where(t => t.Value.Categories.Contains(category)).Select(t => t.Value).ToList();
|
||||||
.Where(t => t.Value.Category == category)
|
var tileIds = categoryTiles.Where(t => t.Categories[0] == category)
|
||||||
.Select(t => t.Value.Id);
|
.Concat(categoryTiles.Where(t => t.Categories[0] != category))
|
||||||
|
.Select(t => t.Id);
|
||||||
|
|
||||||
foreach (var t in tileIds)
|
foreach (var t in tileIds)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user