Move more traits from Mods.RA to Mods.Common

This commit is contained in:
reaperrr
2014-12-14 14:18:02 +01:00
parent 8723aa86fb
commit 4bf50c9153
7 changed files with 10 additions and 9 deletions

View File

@@ -1,48 +0,0 @@
#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 System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class AppearsOnRadarInfo : ITraitInfo
{
public readonly bool UseLocation = false;
public object Create(ActorInitializer init) { return new AppearsOnRadar(this); }
}
public class AppearsOnRadar : IRadarSignature
{
AppearsOnRadarInfo info;
public AppearsOnRadar(AppearsOnRadarInfo info) { this.info = info; }
public IEnumerable<CPos> RadarSignatureCells(Actor self)
{
if (info.UseLocation)
return new CPos[] { self.Location };
else
return self.OccupiesSpace.OccupiedCells().Select(c => c.First);
}
public Color RadarSignatureColor(Actor self)
{
var mod = self.TraitsImplementing<IRadarColorModifier>().FirstOrDefault();
if (mod != null)
return mod.RadarColorOverride(self);
return self.Owner.Color.RGB;
}
}
}

View File

@@ -1,26 +0,0 @@
#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.Traits;
namespace OpenRA.Mods.RA.Buildings
{
[Desc("Place the second actor in line to build more of the same at once (used for walls).")]
public class LineBuildInfo : TraitInfo<LineBuild>
{
[Desc("The maximum allowed length of the line.")]
public readonly int Range = 5;
[Desc("LineBuildNode 'Types' to attach to.")]
public readonly string[] NodeTypes = { "wall" };
}
public class LineBuild {}
}

View File

@@ -1,23 +0,0 @@
#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.Traits;
namespace OpenRA.Mods.RA.Buildings
{
[Desc("LineBuild actors attach to LineBuildNodes.")]
public class LineBuildNodeInfo : TraitInfo<LineBuildNode>
{
[Desc("This actor is of LineBuild 'NodeType'...")]
public readonly string[] Types = { "wall" };
}
public class LineBuildNode {}
}

View File

@@ -141,7 +141,6 @@
<Compile Include="EjectOnDeath.cs" />
<Compile Include="AI\RushFuzzy.cs" />
<Compile Include="AI\StateMachine.cs" />
<Compile Include="AppearsOnRadar.cs" />
<Compile Include="Traits\AttackMove.cs" />
<Compile Include="Attack\AttackBase.cs" />
<Compile Include="Attack\AttackFrontal.cs" />
@@ -157,7 +156,6 @@
<Compile Include="Buildings\Building.cs" />
<Compile Include="Buildings\BuildingInfluence.cs" />
<Compile Include="Buildings\FootprintUtils.cs" />
<Compile Include="Buildings\LineBuild.cs" />
<Compile Include="Buildings\RepairableBuilding.cs" />
<Compile Include="Buildings\Util.cs" />
<Compile Include="Scripting\Properties\RepairableBuildingProperties.cs" />
@@ -229,7 +227,6 @@
<Compile Include="ProductionBar.cs" />
<Compile Include="ProximityCaptor.cs" />
<Compile Include="ProximityCapturable.cs" />
<Compile Include="RadarColorFromTerrain.cs" />
<Compile Include="Reloads.cs" />
<Compile Include="RenderDetectionCircle.cs" />
<Compile Include="RenderJammerCircle.cs" />
@@ -371,7 +368,6 @@
<Compile Include="Widgets\Logic\LobbyMapPreviewLogic.cs" />
<Compile Include="Orders\BeaconOrderGenerator.cs" />
<Compile Include="Widgets\Logic\ControlGroupLogic.cs" />
<Compile Include="Buildings\LineBuildNode.cs" />
<Compile Include="Scripting\Global\ReinforcementsGlobal.cs" />
<Compile Include="Scripting\Properties\ProductionProperties.cs" />
<Compile Include="Scripting\Properties\MissionObjectiveProperties.cs" />
@@ -479,4 +475,4 @@ copy "FuzzyLogicLibrary.dll" "$(SolutionDir)"
cd "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
<ItemGroup />
</Project>
</Project>

View File

@@ -14,6 +14,7 @@ using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Mods.Common.Traits;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Mods.RA.Render;
using OpenRA.Mods.RA.Traits;

View File

@@ -1,34 +0,0 @@
#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 System.Drawing;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
public class RadarColorFromTerrainInfo : ITraitInfo
{
public readonly string Terrain;
public object Create( ActorInitializer init ) { return new RadarColorFromTerrain(init.self,Terrain); }
}
public class RadarColorFromTerrain : IRadarColorModifier
{
Color c;
public RadarColorFromTerrain(Actor self, string terrain)
{
c = self.World.TileSet[self.World.TileSet.GetTerrainIndex(terrain)].Color;
}
public bool VisibleOnRadar(Actor self) { return true; }
public Color RadarColorOverride(Actor self) { return c; }
}
}