diff --git a/OpenRA.Game/Traits/TraitsInterfaces.cs b/OpenRA.Game/Traits/TraitsInterfaces.cs index 74e78e1b3f7c..684c3b0038dc 100755 --- a/OpenRA.Game/Traits/TraitsInterfaces.cs +++ b/OpenRA.Game/Traits/TraitsInterfaces.cs @@ -122,6 +122,7 @@ public interface ITeleportable : IHasLocation /* crap name! */ 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 ed717337f201..0ad746a0ada6 100755 --- a/OpenRA.Mods.RA/Air/Aircraft.cs +++ b/OpenRA.Mods.RA/Air/Aircraft.cs @@ -69,6 +69,8 @@ public void SetPxPosition( Actor self, int2 px ) 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 71ba0f518710..69a327943f24 100644 --- a/OpenRA.Mods.RA/Crate.cs +++ b/OpenRA.Mods.RA/Crate.cs @@ -89,6 +89,8 @@ public void SetPxPosition( Actor self, int2 px ) 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 b3b97355cfd2..d84fedd9beed 100755 --- a/OpenRA.Mods.RA/Move/Mobile.cs +++ b/OpenRA.Mods.RA/Move/Mobile.cs @@ -185,6 +185,11 @@ public void SetPxPosition(Actor self, int2 px) 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 3ee7cc57fe54..1945879ea361 100755 --- a/OpenRA.Mods.RA/Production.cs +++ b/OpenRA.Mods.RA/Production.cs @@ -57,7 +57,7 @@ public void DoProduction(Actor self, ActorInfo producee, ExitInfo exitinfo) // 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 @@ static int2 MoveToRallyPoint(Actor self, Actor newUnit, int2 exitLocation) 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 @@ static int2 MoveToRallyPoint(Actor self, Actor newUnit, int2 exitLocation) } // 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)));