Fix map editor radar ignoring color from terrain

This commit is contained in:
Nikita Pozdeev
2020-06-14 22:31:10 +04:00
committed by Matthias Mailänder
parent 4fe7daa85e
commit cb41be113a
3 changed files with 16 additions and 6 deletions

View File

@@ -15,6 +15,7 @@ using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits.Radar;
using OpenRA.Primitives;
using OpenRA.Traits;
@@ -49,6 +50,7 @@ namespace OpenRA.Mods.Common.Traits
readonly TooltipInfoBase tooltip;
IActorPreview[] previews;
readonly ActorReference reference;
public readonly Color RadarColor;
public EditorActorPreview(WorldRenderer worldRenderer, string id, ActorReference reference, PlayerReference owner)
{
@@ -75,6 +77,9 @@ namespace OpenRA.Mods.Common.Traits
var subCellInit = reference.GetOrDefault<SubCellInit>();
var subCell = subCellInit != null ? subCellInit.Value : SubCell.Any;
var radarColorInfo = Info.TraitInfoOrDefault<RadarColorFromTerrainInfo>();
RadarColor = radarColorInfo == null ? owner.Color : radarColorInfo.GetColorFromTerrain(world);
if (ios != null)
Footprint = ios.OccupiedCells(Info, location, subCell);
else