Move default tileset parsing to Mods.Common.
This commit is contained in:
68
OpenRA.Game/Map/TerrainInfo.cs
Normal file
68
OpenRA.Game/Map/TerrainInfo.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2020 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;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public interface ITerrainLoader
|
||||
{
|
||||
ITerrainInfo ParseTerrain(IReadOnlyFileSystem fileSystem, string path);
|
||||
}
|
||||
|
||||
public interface ITerrainInfo
|
||||
{
|
||||
string Id { get; }
|
||||
TerrainTypeInfo[] TerrainTypes { get; }
|
||||
TerrainTileInfo GetTerrainInfo(TerrainTile r);
|
||||
bool TryGetTerrainInfo(TerrainTile r, out TerrainTileInfo info);
|
||||
byte GetTerrainIndex(string type);
|
||||
byte GetTerrainIndex(TerrainTile r);
|
||||
TerrainTile DefaultTerrainTile { get; }
|
||||
|
||||
Color[] HeightDebugColors { get; }
|
||||
IEnumerable<Color> RestrictedPlayerColors { get; }
|
||||
float MinHeightColorBrightness { get; }
|
||||
float MaxHeightColorBrightness { get; }
|
||||
}
|
||||
|
||||
public class TerrainTileInfo
|
||||
{
|
||||
[FieldLoader.Ignore]
|
||||
public readonly byte TerrainType = byte.MaxValue;
|
||||
public readonly byte Height;
|
||||
public readonly byte RampType;
|
||||
public readonly Color MinColor;
|
||||
public readonly Color MaxColor;
|
||||
}
|
||||
|
||||
public class TerrainTypeInfo
|
||||
{
|
||||
public readonly string Type;
|
||||
public readonly BitSet<TargetableType> TargetTypes;
|
||||
public readonly HashSet<string> AcceptsSmudgeType = new HashSet<string>();
|
||||
public readonly Color Color;
|
||||
public readonly bool RestrictPlayerColor = false;
|
||||
public readonly string CustomCursor;
|
||||
|
||||
public TerrainTypeInfo(MiniYaml my) { FieldLoader.Load(this, my); }
|
||||
}
|
||||
|
||||
// HACK: Temporary placeholder to avoid having to change all the traits that reference this constant.
|
||||
// This can be removed after the palette references have been moved from traits to sequences.
|
||||
public class TileSet
|
||||
{
|
||||
public const string TerrainPaletteInternalName = "terrain";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user