From a33bb7bd8a9a5f4e244e26f0b2a1a586dc63c9bf Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 20 May 2010 17:41:07 +1200 Subject: [PATCH] move HasUnitOnBuild to RA --- OpenRA.Game/OpenRA.Game.csproj | 1 - OpenRA.Game/Traits/HasUnitOnBuild.cs | 37 ------------------- OpenRA.Mods.RA/HasUnitOnBuild.cs | 55 ++++++++++++++++++++++++++++ OpenRA.Mods.RA/OpenRA.Mods.RA.csproj | 1 + 4 files changed, 56 insertions(+), 38 deletions(-) delete mode 100644 OpenRA.Game/Traits/HasUnitOnBuild.cs create mode 100644 OpenRA.Mods.RA/HasUnitOnBuild.cs diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 745d44996b..54fc1f72e4 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -294,7 +294,6 @@ - diff --git a/OpenRA.Game/Traits/HasUnitOnBuild.cs b/OpenRA.Game/Traits/HasUnitOnBuild.cs deleted file mode 100644 index 62cd4ace9e..0000000000 --- a/OpenRA.Game/Traits/HasUnitOnBuild.cs +++ /dev/null @@ -1,37 +0,0 @@ - -using System; - -namespace OpenRA.Traits -{ - - class HasUnitOnBuildInfo : ITraitInfo - { - public readonly string Unit = null; - public readonly string InitialActivity = null; - public readonly int2 SpawnOffset = int2.Zero; - public readonly int Facing = 0; - - public object Create( Actor self ) { return new HasUnitOnBuild(self); } - } - - public class HasUnitOnBuild - { - - public HasUnitOnBuild(Actor self) - { - var info = self.Info.Traits.Get(); - - self.World.AddFrameEndTask( - w => - { - var unit = w.CreateActor(info.Unit, self.Location - + info.SpawnOffset, self.Owner); - var unitTrait = unit.traits.Get(); - unitTrait.Facing = info.Facing; - - if (info.InitialActivity != null) - unit.QueueActivity(Game.CreateObject(info.InitialActivity)); - }); - } - } -} diff --git a/OpenRA.Mods.RA/HasUnitOnBuild.cs b/OpenRA.Mods.RA/HasUnitOnBuild.cs new file mode 100644 index 0000000000..02fa212578 --- /dev/null +++ b/OpenRA.Mods.RA/HasUnitOnBuild.cs @@ -0,0 +1,55 @@ +#region Copyright & License Information +/* + * Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford. + * This file is part of OpenRA. + * + * OpenRA is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * OpenRA is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with OpenRA. If not, see . + */ +#endregion + +using OpenRA.Traits; + +namespace OpenRA.Mods.RA +{ + class HasUnitOnBuildInfo : ITraitInfo + { + public readonly string Unit = null; + public readonly string InitialActivity = null; + public readonly int2 SpawnOffset = int2.Zero; + public readonly int Facing = 0; + + public object Create( Actor self ) { return new HasUnitOnBuild(self); } + } + + public class HasUnitOnBuild + { + + public HasUnitOnBuild(Actor self) + { + var info = self.Info.Traits.Get(); + + self.World.AddFrameEndTask( + w => + { + var unit = w.CreateActor(info.Unit, self.Location + + info.SpawnOffset, self.Owner); + var unitTrait = unit.traits.Get(); + unitTrait.Facing = info.Facing; + + if (info.InitialActivity != null) + unit.QueueActivity(Game.CreateObject(info.InitialActivity)); + }); + } + } +} diff --git a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj index aadd47ecee..8188bd407f 100644 --- a/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj +++ b/OpenRA.Mods.RA/OpenRA.Mods.RA.csproj @@ -66,6 +66,7 @@ +