Add interaction tests (#15251)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.Damage.Prototypes;
|
||||
using Content.Shared.FixedPoint;
|
||||
using NUnit.Framework;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
public sealed class WindowRepair : InteractionTest
|
||||
{
|
||||
[Test]
|
||||
public async Task RepairReinforcedWindow()
|
||||
{
|
||||
await SpawnTarget("ReinforcedWindow");
|
||||
|
||||
// Damage the entity.
|
||||
var sys = SEntMan.System<DamageableSystem>();
|
||||
var comp = Comp<DamageableComponent>();
|
||||
var damageType = Server.ResolveDependency<IPrototypeManager>().Index<DamageTypePrototype>("Blunt");
|
||||
var damage = new DamageSpecifier(damageType, FixedPoint2.New(10));
|
||||
Assert.That(comp.Damage.Total, Is.EqualTo(FixedPoint2.Zero));
|
||||
await Server.WaitPost(() => sys.TryChangeDamage(Target, damage, ignoreResistances: true));
|
||||
await RunTicks(5);
|
||||
Assert.That(comp.Damage.Total, Is.GreaterThan(FixedPoint2.Zero));
|
||||
|
||||
// Repair the entity
|
||||
await Interact(Weld);
|
||||
Assert.That(comp.Damage.Total, Is.EqualTo(FixedPoint2.Zero));
|
||||
|
||||
// Validate that we can still deconstruct the entity (i.e., that welding deconstruction is not blocked).
|
||||
await Interact(
|
||||
Weld,
|
||||
Screw,
|
||||
Pry,
|
||||
Weld,
|
||||
Screw,
|
||||
Wrench);
|
||||
AssertDeleted();
|
||||
await AssertEntityLookup((RGlass, 2));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user