More nullable component fixes (#8659)
This commit is contained in:
committed by
GitHub
parent
8e615c743a
commit
cb4d5f3e59
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)}");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}");
|
||||
|
||||
Reference in New Issue
Block a user