Nullable grid Uid (#8798)

This commit is contained in:
Leon Friedrich
2022-06-20 12:14:35 +12:00
committed by GitHub
parent ef41cd5aa8
commit fa4c6f63f8
82 changed files with 318 additions and 242 deletions

View File

@@ -294,7 +294,7 @@ namespace Content.Client.AI
private void DrawCachedRegions(DrawingHandleScreen screenHandle, Box2 viewport)
{
var transform = _entities.GetComponentOrNull<TransformComponent>(_playerManager.LocalPlayer?.ControlledEntity);
if (transform == null || !CachedRegions.TryGetValue(transform.GridEntityId, out var entityRegions))
if (transform == null || transform.GridUid == null || !CachedRegions.TryGetValue(transform.GridUid.Value, out var entityRegions))
{
return;
}
@@ -312,7 +312,7 @@ namespace Content.Client.AI
screenTile.X + 15.0f,
screenTile.Y + 15.0f);
screenHandle.DrawRect(box, _cachedRegionColors[transform.GridEntityId][region]);
screenHandle.DrawRect(box, _cachedRegionColors[transform.GridUid.Value][region]);
}
}
}
@@ -344,7 +344,8 @@ namespace Content.Client.AI
{
var attachedEntity = _playerManager.LocalPlayer?.ControlledEntity;
if (!_entities.TryGetComponent(attachedEntity, out TransformComponent? transform) ||
!Regions.TryGetValue(transform.GridEntityId, out var entityRegions))
transform.GridUid == null ||
!Regions.TryGetValue(transform.GridUid.Value, out var entityRegions))
{
return;
}
@@ -364,7 +365,7 @@ namespace Content.Client.AI
screenTile.X + 15.0f,
screenTile.Y + 15.0f);
screenHandle.DrawRect(box, _regionColors[_entities.GetComponent<TransformComponent>(attachedEntity.Value).GridEntityId][chunk][region]);
screenHandle.DrawRect(box, _regionColors[transform.GridUid.Value][chunk][region]);
}
}
}