Correct bridge / tree / mine color
This commit is contained in:
@@ -169,6 +169,10 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public Color RadarSignatureColor(Actor self)
|
public Color RadarSignatureColor(Actor self)
|
||||||
{
|
{
|
||||||
|
var mod = self.traits.WithInterface<IRadarSignatureModifier>().FirstOrDefault();
|
||||||
|
if (mod != null)
|
||||||
|
return mod.RadarColorOverride(self);
|
||||||
|
|
||||||
return self.Owner.Color;
|
return self.Owner.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ namespace OpenRA.Traits
|
|||||||
Color RadarSignatureColor(Actor self);
|
Color RadarSignatureColor(Actor self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IRadarSignatureModifier
|
||||||
|
{
|
||||||
|
Color RadarColorOverride(Actor self);
|
||||||
|
}
|
||||||
|
|
||||||
public interface IOccupySpace
|
public interface IOccupySpace
|
||||||
{
|
{
|
||||||
int2 TopLeft { get; }
|
int2 TopLeft { get; }
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
@@ -43,6 +44,10 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public Color RadarSignatureColor(Actor self)
|
public Color RadarSignatureColor(Actor self)
|
||||||
{
|
{
|
||||||
|
var mod = self.traits.WithInterface<IRadarSignatureModifier>().FirstOrDefault();
|
||||||
|
if (mod != null)
|
||||||
|
return mod.RadarColorOverride(self);
|
||||||
|
|
||||||
return self.Owner.Color;
|
return self.Owner.Color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -208,6 +208,7 @@
|
|||||||
<Compile Include="Activities\TransformIntoActor.cs" />
|
<Compile Include="Activities\TransformIntoActor.cs" />
|
||||||
<Compile Include="PaletteFromCurrentTheatre.cs" />
|
<Compile Include="PaletteFromCurrentTheatre.cs" />
|
||||||
<Compile Include="Widgets\Delegates\OrderButtonsChromeDelegate.cs" />
|
<Compile Include="Widgets\Delegates\OrderButtonsChromeDelegate.cs" />
|
||||||
|
<Compile Include="RadarColorFromTerrain.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
37
OpenRA.Mods.RA/RadarColorFromTerrain.cs
Normal file
37
OpenRA.Mods.RA/RadarColorFromTerrain.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2010 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 LICENSE.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using OpenRA.FileFormats;
|
||||||
|
|
||||||
|
namespace OpenRA.Traits
|
||||||
|
{
|
||||||
|
public class RadarColorFromTerrainInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public readonly string Terrain;
|
||||||
|
public object Create( ActorInitializer init ) { return new RadarColorFromTerrain(init.self,Terrain); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RadarColorFromTerrain : IRadarSignatureModifier
|
||||||
|
{
|
||||||
|
Color c;
|
||||||
|
public RadarColorFromTerrain(Actor self, string terrain)
|
||||||
|
{
|
||||||
|
c = self.World.TileSet.Terrain[terrain].Color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color RadarColorOverride(Actor self)
|
||||||
|
{
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -151,7 +151,8 @@
|
|||||||
Building:
|
Building:
|
||||||
Footprint: __ x_
|
Footprint: __ x_
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Tree
|
||||||
^Rock:
|
^Rock:
|
||||||
Category: Building
|
Category: Building
|
||||||
Valued:
|
Valued:
|
||||||
@@ -161,6 +162,9 @@
|
|||||||
Building:
|
Building:
|
||||||
Footprint: __ x_
|
Footprint: __ x_
|
||||||
Dimensions: 2,2
|
Dimensions: 2,2
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Tree
|
||||||
|
|
||||||
^Husk:
|
^Husk:
|
||||||
Category: Vehicle
|
Category: Vehicle
|
||||||
Unit:
|
Unit:
|
||||||
@@ -187,4 +191,6 @@
|
|||||||
DestroyedSound: xplobig4.aud
|
DestroyedSound: xplobig4.aud
|
||||||
Footprint: ______ ______ ______ ______
|
Footprint: ______ ______ ______ ______
|
||||||
Dimensions: 6,4
|
Dimensions: 6,4
|
||||||
HP: 1000
|
HP: 1000
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Road
|
||||||
@@ -7,6 +7,8 @@ SPLIT2:
|
|||||||
Valued:
|
Valued:
|
||||||
Description: Blossom Tree
|
Description: Blossom Tree
|
||||||
-Selectable:
|
-Selectable:
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Ore
|
||||||
|
|
||||||
SPLIT3:
|
SPLIT3:
|
||||||
Inherits: ^Building
|
Inherits: ^Building
|
||||||
@@ -17,6 +19,8 @@ SPLIT3:
|
|||||||
Valued:
|
Valued:
|
||||||
Description: Blossom Tree
|
Description: Blossom Tree
|
||||||
-Selectable:
|
-Selectable:
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Ore
|
||||||
|
|
||||||
ROCK1:
|
ROCK1:
|
||||||
Inherits: ^Rock
|
Inherits: ^Rock
|
||||||
|
|||||||
@@ -143,6 +143,8 @@
|
|||||||
Building:
|
Building:
|
||||||
Footprint: x
|
Footprint: x
|
||||||
Dimensions: 1,1
|
Dimensions: 1,1
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Tree
|
||||||
|
|
||||||
^Husk:
|
^Husk:
|
||||||
Category: Vehicle
|
Category: Vehicle
|
||||||
@@ -169,4 +171,6 @@
|
|||||||
Building:
|
Building:
|
||||||
Footprint: ____ ____
|
Footprint: ____ ____
|
||||||
Dimensions: 4,2
|
Dimensions: 4,2
|
||||||
HP: 1000
|
HP: 1000
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Road
|
||||||
@@ -125,6 +125,8 @@ MINE:
|
|||||||
Valued:
|
Valued:
|
||||||
Description: Ore Mine
|
Description: Ore Mine
|
||||||
SeedsResource:
|
SeedsResource:
|
||||||
|
RadarColorFromTerrain:
|
||||||
|
Terrain: Ore
|
||||||
|
|
||||||
BOXES01:
|
BOXES01:
|
||||||
Inherits: ^Tree
|
Inherits: ^Tree
|
||||||
|
|||||||
Reference in New Issue
Block a user