fix some dumbness in Production/ITeleportable
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<IOrderTargeter> Orders { get { yield return new MoveOrderTargeter(Info); } }
|
||||
|
||||
// Note: Returns a valid order even if the unit can't move to the target
|
||||
|
||||
@@ -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<Mobile>();
|
||||
var mobile = newUnit.TraitOrDefault<Mobile>();
|
||||
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<Helicopter>();
|
||||
var helicopter = newUnit.TraitOrDefault<Helicopter>();
|
||||
if (helicopter != null)
|
||||
{
|
||||
newUnit.QueueActivity(new HeliFly(Util.CenterOfCell(rp.rallyPoint)));
|
||||
|
||||
Reference in New Issue
Block a user