diff --git a/OpenRA.Mods.RA/Production.cs b/OpenRA.Mods.RA/Production.cs index 715a37c38f..291bd89683 100755 --- a/OpenRA.Mods.RA/Production.cs +++ b/OpenRA.Mods.RA/Production.cs @@ -34,6 +34,7 @@ namespace OpenRA.Mods.RA [Desc("Cell offset where the exiting actor enters the ActorMap")] public readonly CVec ExitCell = CVec.Zero; public readonly int Facing = -1; + public readonly bool MoveIntoWorld = true; } public class Exit { } @@ -58,28 +59,15 @@ namespace OpenRA.Mods.RA var newUnit = self.World.CreateActor(producee.Name, new TypeDictionary { new OwnerInit(self.Owner), - new LocationInit(exit), + new CenterPositionInit(spawn), new FacingInit(initialFacing) }); - // TODO: Move this into an *Init - // TODO: We should be adjusting the actual position for aircraft, not just visuals. - var teleportable = newUnit.Trait(); - teleportable.SetVisualPosition(newUnit, spawn); - - // TODO: Generalize this for non-mobile (e.g. aircraft) too - // Remember to update the Enter activity too - var mobile = newUnit.TraitOrDefault(); - if (mobile != null) - { - // Animate the spawn -> exit transition - var speed = mobile.MovementSpeedForCell(newUnit, exit); - var length = speed > 0 ? (to - spawn).Length / speed : 0; - newUnit.QueueActivity(new Drag(spawn, to, length)); - } + var move = newUnit.Trait(); + if (exitinfo.MoveIntoWorld) + newUnit.QueueActivity(move.MoveIntoWorld(newUnit, exit)); var target = MoveToRallyPoint(self, newUnit, exit); - newUnit.SetTargetLine(Target.FromCell(target), Color.Green, false); foreach (var t in self.TraitsImplementing()) t.UnitProduced(self, newUnit, exit); diff --git a/mods/ra/rules/structures.yaml b/mods/ra/rules/structures.yaml index 384f3e7f31..21ed09bb2f 100644 --- a/mods/ra/rules/structures.yaml +++ b/mods/ra/rules/structures.yaml @@ -1025,6 +1025,7 @@ HPAD: Exit@1: SpawnOffset: 0,-256,0 ExitCell: 0,0 + MoveIntoWorld: false Production: Produces: Helicopter Reservable: @@ -1059,6 +1060,7 @@ AFLD: SpawnOffset: 0,170,0 ExitCell: 1,1 Facing: 192 + MoveIntoWorld: false Production: Produces: Plane Reservable: