moved traits from engine into mod

This commit is contained in:
Bob
2010-09-20 20:56:11 +12:00
parent 65515d54af
commit aff6889995
15 changed files with 43 additions and 44 deletions

View File

@@ -21,7 +21,7 @@ namespace OpenRA.Graphics
{ {
readonly World world; readonly World world;
internal readonly TerrainRenderer terrainRenderer; internal readonly TerrainRenderer terrainRenderer;
internal readonly UiOverlay uiOverlay; public readonly UiOverlay uiOverlay;
internal readonly HardwarePalette palette; internal readonly HardwarePalette palette;
internal WorldRenderer(World world) internal WorldRenderer(World world)

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -75,7 +75,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Effects\RepairIndicator.cs" />
<Compile Include="GameRules\WeaponInfo.cs" /> <Compile Include="GameRules\WeaponInfo.cs" />
<Compile Include="Group.cs" /> <Compile Include="Group.cs" />
<Compile Include="Orders\GenericSelectTarget.cs" /> <Compile Include="Orders\GenericSelectTarget.cs" />
@@ -135,7 +134,6 @@
<Compile Include="Traits\Activities\RemoveSelf.cs" /> <Compile Include="Traits\Activities\RemoveSelf.cs" />
<Compile Include="Traits\Activities\Sell.cs" /> <Compile Include="Traits\Activities\Sell.cs" />
<Compile Include="Orders\IOrderGenerator.cs" /> <Compile Include="Orders\IOrderGenerator.cs" />
<Compile Include="Orders\PlaceBuildingOrderGenerator.cs" />
<Compile Include="Player.cs" /> <Compile Include="Player.cs" />
<Compile Include="Graphics\Sheet.cs" /> <Compile Include="Graphics\Sheet.cs" />
<Compile Include="PathFinder.cs" /> <Compile Include="PathFinder.cs" />
@@ -158,17 +156,13 @@
<Compile Include="Traits\Buildable.cs" /> <Compile Include="Traits\Buildable.cs" />
<Compile Include="Traits\Building.cs" /> <Compile Include="Traits\Building.cs" />
<Compile Include="Traits\World\BuildingInfluence.cs" /> <Compile Include="Traits\World\BuildingInfluence.cs" />
<Compile Include="Traits\Player\PlaceBuilding.cs" />
<Compile Include="Traits\World\PlayerColorPalette.cs" /> <Compile Include="Traits\World\PlayerColorPalette.cs" />
<Compile Include="Traits\World\ResourceLayer.cs" /> <Compile Include="Traits\World\ResourceLayer.cs" />
<Compile Include="Traits\World\ResourceType.cs" /> <Compile Include="Traits\World\ResourceType.cs" />
<Compile Include="Traits\SupportPower.cs" /> <Compile Include="Traits\SupportPower.cs" />
<Compile Include="Traits\ProvidesRadar.cs" /> <Compile Include="Traits\ProvidesRadar.cs" />
<Compile Include="Traits\Selectable.cs" /> <Compile Include="Traits\Selectable.cs" />
<Compile Include="Traits\Player\ProductionQueue.cs" />
<Compile Include="Traits\Mobile.cs" /> <Compile Include="Traits\Mobile.cs" />
<Compile Include="Traits\Production.cs" />
<Compile Include="Traits\RallyPoint.cs" />
<Compile Include="Traits\Render\RenderSimple.cs" /> <Compile Include="Traits\Render\RenderSimple.cs" />
<Compile Include="Traits\TraitsInterfaces.cs" /> <Compile Include="Traits\TraitsInterfaces.cs" />
<Compile Include="Traits\Turreted.cs" /> <Compile Include="Traits\Turreted.cs" />
@@ -215,7 +209,6 @@
<Compile Include="Traits\RevealsShroud.cs" /> <Compile Include="Traits\RevealsShroud.cs" />
<Compile Include="Traits\Targetable.cs" /> <Compile Include="Traits\Targetable.cs" />
<Compile Include="Traits\Health.cs" /> <Compile Include="Traits\Health.cs" />
<Compile Include="Traits\RepairableBuilding.cs" />
<Compile Include="Traits\Activities\Drag.cs" /> <Compile Include="Traits\Activities\Drag.cs" />
<Compile Include="Widgets\VqaPlayerWidget.cs" /> <Compile Include="Widgets\VqaPlayerWidget.cs" />
<Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" /> <Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" />
@@ -226,7 +219,6 @@
<Compile Include="Traits\Armor.cs" /> <Compile Include="Traits\Armor.cs" />
<Compile Include="Graphics\CursorProvider.cs" /> <Compile Include="Graphics\CursorProvider.cs" />
<Compile Include="Traits\Player\TechTree.cs" /> <Compile Include="Traits\Player\TechTree.cs" />
<Compile Include="Traits\Player\ClassicProductionQueue.cs" />
<Compile Include="Traits\Player\PowerManager.cs" /> <Compile Include="Traits\Player\PowerManager.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -242,7 +234,6 @@
<Compile Include="ObjectCreator.cs" /> <Compile Include="ObjectCreator.cs" />
<Compile Include="Network\SyncReport.cs" /> <Compile Include="Network\SyncReport.cs" />
<Compile Include="TraitDictionary.cs" /> <Compile Include="TraitDictionary.cs" />
<Compile Include="Traits\PrimaryBuilding.cs" />
<Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" /> <Compile Include="Widgets\Delegates\DeveloperModeDelegate.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -13,7 +13,7 @@ using System.Linq;
namespace OpenRA.Traits namespace OpenRA.Traits
{ {
class PlayerResourcesInfo : ITraitInfo public class PlayerResourcesInfo : ITraitInfo
{ {
public readonly int InitialCash = 10000; public readonly int InitialCash = 10000;
public readonly int InitialOre = 0; public readonly int InitialOre = 0;

View File

@@ -18,7 +18,7 @@ using OpenRA.Widgets;
namespace OpenRA namespace OpenRA
{ {
class UiOverlay public class UiOverlay
{ {
Sprite buildOk, buildBlocked, unitDebug; Sprite buildOk, buildBlocked, unitDebug;
@@ -79,7 +79,7 @@ namespace OpenRA
} }
} }
static class LineBuildUtils public static class LineBuildUtils
{ {
public static IEnumerable<int2> GetLineBuildCells(World world, int2 location, string name, BuildingInfo bi) public static IEnumerable<int2> GetLineBuildCells(World world, int2 location, string name, BuildingInfo bi)
{ {

View File

@@ -9,10 +9,11 @@
#endregion #endregion
using System.Collections.Generic; using System.Collections.Generic;
using OpenRA.Effects;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Effects namespace OpenRA.Mods.RA.Effects
{ {
class RepairIndicator : IEffect class RepairIndicator : IEffect
{ {

View File

@@ -87,17 +87,26 @@
<Compile Include="Effects\GravityBomb.cs" /> <Compile Include="Effects\GravityBomb.cs" />
<Compile Include="Effects\LaserZap.cs" /> <Compile Include="Effects\LaserZap.cs" />
<Compile Include="Effects\Missile.cs" /> <Compile Include="Effects\Missile.cs" />
<Compile Include="Effects\RepairIndicator.cs" />
<Compile Include="Effects\Smoke.cs" /> <Compile Include="Effects\Smoke.cs" />
<Compile Include="Effects\TeslaZap.cs" /> <Compile Include="Effects\TeslaZap.cs" />
<Compile Include="LimitedAmmo.cs" /> <Compile Include="LimitedAmmo.cs" />
<Compile Include="Orders\PlaceBuildingOrderGenerator.cs" />
<Compile Include="Player\ActorGroupProxy.cs" /> <Compile Include="Player\ActorGroupProxy.cs" />
<Compile Include="Aircraft.cs" /> <Compile Include="Aircraft.cs" />
<Compile Include="Player\ClassicProductionQueue.cs" />
<Compile Include="Player\PlaceBuilding.cs" />
<Compile Include="Player\ProductionQueue.cs" />
<Compile Include="PrimaryBuilding.cs" />
<Compile Include="Production.cs" />
<Compile Include="RallyPoint.cs" />
<Compile Include="RenderDetectionCircle.cs" /> <Compile Include="RenderDetectionCircle.cs" />
<Compile Include="RenderRangeCircle.cs" /> <Compile Include="RenderRangeCircle.cs" />
<Compile Include="Render\RenderBuilding.cs" /> <Compile Include="Render\RenderBuilding.cs" />
<Compile Include="Render\RenderBuildingTurreted.cs" /> <Compile Include="Render\RenderBuildingTurreted.cs" />
<Compile Include="Render\RenderUnit.cs" /> <Compile Include="Render\RenderUnit.cs" />
<Compile Include="Render\RenderUnitTurreted.cs" /> <Compile Include="Render\RenderUnitTurreted.cs" />
<Compile Include="RepairableBuilding.cs" />
<Compile Include="ReservableProduction.cs" /> <Compile Include="ReservableProduction.cs" />
<Compile Include="SupportPowers\AirstrikePower.cs" /> <Compile Include="SupportPowers\AirstrikePower.cs" />
<Compile Include="AttackFrontal.cs" /> <Compile Include="AttackFrontal.cs" />

View File

@@ -13,7 +13,7 @@ using System.Linq;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Traits; using OpenRA.Traits;
namespace OpenRA.Orders namespace OpenRA.Mods.RA.Orders
{ {
public class PlaceBuildingOrderGenerator : IOrderGenerator public class PlaceBuildingOrderGenerator : IOrderGenerator
{ {

View File

@@ -8,12 +8,11 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
public class ClassicProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeInfo>, ITraitPrerequisite<PowerManagerInfo>, ITraitPrerequisite<PlayerResourcesInfo> public class ClassicProductionQueueInfo : ProductionQueueInfo, ITraitPrerequisite<TechTreeInfo>, ITraitPrerequisite<PowerManagerInfo>, ITraitPrerequisite<PlayerResourcesInfo>
{ {

View File

@@ -10,10 +10,10 @@
using System.Linq; using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.GameRules;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
class PlaceBuildingInfo : TraitInfo<PlaceBuilding> {} class PlaceBuildingInfo : TraitInfo<PlaceBuilding> {}

View File

@@ -11,8 +11,9 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
public class ProductionQueueInfo : ITraitInfo public class ProductionQueueInfo : ITraitInfo
{ {

View File

@@ -10,8 +10,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
class PrimaryBuildingInfo : TraitInfo<PrimaryBuilding> { } class PrimaryBuildingInfo : TraitInfo<PrimaryBuilding> { }

View File

@@ -8,11 +8,11 @@
*/ */
#endregion #endregion
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
public class ProductionInfo : ITraitInfo public class ProductionInfo : ITraitInfo
{ {
@@ -61,7 +61,7 @@ namespace OpenRA.Traits
// Animate the spawn -> exit transition // Animate the spawn -> exit transition
var speed = move.MovementSpeedForCell(self, exit); var speed = move.MovementSpeedForCell(self, exit);
var length = speed > 0 ? (int)( ( to - spawn ).Length*3 / speed ) : 0; var length = speed > 0 ? (int)( ( to - spawn ).Length*3 / speed ) : 0;
newUnit.QueueActivity(new Activities.Drag(spawn, to, length)); newUnit.QueueActivity(new Traits.Activities.Drag(spawn, to, length));
// Log.Write("debug", "length={0} facing={1} exit={2} spawn={3}", length, facing.Facing, exit, spawn); // Log.Write("debug", "length={0} facing={1} exit={2} spawn={3}", length, facing.Facing, exit, spawn);
@@ -72,7 +72,7 @@ namespace OpenRA.Traits
{ {
target = rp.rallyPoint; target = rp.rallyPoint;
// Todo: Move implies unit has Mobile // Todo: Move implies unit has Mobile
newUnit.QueueActivity(new Activities.Move(target, 1)); newUnit.QueueActivity(new Traits.Activities.Move(target, 1));
} }
if (newUnit.Owner == self.World.LocalPlayer) if (newUnit.Owner == self.World.LocalPlayer)

View File

@@ -11,8 +11,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
class RallyPointInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo> class RallyPointInfo : ITraitInfo, ITraitPrerequisite<RenderSimpleInfo>
{ {
@@ -38,8 +39,8 @@ namespace OpenRA.Traits
public IEnumerable<Renderable> Render(Actor self) public IEnumerable<Renderable> Render(Actor self)
{ {
if (self.Owner == self.World.LocalPlayer && self.World.Selection.Actors.Contains(self)) if (self.Owner == self.World.LocalPlayer && self.World.Selection.Actors.Contains(self))
yield return Util.Centered(self, yield return Traits.Util.Centered(self,
anim.Image, Util.CenterOfCell(rallyPoint)); anim.Image, Traits.Util.CenterOfCell(rallyPoint));
} }
public int OrderPriority(Actor self, int2 xy, MouseInput mi, Actor underCursor) public int OrderPriority(Actor self, int2 xy, MouseInput mi, Actor underCursor)

View File

@@ -9,14 +9,10 @@
#endregion #endregion
using System; using System;
using System.Collections.Generic; using OpenRA.Mods.RA.Effects;
using System.Drawing; using OpenRA.Traits;
using System.Linq;
using OpenRA.Effects;
using OpenRA.GameRules;
using OpenRA.Traits.Activities;
namespace OpenRA.Traits namespace OpenRA.Mods.RA
{ {
public class RepairableBuildingInfo : ITraitInfo, ITraitPrerequisite<HealthInfo> public class RepairableBuildingInfo : ITraitInfo, ITraitPrerequisite<HealthInfo>
{ {

View File

@@ -14,7 +14,7 @@ using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Orders; using OpenRA.Mods.RA.Orders;
using OpenRA.Traits; using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;