Enable nullability in Content.Client (#3257)

* Enable nullability in Content.Client

* Remove #nullable enable

* Merge fixes

* Remove Debug.Assert

* Merge fixes

* Fix build

* Fix build
This commit is contained in:
DrSmugleaf
2021-03-10 14:48:29 +01:00
committed by GitHub
parent 4f9bd4e802
commit 902aa128c2
270 changed files with 1774 additions and 1550 deletions

View File

@@ -28,9 +28,10 @@ namespace Content.Client.GameObjects.Components
public CornerFill LastCornerSW { get; private set; }
public CornerFill LastCornerNW { get; private set; }
[ViewVariables] private IEntity? _overlayEntity;
[ViewVariables]
private IEntity _overlayEntity;
private ISpriteComponent _overlaySprite;
private ISpriteComponent? _overlaySprite;
protected override void Startup()
{
@@ -57,13 +58,18 @@ namespace Content.Client.GameObjects.Components
{
base.Shutdown();
_overlayEntity.Delete();
_overlayEntity?.Delete();
}
internal override void CalculateNewSprite()
{
base.CalculateNewSprite();
if (Sprite == null || SnapGrid == null || _overlaySprite == null)
{
return;
}
var (n, nl) = MatchingWall(SnapGrid.GetInDir(Direction.North));
var (ne, nel) = MatchingWall(SnapGrid.GetInDir(Direction.NorthEast));
var (e, el) = MatchingWall(SnapGrid.GetInDir(Direction.East));
@@ -190,7 +196,7 @@ namespace Content.Client.GameObjects.Components
foreach (var entity in SnapGrid.GetLocal())
{
if (entity.TryGetComponent(out WindowComponent window))
if (entity.TryGetComponent(out WindowComponent? window))
{
window.UpdateSprite();
}
@@ -202,7 +208,7 @@ namespace Content.Client.GameObjects.Components
{
foreach (var entity in candidates)
{
if (!entity.TryGetComponent(out IconSmoothComponent other))
if (!entity.TryGetComponent(out IconSmoothComponent? other))
{
continue;
}