PullerTest.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Content.Shared.Hands.Components;
  2. using Content.Shared.Movement.Pulling.Components;
  3. using Content.Shared.Prototypes;
  4. using Robust.Shared.GameObjects;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.IntegrationTests.Tests.Puller;
  7. #nullable enable
  8. [TestFixture]
  9. public sealed class PullerTest
  10. {
  11. /// <summary>
  12. /// Checks that needsHands on PullerComponent is not set on mobs that don't even have hands.
  13. /// </summary>
  14. [Test]
  15. public async Task PullerSanityTest()
  16. {
  17. await using var pair = await PoolManager.GetServerClient();
  18. var server = pair.Server;
  19. var compFactory = server.ResolveDependency<IComponentFactory>();
  20. var protoManager = server.ResolveDependency<IPrototypeManager>();
  21. await server.WaitAssertion(() =>
  22. {
  23. Assert.Multiple(() =>
  24. {
  25. foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
  26. {
  27. if (!proto.TryGetComponent(out PullerComponent? puller, compFactory))
  28. continue;
  29. if (!puller.NeedsHands)
  30. continue;
  31. Assert.That(proto.HasComponent<HandsComponent>(compFactory), $"Found puller {proto} with NeedsHand pulling but has no hands?");
  32. }
  33. });
  34. });
  35. await pair.CleanReturnAsync();
  36. }
  37. }