diff --git a/OpenRA.Game/Map/ActorInitializer.cs b/OpenRA.Game/Map/ActorInitializer.cs index 557a04171f..e02ae5ba16 100644 --- a/OpenRA.Game/Map/ActorInitializer.cs +++ b/OpenRA.Game/Map/ActorInitializer.cs @@ -11,7 +11,6 @@ using System.Linq; using OpenRA.Primitives; -using OpenRA.Traits; namespace OpenRA { @@ -48,14 +47,6 @@ namespace OpenRA T Value(World world); } - public class FacingInit : IActorInit - { - [FieldFromYamlKey] readonly int value = 128; - public FacingInit() { } - public FacingInit(int init) { value = init; } - public int Value(World world) { return value; } - } - public class LocationInit : IActorInit { [FieldFromYamlKey] readonly CPos value = CPos.Zero; @@ -64,23 +55,6 @@ namespace OpenRA public CPos Value(World world) { return value; } } - public class SubCellInit : IActorInit - { - [FieldFromYamlKey] readonly int value = (int)SubCell.FullCell; - public SubCellInit() { } - public SubCellInit(int init) { value = init; } - public SubCellInit(SubCell init) { value = (int)init; } - public SubCell Value(World world) { return (SubCell)value; } - } - - public class CenterPositionInit : IActorInit - { - [FieldFromYamlKey] readonly WPos value = WPos.Zero; - public CenterPositionInit() { } - public CenterPositionInit(WPos init) { value = init; } - public WPos Value(World world) { return value; } - } - public class OwnerInit : IActorInit { [FieldFromYamlKey] public readonly string PlayerName = "Neutral"; @@ -103,14 +77,4 @@ namespace OpenRA return world.Players.First(x => x.InternalName == PlayerName); } } - - // Allows maps / transformations to specify the faction variant of an actor. - public class FactionInit : IActorInit - { - [FieldFromYamlKey] public readonly string Faction; - - public FactionInit() { } - public FactionInit(string faction) { Faction = faction; } - public string Value(World world) { return Faction; } - } } diff --git a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs index b8a2e9d427..f444d8b6e9 100644 --- a/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs +++ b/OpenRA.Mods.Cnc/Traits/Buildings/ProductionAirdrop.cs @@ -11,6 +11,7 @@ using System.Linq; using OpenRA.Activities; +using OpenRA.Mods.Common; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Traits; using OpenRA.Primitives; diff --git a/OpenRA.Mods.Common/ActorInitializer.cs b/OpenRA.Mods.Common/ActorInitializer.cs new file mode 100644 index 0000000000..457eee6673 --- /dev/null +++ b/OpenRA.Mods.Common/ActorInitializer.cs @@ -0,0 +1,40 @@ +using System; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common +{ + public class FacingInit : IActorInit + { + [FieldFromYamlKey] readonly int value = 128; + public FacingInit() { } + public FacingInit(int init) { value = init; } + public int Value(World world) { return value; } + } + + public class SubCellInit : IActorInit + { + [FieldFromYamlKey] readonly int value = (int)SubCell.FullCell; + public SubCellInit() { } + public SubCellInit(int init) { value = init; } + public SubCellInit(SubCell init) { value = (int)init; } + public SubCell Value(World world) { return (SubCell)value; } + } + + public class CenterPositionInit : IActorInit + { + [FieldFromYamlKey] readonly WPos value = WPos.Zero; + public CenterPositionInit() { } + public CenterPositionInit(WPos init) { value = init; } + public WPos Value(World world) { return value; } + } + + // Allows maps / transformations to specify the faction variant of an actor. + public class FactionInit : IActorInit + { + [FieldFromYamlKey] public readonly string Faction; + + public FactionInit() { } + public FactionInit(string faction) { Faction = faction; } + public string Value(World world) { return Faction; } + } +} diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 867149f46c..806c98c093 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -196,6 +196,7 @@ + diff --git a/OpenRA.Mods.D2k/Traits/Buildings/FreeActorWithDelivery.cs b/OpenRA.Mods.D2k/Traits/Buildings/FreeActorWithDelivery.cs index 9ae4f57b85..21662d34e0 100644 --- a/OpenRA.Mods.D2k/Traits/Buildings/FreeActorWithDelivery.cs +++ b/OpenRA.Mods.D2k/Traits/Buildings/FreeActorWithDelivery.cs @@ -9,6 +9,7 @@ */ #endregion +using OpenRA.Mods.Common; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.D2k.Activities; diff --git a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs index c814b75308..1b19a44741 100644 --- a/OpenRA.Mods.D2k/Traits/SpiceBloom.cs +++ b/OpenRA.Mods.D2k/Traits/SpiceBloom.cs @@ -14,6 +14,7 @@ using System.Linq; using OpenRA.Effects; using OpenRA.GameRules; using OpenRA.Graphics; +using OpenRA.Mods.Common; using OpenRA.Mods.Common.Graphics; using OpenRA.Mods.Common.Traits; using OpenRA.Mods.Common.Traits.Render; diff --git a/OpenRA.Mods.RA/Traits/Buildings/ClonesProducedUnits.cs b/OpenRA.Mods.RA/Traits/Buildings/ClonesProducedUnits.cs index 4294b38986..b42f855dd5 100644 --- a/OpenRA.Mods.RA/Traits/Buildings/ClonesProducedUnits.cs +++ b/OpenRA.Mods.RA/Traits/Buildings/ClonesProducedUnits.cs @@ -10,6 +10,7 @@ #endregion using System.Collections.Generic; +using OpenRA.Mods.Common; using OpenRA.Mods.Common.Traits; using OpenRA.Traits; diff --git a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs index 6a1f856e8e..b779bb027f 100644 --- a/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs +++ b/OpenRA.Mods.RA/Traits/SupportPowers/ParatroopersPower.cs @@ -12,6 +12,7 @@ using System; using System.Collections.Generic; using System.Linq; +using OpenRA.Mods.Common; using OpenRA.Mods.Common.Activities; using OpenRA.Mods.Common.Effects; using OpenRA.Mods.Common.Traits; diff --git a/OpenRA.Mods.TS/UtilityCommands/ImportTSMapCommand.cs b/OpenRA.Mods.TS/UtilityCommands/ImportTSMapCommand.cs index 356ef55d46..b44c4d03e8 100644 --- a/OpenRA.Mods.TS/UtilityCommands/ImportTSMapCommand.cs +++ b/OpenRA.Mods.TS/UtilityCommands/ImportTSMapCommand.cs @@ -15,9 +15,9 @@ using System.Drawing; using System.IO; using System.Linq; using OpenRA.FileSystem; +using OpenRA.Mods.Common; using OpenRA.Mods.Common.FileFormats; using OpenRA.Mods.Common.Traits; -using OpenRA.Traits; namespace OpenRA.Mods.TS.UtilityCommands {