Nullability fixes.
This commit is contained in:
@@ -41,7 +41,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entity.TryGetComponent(out IDisposalTubeComponent tube))
|
||||
if (!entity.TryGetComponent(out IDisposalTubeComponent? tube))
|
||||
{
|
||||
shell.SendText(player, Loc.GetString("Entity with uid {0} doesn't have a {1} component", id, nameof(IDisposalTubeComponent)));
|
||||
return;
|
||||
|
||||
@@ -56,7 +56,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;
|
||||
@@ -73,7 +73,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity.TryGetComponent(out ICollidableComponent collidable))
|
||||
if (entity.TryGetComponent(out ICollidableComponent? collidable))
|
||||
{
|
||||
collidable.CanCollide = false;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
foreach (var entity in _contents.ContainedEntities.ToArray())
|
||||
{
|
||||
if (entity.TryGetComponent(out ICollidableComponent collidable))
|
||||
if (entity.TryGetComponent(out ICollidableComponent? collidable))
|
||||
{
|
||||
collidable.CanCollide = true;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
[ViewVariables]
|
||||
private bool Anchored =>
|
||||
!Owner.TryGetComponent(out CollidableComponent collidable) ||
|
||||
!Owner.TryGetComponent(out CollidableComponent? collidable) ||
|
||||
collidable.Anchored;
|
||||
|
||||
/// <summary>
|
||||
@@ -71,7 +71,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
var snapGrid = Owner.GetComponent<SnapGridComponent>();
|
||||
var tube = snapGrid
|
||||
.GetInDir(nextDirection)
|
||||
.Select(x => x.TryGetComponent(out IDisposalTubeComponent c) ? c : null)
|
||||
.Select(x => x.TryGetComponent(out IDisposalTubeComponent? c) ? c : null)
|
||||
.FirstOrDefault(x => x != null && x != this);
|
||||
|
||||
if (tube == null)
|
||||
@@ -153,7 +153,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
foreach (var entity in Contents.ContainedEntities.ToArray())
|
||||
{
|
||||
if (!entity.TryGetComponent(out DisposalHolderComponent holder))
|
||||
if (!entity.TryGetComponent(out DisposalHolderComponent? holder))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
private void UpdateVisualState()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out AppearanceComponent appearance))
|
||||
if (!Owner.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
private void AnchoredChanged()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out CollidableComponent collidable))
|
||||
if (!Owner.TryGetComponent(out CollidableComponent? collidable))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user