fis crap w/ grids being deleted while component events still ref
This commit is contained in:
@@ -79,10 +79,9 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev.LastPosition.HasValue)
|
// Entity is no longer valid, update around the last position it was at.
|
||||||
|
if (ev.LastPosition.HasValue && _mapManager.TryGetGrid(ev.LastPosition.Value.grid, out var grid))
|
||||||
{
|
{
|
||||||
// Entity is no longer valid, update around the last position it was at.
|
|
||||||
var grid = _mapManager.GetGrid(ev.LastPosition.Value.grid);
|
|
||||||
var pos = ev.LastPosition.Value.pos;
|
var pos = ev.LastPosition.Value.pos;
|
||||||
|
|
||||||
AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(1, 0), ev.Offset));
|
AddValidEntities(grid.GetSnapGridCell(pos + new MapIndices(1, 0), ev.Offset));
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private void HandleDirtyEvent(SubFloorHideDirtyEvent ev)
|
private void HandleDirtyEvent(SubFloorHideDirtyEvent ev)
|
||||||
{
|
{
|
||||||
var grid = _mapManager.GetGrid(ev.Sender.Transform.GridID);
|
if (!_mapManager.TryGetGrid(ev.Sender.Transform.GridID, out var grid))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var indices = grid.WorldToTile(ev.Sender.Transform.WorldPosition);
|
var indices = grid.WorldToTile(ev.Sender.Transform.WorldPosition);
|
||||||
UpdateTile(grid, indices);
|
UpdateTile(grid, indices);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user