Nullability fixes.

This commit is contained in:
Pieter-Jan Briers
2020-08-20 16:48:00 +02:00
parent 3372ab050c
commit ed1a96e536
47 changed files with 159 additions and 158 deletions

View File

@@ -33,7 +33,7 @@ namespace Content.Client.GameObjects.Components.Body
public override void HandleNetworkMessage(ComponentMessage message, INetChannel netChannel, ICommonSession? session = null)
{
if (!Owner.TryGetComponent(out ISpriteComponent sprite))
if (!Owner.TryGetComponent(out ISpriteComponent? sprite))
{
return;
}
@@ -50,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Body
if (!partRemoved.Dropped.HasValue ||
!_entityManager.TryGetEntity(partRemoved.Dropped.Value, out var entity) ||
!entity.TryGetComponent(out ISpriteComponent droppedSprite))
!entity.TryGetComponent(out ISpriteComponent? droppedSprite))
{
break;
}

View File

@@ -37,7 +37,7 @@ namespace Content.Client.GameObjects.Components
/// <returns>True if the click worked, false otherwise.</returns>
public bool CheckClick(Vector2 worldPos, out int drawDepth, out uint renderOrder)
{
if (!Owner.TryGetComponent(out ISpriteComponent sprite) || !sprite.Visible)
if (!Owner.TryGetComponent(out ISpriteComponent? sprite) || !sprite.Visible)
{
drawDepth = default;
renderOrder = default;

View File

@@ -148,7 +148,7 @@ namespace Content.Client.GameObjects.Components.Items
return;
}
if (!entity.TryGetComponent(out ItemComponent item)) return;
if (!entity.TryGetComponent(out ItemComponent? item)) return;
var maybeInHands = item.GetInHandStateInfo(hand.Location);

View File

@@ -34,7 +34,7 @@ namespace Content.Client.GameObjects.Components.Mobs
WalkModifierOverride = state.WalkModifierOverride;
RunModifierOverride = state.RunModifierOverride;
if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement))
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
{
movement.RefreshMovementSpeedModifiers();
}

View File

@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Nutrition
_currentHungerThreshold = hunger.CurrentThreshold;
if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement))
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
{
movement.RefreshMovementSpeedModifiers();
}

View File

@@ -20,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Nutrition
_currentThirstThreshold = thirst.CurrentThreshold;
if (Owner.TryGetComponent(out MovementSpeedModifierComponent movement))
if (Owner.TryGetComponent(out MovementSpeedModifierComponent? movement))
{
movement.RefreshMovementSpeedModifiers();
}