diff --git a/OpenRa.Game/Traits/Production.cs b/OpenRa.Game/Traits/Production.cs index 0ddf593bd9..50cdde4362 100755 --- a/OpenRa.Game/Traits/Production.cs +++ b/OpenRa.Game/Traits/Production.cs @@ -7,6 +7,8 @@ namespace OpenRa.Traits public class ProductionInfo : ITraitInfo { public readonly int[] SpawnOffset = null; + public readonly int[] ProductionOffset = null; + public readonly int[] ExitOffset = null; public readonly string[] Produces = { }; public virtual object Create(Actor self) { return new Production(self); } @@ -21,9 +23,22 @@ namespace OpenRa.Traits public virtual int2? CreationLocation( Actor self, ActorInfo producee ) { - return ( 1 / 24f * self.CenterLocation ).ToInt2(); + var pos = (1 / 24f * self.CenterLocation).ToInt2(); + var pi = self.Info.Traits.Get(); + if (pi.ProductionOffset != null) + pos += new int2(pi.ProductionOffset[0], pi.ProductionOffset[1]); + return pos; } + public virtual int2? ExitLocation(Actor self, ActorInfo producee) + { + var pos = (1 / 24f * self.CenterLocation).ToInt2(); + var pi = self.Info.Traits.Get(); + if (pi.ExitOffset != null) + pos += new int2(pi.ExitOffset[0], pi.ExitOffset[1]); + return pos; + } + public virtual int CreationFacing( Actor self, Actor newUnit ) { return newUnit.Info.Traits.GetOrDefault().InitialFacing; @@ -38,15 +53,22 @@ namespace OpenRa.Traits var newUnit = self.World.CreateActor( producee.Name, location.Value, self.Owner ); newUnit.traits.Get().Facing = CreationFacing( self, newUnit ); ; + var pi = self.Info.Traits.Get(); var rp = self.traits.GetOrDefault(); - if( rp != null ) + if( rp != null || pi.ExitOffset != null) { var mobile = newUnit.traits.GetOrDefault(); if( mobile != null ) - newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) ); + { + if (pi.ExitOffset != null) + newUnit.QueueActivity(new Activities.Move(ExitLocation( self, producee).Value, 1)); + + if (rp != null) + newUnit.QueueActivity( new Activities.Move( rp.rallyPoint, 1 ) ); + } } - var pi = self.Info.Traits.Get(); + if (pi != null && pi.SpawnOffset != null) newUnit.CenterLocation = self.CenterLocation + new float2(pi.SpawnOffset[0], pi.SpawnOffset[1]); diff --git a/mods/cnc/sequences-structures.xml b/mods/cnc/sequences-structures.xml index 0fc354bcaa..786caf8dbe 100644 --- a/mods/cnc/sequences-structures.xml +++ b/mods/cnc/sequences-structures.xml @@ -59,9 +59,9 @@ - - - + + + diff --git a/mods/cnc/structures.yaml b/mods/cnc/structures.yaml index b46c33fc0d..ae54c823de 100644 --- a/mods/cnc/structures.yaml +++ b/mods/cnc/structures.yaml @@ -167,7 +167,7 @@ WEAP: LongDesc: Assembly point for vehicle reinforcements Building: Power: -30 - Footprint: ___ xxx xxx + Footprint: ___ xxx === Dimensions: 3,3 Capturable: true Bib: yes @@ -178,8 +178,8 @@ WEAP: RenderWarFactory: RallyPoint: Production: + ExitOffset:-1,1 Produces: Vehicle - HQ: RequiresPower: CanPowerDown: