Revert "Fix crushables and crates causing HPF to crash."
This reverts commit 5765e51c56.
This commit is contained in:
@@ -120,11 +120,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
var move = actor.Trait<IMove>();
|
var move = actor.Trait<IMove>();
|
||||||
var pos = actor.Trait<IPositionable>();
|
var pos = actor.Trait<IPositionable>();
|
||||||
|
|
||||||
// HACK: Call SetCenterPosition before SetPosition
|
|
||||||
// So when SetPosition calls ActorMap.CellUpdated
|
|
||||||
// the listeners see the new CenterPosition.
|
|
||||||
pos.SetCenterPosition(actor, spawn);
|
|
||||||
pos.SetPosition(actor, exitSubCell.Value.Cell, exitSubCell.Value.SubCell);
|
pos.SetPosition(actor, exitSubCell.Value.Cell, exitSubCell.Value.SubCell);
|
||||||
|
pos.SetCenterPosition(actor, spawn);
|
||||||
|
|
||||||
actor.CancelActivity();
|
actor.CancelActivity();
|
||||||
w.Add(actor);
|
w.Add(actor);
|
||||||
|
|||||||
@@ -46,12 +46,9 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
[Desc("Moves from outside the world into the cell grid.")]
|
[Desc("Moves from outside the world into the cell grid.")]
|
||||||
public void MoveIntoWorld(CPos cell)
|
public void MoveIntoWorld(CPos cell)
|
||||||
{
|
{
|
||||||
// HACK: Call SetCenterPosition before SetPosition
|
|
||||||
// So when SetPosition calls ActorMap.CellUpdated
|
|
||||||
// the listeners see the new CenterPosition.
|
|
||||||
var pos = Self.CenterPosition;
|
var pos = Self.CenterPosition;
|
||||||
mobile.SetCenterPosition(Self, pos);
|
|
||||||
mobile.SetPosition(Self, cell);
|
mobile.SetPosition(Self, cell);
|
||||||
|
mobile.SetCenterPosition(Self, pos);
|
||||||
Self.QueueActivity(mobile.ReturnToCell(Self));
|
Self.QueueActivity(mobile.ReturnToCell(Self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,22 +183,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Sets the location (Location) and position (CenterPosition)
|
// Sets the location (Location) and position (CenterPosition)
|
||||||
public void SetPosition(Actor self, WPos pos)
|
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);
|
var cell = self.World.Map.CellContaining(pos);
|
||||||
SetCenterPosition(self, self.World.Map.CenterOfCell(cell) + new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(pos)));
|
|
||||||
SetLocation(self, cell);
|
SetLocation(self, cell);
|
||||||
|
SetCenterPosition(self, self.World.Map.CenterOfCell(cell) + new WVec(WDist.Zero, WDist.Zero, self.World.Map.DistanceAboveTerrain(pos)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the location (Location) and position (CenterPosition)
|
// Sets the location (Location) and position (CenterPosition)
|
||||||
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
||||||
{
|
{
|
||||||
// HACK: Call SetCenterPosition before SetLocation
|
|
||||||
// So when SetLocation calls ActorMap.CellUpdated
|
|
||||||
// the listeners see the new CenterPosition.
|
|
||||||
SetCenterPosition(self, self.World.Map.CenterOfCell(cell));
|
|
||||||
SetLocation(self, cell);
|
SetLocation(self, cell);
|
||||||
|
SetCenterPosition(self, self.World.Map.CenterOfCell(cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets only the CenterPosition
|
// Sets only the CenterPosition
|
||||||
|
|||||||
@@ -468,28 +468,22 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
public void SetPosition(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
||||||
{
|
{
|
||||||
subCell = GetValidSubCell(subCell);
|
subCell = GetValidSubCell(subCell);
|
||||||
|
SetLocation(cell, subCell, cell, subCell);
|
||||||
|
|
||||||
var position = cell.Layer == 0 ? self.World.Map.CenterOfCell(cell) :
|
var position = cell.Layer == 0 ? self.World.Map.CenterOfCell(cell) :
|
||||||
self.World.GetCustomMovementLayers()[cell.Layer].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);
|
var subcellOffset = self.World.Map.Grid.OffsetOfSubCell(subCell);
|
||||||
SetCenterPosition(self, position + subcellOffset);
|
SetCenterPosition(self, position + subcellOffset);
|
||||||
SetLocation(cell, subCell, cell, subCell);
|
|
||||||
FinishedMoving(self);
|
FinishedMoving(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the location (fromCell, toCell, FromSubCell, ToSubCell) and CenterPosition
|
// Sets the location (fromCell, toCell, FromSubCell, ToSubCell) and CenterPosition
|
||||||
public void SetPosition(Actor self, WPos pos)
|
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);
|
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);
|
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);
|
FinishedMoving(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,11 +686,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
subCell = self.World.Map.Grid.DefaultSubCell;
|
subCell = self.World.Map.Grid.DefaultSubCell;
|
||||||
|
|
||||||
// Reserve the exit cell
|
// 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.SetPosition(self, cell, subCell);
|
||||||
|
mobile.SetCenterPosition(self, pos);
|
||||||
|
|
||||||
if (delay > 0)
|
if (delay > 0)
|
||||||
QueueChild(new Wait(delay));
|
QueueChild(new Wait(delay));
|
||||||
|
|||||||
@@ -102,12 +102,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
// HACK: Call SetCenterPosition before SetPosition
|
dropPositionable.SetPosition(dropActor, dropCell, dropSubCell);
|
||||||
// So when SetPosition calls ActorMap.CellUpdated
|
|
||||||
// the listeners see the new CenterPosition.
|
|
||||||
var dropPosition = dropActor.CenterPosition + new WVec(0, 0, self.CenterPosition.Z - dropActor.CenterPosition.Z);
|
var dropPosition = dropActor.CenterPosition + new WVec(0, 0, self.CenterPosition.Z - dropActor.CenterPosition.Z);
|
||||||
dropPositionable.SetCenterPosition(dropActor, dropPosition);
|
dropPositionable.SetCenterPosition(dropActor, dropPosition);
|
||||||
dropPositionable.SetPosition(dropActor, dropCell, dropSubCell);
|
|
||||||
w.Add(dropActor);
|
w.Add(dropActor);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user