* Defibs will now also shock anyone still interacting with the target. * Improvements to test readability * Apply fixes to other tests * Refactor the interacting entities query to use an event. * Include pullers as interacting with the entity they are pulling * Broadcast event * Use a constant * Convert new test to InteractionTest * Convert existing test * Add behaviour note * Revert "Convert existing test" This reverts commit b8a8f2f68e3733bdb6ec254faf955a42096d47d7. * Move new test into separate (InteractionTest) test file * Use ToServer * Use a constant for prototype id * Use ToServer * Add EntProtoId constructor * Add assertion failure messages * Manual cleanup of test entities * Remove obsolete flag * Add test summaries * Remove tuple constructor * Wrap entity deletion in WaitPost * Extend DoAfter interacting test with an extra mob
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using Content.IntegrationTests.Tests.Interaction;
|
|
using Content.Shared.Interaction;
|
|
using Content.Shared.Movement.Pulling.Systems;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.IntegrationTests.Tests.Puller;
|
|
|
|
#nullable enable
|
|
|
|
public sealed class InteractingEntitiesTest : InteractionTest
|
|
{
|
|
private static readonly EntProtoId MobHuman = "MobHuman";
|
|
|
|
/// <summary>
|
|
/// Spawns a Target mob, and a second mob which drags it,
|
|
/// and checks that the dragger is considered to be interacting with the dragged mob.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task PullerIsConsideredInteractingTest()
|
|
{
|
|
await SpawnTarget(MobHuman);
|
|
var puller = await SpawnEntity(MobHuman, ToServer(TargetCoords));
|
|
|
|
var pullSys = SEntMan.System<PullingSystem>();
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
Assert.That(pullSys.TryStartPull(puller, ToServer(Target.Value)),
|
|
$"{puller} failed to start pulling {Target}");
|
|
});
|
|
|
|
var list = new HashSet<EntityUid>();
|
|
Server.System<SharedInteractionSystem>()
|
|
.GetEntitiesInteractingWithTarget(ToServer(Target.Value), list);
|
|
Assert.That(list, Is.EquivalentTo([puller]), $"{puller} was not considered to be interacting with {Target}");
|
|
}
|
|
}
|