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

@@ -101,13 +101,13 @@ namespace Content.Server.GameObjects.Components.Items.Storage
{
EnsureInitialCalculated();
if (entity.TryGetComponent(out ServerStorageComponent storage) &&
if (entity.TryGetComponent(out ServerStorageComponent? storage) &&
storage._storageCapacityMax >= _storageCapacityMax)
{
return false;
}
if (entity.TryGetComponent(out StorableComponent store) &&
if (entity.TryGetComponent(out StorableComponent? store) &&
store.ObjectSize > _storageCapacityMax - _storageUsed)
{
return false;
@@ -164,7 +164,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
Logger.DebugS(LoggerName, $"Storage (UID {Owner.Uid}) had entity (UID {message.Entity.Uid}) removed from it.");
if (!message.Entity.TryGetComponent(out StorableComponent storable))
if (!message.Entity.TryGetComponent(out StorableComponent? storable))
{
Logger.WarningS(LoggerName, $"Removed entity {message.Entity.Uid} without a StorableComponent from storage {Owner.Uid} at {Owner.Transform.MapPosition}");
@@ -186,7 +186,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
{
EnsureInitialCalculated();
if (!player.TryGetComponent(out IHandsComponent hands) ||
if (!player.TryGetComponent(out IHandsComponent? hands) ||
hands.GetActiveHand == null)
{
return false;
@@ -317,7 +317,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
private void UpdateDoorState()
{
if (Owner.TryGetComponent(out AppearanceComponent appearance))
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
{
appearance.SetData(StorageVisuals.Open, SubscribedSessions.Count != 0);
}
@@ -382,7 +382,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
var item = entity.GetComponent<ItemComponent>();
if (item == null ||
!player.TryGetComponent(out HandsComponent hands))
!player.TryGetComponent(out HandsComponent? hands))
{
break;
}
@@ -506,7 +506,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
bool IDragDrop.CanDragDrop(DragDropEventArgs eventArgs)
{
return eventArgs.Target.TryGetComponent(out PlaceableSurfaceComponent placeable) &&
return eventArgs.Target.TryGetComponent(out PlaceableSurfaceComponent? placeable) &&
placeable.IsPlaceable;
}