diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 74e78e1b3f..684c3b0038 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -122,6 +122,7 @@ namespace OpenRA.Traits bool CanEnterCell(int2 location); void SetPosition(Actor self, int2 cell); void SetPxPosition(Actor self, int2 px); + void AdjustPxPosition(Actor self, int2 px); /* works like SetPxPosition, but visual only */ } public interface IMove : ITeleportable diff --git a/OpenRA.Mods.RA/Air/Aircraft.cs b/OpenRA.Mods.RA/Air/Aircraft.cs index ed717337f2..0ad746a0ad 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -69,6 +69,8 @@ namespace OpenRA.Mods.RA.Air SubPxPosition = px * 1024; } + public void AdjustPxPosition(Actor self, int2 px) { SetPxPosition(self, px); } + public bool AircraftCanEnter(Actor a) { if( self.Owner != a.Owner ) return false; diff --git a/OpenRA.Mods.RA/Crate.cs b/OpenRA.Mods.RA/Crate.cs index 71ba0f5187..69a327943f 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -89,6 +89,8 @@ namespace OpenRA.Mods.RA SetPosition( self, Util.CellContaining( px ) ); } + public void AdjustPxPosition(Actor self, int2 px) { SetPxPosition(self, px); } + public bool CanEnterCell(int2 cell) { if (!self.World.Map.IsInMap(cell.X, cell.Y)) return false; diff --git a/OpenRA.Mods.RA/Move/Mobile.cs b/OpenRA.Mods.RA/Move/Mobile.cs index b3b97355cf..d84fedd9be 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -185,6 +185,11 @@ namespace OpenRA.Mods.RA.Move FinishedMoving(self); } + public void AdjustPxPosition(Actor self, int2 px) /* visual hack only */ + { + PxPosition = px; + } + public IEnumerable Orders { get { yield return new MoveOrderTargeter(Info); } } // Note: Returns a valid order even if the unit can't move to the target diff --git a/OpenRA.Mods.RA/Production.cs b/OpenRA.Mods.RA/Production.cs index 3ee7cc57fe..1945879ea3 100755 --- a/OpenRA.Mods.RA/Production.cs +++ b/OpenRA.Mods.RA/Production.cs @@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA // Set the physical position of the unit as the exit cell teleportable.SetPosition(newUnit,exit); var to = Util.CenterOfCell(exit); - teleportable.SetPxPosition(newUnit, spawn); + teleportable.AdjustPxPosition(newUnit, spawn); if (facing != null) facing.Facing = exitinfo.Facing < 0 ? Util.GetFacing(to - spawn, facing.Facing) : exitinfo.Facing; self.World.Add(newUnit); @@ -84,7 +84,7 @@ namespace OpenRA.Mods.RA if (rp == null) return exitLocation; - var mobile = self.TraitOrDefault(); + var mobile = newUnit.TraitOrDefault(); if (mobile != null) { newUnit.QueueActivity(mobile.MoveTo(rp.rallyPoint, 1)); @@ -92,7 +92,7 @@ namespace OpenRA.Mods.RA } // todo: don't talk about HeliFly here. - var helicopter = self.TraitOrDefault(); + var helicopter = newUnit.TraitOrDefault(); if (helicopter != null) { newUnit.QueueActivity(new HeliFly(Util.CenterOfCell(rp.rallyPoint)));