More nullable component fixes (#8659)

This commit is contained in:
Pieter-Jan Briers
2022-06-05 05:22:26 +02:00
committed by GitHub
parent 8e615c743a
commit cb4d5f3e59
4 changed files with 5 additions and 5 deletions

View File

@@ -21,7 +21,7 @@ public sealed class FluidSpill : ContentIntegrationTest
{
foreach (var uid in mapGrid.GetAnchoredEntities(pos))
{
if (entityManager.TryGetComponent(uid, out PuddleComponent puddleComponent))
if (entityManager.TryGetComponent(uid, out PuddleComponent? puddleComponent))
return puddleComponent;
}

View File

@@ -66,8 +66,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
entityManager.GetComponent<TransformComponent>(human).WorldPosition = entityManager.GetComponent<TransformComponent>(otherHuman).WorldPosition;
// Test for components existing
Assert.True(entityManager.TryGetComponent(human, out cuffed), $"Human has no {nameof(CuffableComponent)}");
Assert.True(entityManager.TryGetComponent(human, out hands), $"Human has no {nameof(HandsComponent)}");
Assert.True(entityManager.TryGetComponent(human, out cuffed!), $"Human has no {nameof(CuffableComponent)}");
Assert.True(entityManager.TryGetComponent(human, out hands!), $"Human has no {nameof(HandsComponent)}");
Assert.True(entityManager.TryGetComponent(human, out SharedBodyComponent? _), $"Human has no {nameof(SharedBodyComponent)}");
Assert.True(entityManager.TryGetComponent(cuffs, out HandcuffComponent? _), $"Handcuff has no {nameof(HandcuffComponent)}");
Assert.True(entityManager.TryGetComponent(secondCuffs, out HandcuffComponent? _), $"Second handcuffs has no {nameof(HandcuffComponent)}");

View File

@@ -55,7 +55,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.Movement
// Test for climb components existing
// Players and tables should have these in their prototypes.
Assert.That(entityManager.TryGetComponent(human, out climbing), "Human has no climbing");
Assert.That(entityManager.TryGetComponent(human, out climbing!), "Human has no climbing");
Assert.That(entityManager.TryGetComponent(table, out ClimbableComponent? _), "Table has no climbable");
// TODO ShadowCommander: Implement climbing test

View File

@@ -83,7 +83,7 @@ namespace Content.MapRenderer.Painters
continue;
}
if (!_cEntityManager.TryGetComponent(entity, out SpriteComponent sprite))
if (!_cEntityManager.TryGetComponent(entity, out SpriteComponent? sprite))
{
throw new InvalidOperationException(
$"No sprite component found on an entity for which a server sprite component exists. Prototype id: {prototype.ID}");