Fixed UnloadCargo stacking using new subcell API exposure

This commit is contained in:
atlimit8
2014-08-08 14:27:54 -05:00
parent 9efcf231e1
commit ff7ad53dee
8 changed files with 35 additions and 12 deletions

View File

@@ -627,18 +627,19 @@ namespace OpenRA.Mods.RA.Move
{
var pos = self.CenterPosition;
subCell = self.World.ActorMap.FreeSubCell(cell, subCell);
if (subCell == -1)
subCell = self.World.ActorMap.FreeSubCell(cell, subCell);
// TODO: solve/reduce cell is full problem
if (subCell < 0)
subCell = self.World.Map.SubCellDefaultIndex;
// Reserve the exit cell
SetPosition(self, cell);
SetPosition(self, cell, subCell);
SetVisualPosition(self, pos);
// Animate transition
var to = self.World.Map.CenterOfCell(cell);
var to = self.World.Map.CenterOfCell(cell) + self.World.Map.SubCellOffsets[subCell];
var speed = MovementSpeedForCell(self, cell);
var length = speed > 0 ? (to - pos).Length / speed : 0;

View File

@@ -57,6 +57,14 @@ namespace OpenRA.Mods.RA.Move
this.nearEnough = nearEnough;
}
public Move(CPos destination, int subCell, WRange nearEnough)
{
this.getPath = (self, mobile) => self.World.WorldActor.Trait<PathFinder>()
.FindUnitPathToRange(mobile.fromCell, subCell, self.World.Map.CenterOfCell(destination) + self.World.Map.SubCellOffsets[subCell], nearEnough, self);
this.destination = destination;
this.nearEnough = nearEnough;
}
public Move(CPos destination, Actor ignoreBuilding)
{
this.getPath = (self, mobile) =>