remappable resource types
This commit is contained in:
@@ -246,6 +246,7 @@
|
|||||||
<Compile Include="Scripting\ScriptMemberWrapper.cs" />
|
<Compile Include="Scripting\ScriptMemberWrapper.cs" />
|
||||||
<Compile Include="Scripting\ScriptMemberExts.cs" />
|
<Compile Include="Scripting\ScriptMemberExts.cs" />
|
||||||
<Compile Include="Scripting\ScriptPlayerInterface.cs" />
|
<Compile Include="Scripting\ScriptPlayerInterface.cs" />
|
||||||
|
<Compile Include="Traits\Player\FixedColorPalette.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
<Compile Include="FileSystem\D2kSoundResources.cs" />
|
||||||
|
|||||||
50
OpenRA.Game/Traits/Player/FixedColorPalette.cs
Normal file
50
OpenRA.Game/Traits/Player/FixedColorPalette.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2014 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. For more information,
|
||||||
|
* see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
|
namespace OpenRA.Traits
|
||||||
|
{
|
||||||
|
[Desc("Add this to the World actor definition.")]
|
||||||
|
public class FixedColorPaletteInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
[Desc("The name of the palette to base off.")]
|
||||||
|
public readonly string Base = "terrain";
|
||||||
|
[Desc("The name of the resulting palette")]
|
||||||
|
public readonly string Name = "resources";
|
||||||
|
[Desc("Remap these indices to pre-defined colors.")]
|
||||||
|
public readonly int[] RemapIndex = { };
|
||||||
|
[Desc("The fixed color to remap.")]
|
||||||
|
public readonly HSLColor Color;
|
||||||
|
[Desc("Luminosity range to span.")]
|
||||||
|
public readonly float Ramp = 0.05f;
|
||||||
|
[Desc("Allow palette modifiers to change the palette.")]
|
||||||
|
public readonly bool AllowModifiers = true;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new FixedColorPalette(this); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FixedColorPalette : IPalette
|
||||||
|
{
|
||||||
|
readonly FixedColorPaletteInfo info;
|
||||||
|
|
||||||
|
public FixedColorPalette(FixedColorPaletteInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitPalette(WorldRenderer wr)
|
||||||
|
{
|
||||||
|
var remap = new PlayerColorRemap(info.RemapIndex, info.Color, info.Ramp);
|
||||||
|
wr.AddPalette(info.Name, new Palette(wr.Palette(info.Base).Palette, remap), info.AllowModifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||||
* This file is part of OpenRA, which is free software. It is made
|
* 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
|
* available to you under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation. For more information,
|
* as published by the Free Software Foundation. For more information,
|
||||||
@@ -16,7 +16,7 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public class ResourceTypeInfo : ITraitInfo
|
public class ResourceTypeInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
// Hack: The editor is getting really unmaintanable...
|
// HACK: The editor is getting really unmaintanable...
|
||||||
public readonly string EditorSprite;
|
public readonly string EditorSprite;
|
||||||
public readonly string[] Variants = { };
|
public readonly string[] Variants = { };
|
||||||
public readonly string Palette = "terrain";
|
public readonly string Palette = "terrain";
|
||||||
|
|||||||
@@ -82,9 +82,14 @@ World:
|
|||||||
Race: nod
|
Race: nod
|
||||||
ResourceLayer:
|
ResourceLayer:
|
||||||
ResourceClaimLayer:
|
ResourceClaimLayer:
|
||||||
|
FixedColorPalette@GreenTiberium:
|
||||||
|
Base: player
|
||||||
|
Name: greentiberium
|
||||||
|
Color: 57, 201, 128
|
||||||
|
RemapIndex: 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
|
||||||
ResourceType@Tiberium:
|
ResourceType@Tiberium:
|
||||||
ResourceType: 1
|
ResourceType: 1
|
||||||
Palette: player # TODO: this has to remap to green
|
Palette: greentiberium
|
||||||
EditorSprite: waypoint # TODO: editor can't handle the real ones
|
EditorSprite: waypoint # TODO: editor can't handle the real ones
|
||||||
Variants: tib01, tib02, tib03, tib04, tib05, tib06, tib07, tib08, tib09, tib10, tib11, tib12, tib13, tib14, tib15, tib16, tib17, tib18, tib19, tib20
|
Variants: tib01, tib02, tib03, tib04, tib05, tib06, tib07, tib08, tib09, tib10, tib11, tib12, tib13, tib14, tib15, tib16, tib17, tib18, tib19, tib20
|
||||||
MaxDensity: 12
|
MaxDensity: 12
|
||||||
|
|||||||
Reference in New Issue
Block a user