1
0

GrilleWindowConstruction.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using Content.IntegrationTests.Tests.Interaction;
  2. using Content.Shared.Construction.Prototypes;
  3. using Robust.Shared.Maths;
  4. namespace Content.IntegrationTests.Tests.Construction.Interaction;
  5. /// <summary>
  6. /// Check that we can build grilles on top of windows, but not the other way around.
  7. /// </summary>
  8. public sealed class GrilleWindowConstruction : InteractionTest
  9. {
  10. private const string Grille = "Grille";
  11. private const string Window = "Window";
  12. [Test]
  13. public async Task WindowOnGrille()
  14. {
  15. // Construct Grille
  16. await StartConstruction(Grille);
  17. await InteractUsing(Rod, 10);
  18. ClientAssertPrototype(Grille, Target);
  19. var grille = Target;
  20. // Construct Window
  21. await StartConstruction(Window);
  22. await InteractUsing(Glass, 10);
  23. ClientAssertPrototype(Window, Target);
  24. // Deconstruct Window
  25. await Interact(Screw, Wrench);
  26. AssertDeleted();
  27. // Deconstruct Grille
  28. Target = grille;
  29. await InteractUsing(Cut);
  30. AssertDeleted();
  31. }
  32. [Test]
  33. [TestCase(Grille, Grille)]
  34. [TestCase(Window, Grille)]
  35. [TestCase(Window, Window)]
  36. public async Task ConstructionBlocker(string first, string second)
  37. {
  38. // Spawn blocking entity
  39. await SpawnTarget(first);
  40. // Further construction attempts fail - blocked by first entity interaction.
  41. await Client.WaitPost(() =>
  42. {
  43. var proto = ProtoMan.Index<ConstructionPrototype>(second);
  44. Assert.That(CConSys.TrySpawnGhost(proto, CEntMan.GetCoordinates(TargetCoords), Direction.South, out _), Is.False);
  45. });
  46. }
  47. }