From d730b4ee50d19cc709bb4a07e181423767f1b94e Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 14 Aug 2015 19:35:48 +0100 Subject: [PATCH 1/4] Remove duplicated DoProduction from Production. --- OpenRA.Mods.Common/Traits/Buildings/Exit.cs | 2 +- OpenRA.Mods.Common/Traits/Production.cs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs index 54b35ac4a9..7940d1c522 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Exit.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Exit.cs @@ -15,7 +15,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits { [Desc("Where the unit should leave the building. Multiples are allowed if IDs are added: Exit@2, ...")] - public class ExitInfo : TraitInfo + public class ExitInfo : TraitInfo, Requires { [Desc("Offset at which that the exiting actor is spawned relative to the center of the producing actor.")] public readonly WVec SpawnOffset = WVec.Zero; diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index 87c033c7bf..a2d1781a29 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -118,17 +118,11 @@ namespace OpenRA.Mods.Common.Traits if (Reservable.IsReserved(self)) return false; - if (!occupiesSpace) - { - DoProduction(self, producee, null, factionVariant); - return true; - } - // Pick a spawn/exit point pair var exit = self.Info.Traits.WithInterface().Shuffle(self.World.SharedRandom) .FirstOrDefault(e => CanUseExit(self, producee, e)); - if (exit != null) + if (exit != null || !occupiesSpace) { DoProduction(self, producee, exit, factionVariant); return true; From 086467020e006a2083709ffbfa0d179c1c60b777 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 14 Aug 2015 19:44:05 +0100 Subject: [PATCH 2/4] Simplify IOccupySpace check. --- OpenRA.Mods.Common/Traits/Production.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index a2d1781a29..89a5cc3ab4 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits public Production(ActorInitializer init, ProductionInfo info) { Info = info; - occupiesSpace = init.Self.Info.Traits.WithInterface().Any(); + occupiesSpace = init.Self.Info.Traits.Contains(); rp = Exts.Lazy(() => init.Self.IsDead ? null : init.Self.TraitOrDefault()); Faction = init.Contains() ? init.Get() : init.Self.Owner.Faction.InternalName; } From 8dfd42b30e2e16dff5d04eb9d2c99aacb78aa7d7 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 14 Aug 2015 19:36:35 +0100 Subject: [PATCH 3/4] Make Production.Info readonly. --- OpenRA.Mods.Common/Traits/Production.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Production.cs b/OpenRA.Mods.Common/Traits/Production.cs index 89a5cc3ab4..99b340b268 100644 --- a/OpenRA.Mods.Common/Traits/Production.cs +++ b/OpenRA.Mods.Common/Traits/Production.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Lazy rp; - public ProductionInfo Info; + public readonly ProductionInfo Info; public string Faction { get; private set; } readonly bool occupiesSpace; From 30d0ce2deefe284035cc2584de79126f73d9f9d9 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 14 Aug 2015 19:40:54 +0100 Subject: [PATCH 4/4] Remove bogus property from d2k conyard. --- mods/d2k/rules/structures.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 0c3e8b00ff..d63b452f22 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -56,7 +56,6 @@ conyard: Range: 10c0 Production: Produces: Building, Upgrade - MoveIntoWorld: false Exit: Valued: Cost: 2000