Nullable grid Uid (#8798)
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Content.Client.IconSmoothing
|
||||
[RegisterComponent]
|
||||
public sealed class IconSmoothComponent : Component
|
||||
{
|
||||
public (EntityUid, Vector2i)? LastPosition;
|
||||
public (EntityUid?, Vector2i)? LastPosition;
|
||||
|
||||
/// <summary>
|
||||
/// We will smooth with other objects with the same key.
|
||||
|
||||
@@ -33,9 +33,9 @@ namespace Content.Client.IconSmoothing
|
||||
var xform = Transform(uid);
|
||||
if (xform.Anchored)
|
||||
{
|
||||
component.LastPosition = _mapManager.TryGetGrid(xform.GridEntityId, out var grid)
|
||||
? (xform.GridEntityId, grid.TileIndicesFor(xform.Coordinates))
|
||||
: (EntityUid.Invalid, new Vector2i(0, 0));
|
||||
component.LastPosition = _mapManager.TryGetGrid(xform.GridUid, out var grid)
|
||||
? (xform.GridUid.Value, grid.TileIndicesFor(xform.Coordinates))
|
||||
: (null, new Vector2i(0, 0));
|
||||
|
||||
DirtyNeighbours(uid, component);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
Vector2i pos;
|
||||
|
||||
if (transform.Anchored && _mapManager.TryGetGrid(transform.GridEntityId, out var grid))
|
||||
if (transform.Anchored && _mapManager.TryGetGrid(transform.GridUid, out var grid))
|
||||
{
|
||||
pos = grid.CoordinatesToTile(transform.Coordinates);
|
||||
}
|
||||
@@ -191,9 +191,9 @@ namespace Content.Client.IconSmoothing
|
||||
|
||||
if (xform.Anchored)
|
||||
{
|
||||
if (!_mapManager.TryGetGrid(xform.GridEntityId, out grid))
|
||||
if (!_mapManager.TryGetGrid(xform.GridUid, out grid))
|
||||
{
|
||||
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridEntityId} was missing.");
|
||||
Logger.Error($"Failed to calculate IconSmoothComponent sprite in {uid} because grid {xform.GridUid} was missing.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user