1
0

WindowRepair.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.IntegrationTests.Tests.Interaction;
  2. using Content.Shared.Damage;
  3. using Content.Shared.Damage.Prototypes;
  4. using Content.Shared.FixedPoint;
  5. using Robust.Shared.Prototypes;
  6. namespace Content.IntegrationTests.Tests.Construction.Interaction;
  7. public sealed class WindowRepair : InteractionTest
  8. {
  9. [Test]
  10. public async Task RepairReinforcedWindow()
  11. {
  12. await SpawnTarget("ReinforcedWindow");
  13. // Damage the entity.
  14. var sys = SEntMan.System<DamageableSystem>();
  15. var comp = Comp<DamageableComponent>();
  16. var damageType = Server.ResolveDependency<IPrototypeManager>().Index<DamageTypePrototype>("Blunt");
  17. var damage = new DamageSpecifier(damageType, FixedPoint2.New(10));
  18. Assert.That(comp.Damage.GetTotal(), Is.EqualTo(FixedPoint2.Zero));
  19. await Server.WaitPost(() => sys.TryChangeDamage(SEntMan.GetEntity(Target), damage, ignoreResistances: true));
  20. await RunTicks(5);
  21. Assert.That(comp.Damage.GetTotal(), Is.GreaterThan(FixedPoint2.Zero));
  22. // Repair the entity
  23. await InteractUsing(Weld);
  24. Assert.That(comp.Damage.GetTotal(), Is.EqualTo(FixedPoint2.Zero));
  25. // Validate that we can still deconstruct the entity (i.e., that welding deconstruction is not blocked).
  26. await Interact(
  27. Weld,
  28. Screw,
  29. Pry,
  30. Weld,
  31. Screw,
  32. Wrench);
  33. AssertDeleted();
  34. await AssertEntityLookup((RGlass, 2));
  35. }
  36. }