Remove PlayerPaletteFromCurrentTileset.

This commit is contained in:
Matthias Mailänder
2017-08-30 23:34:24 +02:00
committed by reaperrr
parent 3b4904775a
commit 3af0b1a7a0
5 changed files with 12 additions and 51 deletions

View File

@@ -185,7 +185,6 @@ namespace OpenRA
public readonly string Id; public readonly string Id;
public readonly int SheetSize = 512; public readonly int SheetSize = 512;
public readonly string Palette; public readonly string Palette;
public readonly string PlayerPalette;
public readonly Color[] HeightDebugColors = new[] { Color.Red }; public readonly Color[] HeightDebugColors = new[] { Color.Red };
public readonly string[] EditorTemplateOrder; public readonly string[] EditorTemplateOrder;
public readonly bool IgnoreTileSpriteOffsets; public readonly bool IgnoreTileSpriteOffsets;

View File

@@ -534,7 +534,6 @@
<Compile Include="Traits\World\PathFinder.cs" /> <Compile Include="Traits\World\PathFinder.cs" />
<Compile Include="Pathfinder\PathSearch.cs" /> <Compile Include="Pathfinder\PathSearch.cs" />
<Compile Include="Pathfinder\BasePathSearch.cs" /> <Compile Include="Pathfinder\BasePathSearch.cs" />
<Compile Include="Traits\World\PlayerPaletteFromCurrentTileset.cs" />
<Compile Include="Traits\World\RadarPings.cs" /> <Compile Include="Traits\World\RadarPings.cs" />
<Compile Include="Traits\World\ResourceClaimLayer.cs" /> <Compile Include="Traits\World\ResourceClaimLayer.cs" />
<Compile Include="Traits\World\ResourceLayer.cs" /> <Compile Include="Traits\World\ResourceLayer.cs" />

View File

@@ -1,47 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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 OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits
{
class PlayerPaletteFromCurrentTilesetInfo : ITraitInfo
{
[FieldLoader.Require, PaletteDefinition(true)]
[Desc("internal palette name")]
public readonly string Name = null;
[Desc("Map listed indices to shadow.")]
public readonly int[] ShadowIndex = { };
[Desc("Apply palette rotators or not.")]
public readonly bool AllowModifiers = true;
public object Create(ActorInitializer init) { return new PlayerPaletteFromCurrentTileset(init.World, this); }
}
class PlayerPaletteFromCurrentTileset : ILoadsPalettes
{
readonly World world;
readonly PlayerPaletteFromCurrentTilesetInfo info;
public PlayerPaletteFromCurrentTileset(World world, PlayerPaletteFromCurrentTilesetInfo info)
{
this.world = world;
this.info = info;
}
public void LoadPalettes(WorldRenderer wr)
{
var filename = world.Map.Rules.TileSet.PlayerPalette ?? world.Map.Rules.TileSet.Palette;
wr.AddPalette(info.Name, new ImmutablePalette(wr.World.Map.Open(filename), info.ShadowIndex), info.AllowModifiers);
}
}
}

View File

@@ -977,7 +977,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
// nuke launch animation is now it's own trait // nuke launch animation is now it's own trait
if (engineVersion < 20170820) if (engineVersion < 20170820)
{ {
if (depth == 1 && node.Key.StartsWith("NukePower")) if (depth == 1 && node.Key.StartsWith("NukePower", StringComparison.Ordinal))
{ {
node.Value.Nodes.RemoveAll(n => n.Key == "ActivationSequence"); node.Value.Nodes.RemoveAll(n => n.Key == "ActivationSequence");
addNodes.Add(new MiniYamlNode("WithNukeLaunchAnimation", new MiniYaml(""))); addNodes.Add(new MiniYamlNode("WithNukeLaunchAnimation", new MiniYaml("")));
@@ -992,6 +992,17 @@ namespace OpenRA.Mods.Common.UtilityCommands
RenameNodeKey(node, "WithEmbeddedTurretSpriteBody"); RenameNodeKey(node, "WithEmbeddedTurretSpriteBody");
} }
if (engineVersion < 20170916)
{
if (node.Key.StartsWith("PlayerPaletteFromCurrentTileset", StringComparison.Ordinal))
{
node.Value.Nodes.Add(new MiniYamlNode("Filename", ""));
node.Value.Nodes.Add(new MiniYamlNode("Tileset", ""));
RenameNodeKey(node, "PaletteFromFile");
Console.WriteLine("The trait PlayerPaletteFromCurrentTileset has been removed. Use PaletteFromFile with a Tileset filter.");
}
}
UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1); UpgradeActorRules(modData, engineVersion, ref node.Value.Nodes, node, depth + 1);
} }

View File

@@ -2,7 +2,6 @@ General:
Name: Desert Name: Desert
Id: DESERT Id: DESERT
Palette: desert.pal Palette: desert.pal
PlayerPalette: temperat.pal
EditorTemplateOrder: Terrain, Debris, Road, Cliffs, Water Cliffs, Beach, River, Bridge EditorTemplateOrder: Terrain, Debris, Road, Cliffs, Water Cliffs, Beach, River, Bridge
HeightDebugColors: 880000 HeightDebugColors: 880000