Revert "Fix crushables and crates causing HPF to crash."

This reverts commit 5765e51c56.
This commit is contained in:
Gustas
2022-09-26 15:39:28 +03:00
committed by abcdefg30
parent 625dc1dd35
commit 5abbdc37cb
5 changed files with 9 additions and 32 deletions

View File

@@ -468,28 +468,22 @@ namespace OpenRA.Mods.Common.Traits
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
{
subCell = GetValidSubCell(subCell);
SetLocation(cell, subCell, cell, subCell);
var position = cell.Layer == 0 ? self.World.Map.CenterOfCell(cell) :
self.World.GetCustomMovementLayers()[cell.Layer].CenterOfCell(cell);
// HACK: Call SetCenterPosition before SetLocation
// So when SetLocation calls ActorMap.CellUpdated
// the listeners see the new CenterPosition.
var subcellOffset = self.World.Map.Grid.OffsetOfSubCell(subCell);
SetCenterPosition(self, position + subcellOffset);
SetLocation(cell, subCell, cell, subCell);
FinishedMoving(self);
}
// Sets the location (fromCell, toCell, FromSubCell, ToSubCell) and CenterPosition
public void SetPosition(Actor self, WPos pos)
{
// HACK: Call SetCenterPosition before SetLocation
// So when SetLocation calls ActorMap.CellUpdated
// the listeners see the new CenterPosition.
var cell = self.World.Map.CellContaining(pos);
SetCenterPosition(self, self.World.Map.CenterOfSubCell(cell, FromSubCell) + new WVec(0, 0, self.World.Map.DistanceAboveTerrain(pos).Length));
SetLocation(cell, FromSubCell, cell, FromSubCell);
SetCenterPosition(self, self.World.Map.CenterOfSubCell(cell, FromSubCell) + new WVec(0, 0, self.World.Map.DistanceAboveTerrain(pos).Length));
FinishedMoving(self);
}
@@ -692,11 +686,8 @@ namespace OpenRA.Mods.Common.Traits
subCell = self.World.Map.Grid.DefaultSubCell;
// Reserve the exit cell
// HACK: Call SetCenterPosition before SetPosition
// So when SetPosition calls ActorMap.CellUpdated
// the listeners see the new CenterPosition.
mobile.SetCenterPosition(self, pos);
mobile.SetPosition(self, cell, subCell);
mobile.SetCenterPosition(self, pos);
if (delay > 0)
QueueChild(new Wait(delay));