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

@@ -86,12 +86,12 @@ namespace Content.Server.GameObjects.Components.Disposal
[ViewVariables]
public bool Powered =>
!Owner.TryGetComponent(out PowerReceiverComponent receiver) ||
!Owner.TryGetComponent(out PowerReceiverComponent? receiver) ||
receiver.Powered;
[ViewVariables]
public bool Anchored =>
!Owner.TryGetComponent(out CollidableComponent collidable) ||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
collidable.Anchored;
[ViewVariables]
@@ -122,7 +122,7 @@ namespace Content.Server.GameObjects.Components.Disposal
return false;
}
if (!entity.TryGetComponent(out ICollidableComponent collidable) ||
if (!entity.TryGetComponent(out ICollidableComponent? collidable) ||
!collidable.CanCollide)
{
return false;
@@ -159,7 +159,7 @@ namespace Content.Server.GameObjects.Components.Disposal
{
TryQueueEngage();
if (entity.TryGetComponent(out IActorComponent actor))
if (entity.TryGetComponent(out IActorComponent? actor))
{
_userInterface.Close(actor.playerSession);
}
@@ -181,7 +181,7 @@ namespace Content.Server.GameObjects.Components.Disposal
private bool TryDrop(IEntity user, IEntity entity)
{
if (!user.TryGetComponent(out HandsComponent hands))
if (!user.TryGetComponent(out HandsComponent? hands))
{
return false;
}
@@ -273,7 +273,7 @@ namespace Content.Server.GameObjects.Components.Disposal
private void TogglePower()
{
if (!Owner.TryGetComponent(out PowerReceiverComponent receiver))
if (!Owner.TryGetComponent(out PowerReceiverComponent? receiver))
{
return;
}
@@ -352,7 +352,7 @@ namespace Content.Server.GameObjects.Components.Disposal
private void UpdateVisualState(bool flush)
{
if (!Owner.TryGetComponent(out AppearanceComponent appearance))
if (!Owner.TryGetComponent(out AppearanceComponent? appearance))
{
return;
}
@@ -488,7 +488,7 @@ namespace Content.Server.GameObjects.Components.Disposal
var collidable = Owner.EnsureComponent<CollidableComponent>();
collidable.AnchoredChanged += UpdateVisualState;
if (Owner.TryGetComponent(out PowerReceiverComponent receiver))
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
{
receiver.OnPowerStateChanged += PowerStateChanged;
}
@@ -498,12 +498,12 @@ namespace Content.Server.GameObjects.Components.Disposal
public override void OnRemove()
{
if (Owner.TryGetComponent(out ICollidableComponent collidable))
if (Owner.TryGetComponent(out ICollidableComponent? collidable))
{
collidable.AnchoredChanged -= UpdateVisualState;
}
if (Owner.TryGetComponent(out PowerReceiverComponent receiver))
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
{
receiver.OnPowerStateChanged -= PowerStateChanged;
}
@@ -530,7 +530,7 @@ namespace Content.Server.GameObjects.Components.Disposal
switch (message)
{
case RelayMovementEntityMessage msg:
if (!msg.Entity.TryGetComponent(out HandsComponent hands) ||
if (!msg.Entity.TryGetComponent(out HandsComponent? hands) ||
hands.Count == 0 ||
_gameTiming.CurTime < _lastExitAttempt + ExitAttemptDelay)
{
@@ -559,7 +559,7 @@ namespace Content.Server.GameObjects.Components.Disposal
return false;
}
if (!eventArgs.User.TryGetComponent(out IActorComponent actor))
if (!eventArgs.User.TryGetComponent(out IActorComponent? actor))
{
return false;
}