-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* partial buckling refactor * git mv test * change test namespace * git mv test * Update test namespace * Add pulling test * Network BuckleTime * Add two more tests * smelly
- Loading branch information
Showing
35 changed files
with
993 additions
and
833 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using Content.IntegrationTests.Tests.Interaction; | ||
using Content.Shared.Buckle; | ||
using Content.Shared.Buckle.Components; | ||
using Content.Shared.Input; | ||
using Content.Shared.Movement.Pulling.Components; | ||
|
||
namespace Content.IntegrationTests.Tests.Buckle; | ||
|
||
public sealed class BuckleDragTest : InteractionTest | ||
{ | ||
// Check that dragging a buckled player unbuckles them. | ||
[Test] | ||
public async Task BucklePullTest() | ||
{ | ||
var urist = await SpawnTarget("MobHuman"); | ||
var sUrist = ToServer(urist); | ||
await SpawnTarget("Chair"); | ||
|
||
var buckle = Comp<BuckleComponent>(urist); | ||
var strap = Comp<StrapComponent>(Target); | ||
var puller = Comp<PullerComponent>(Player); | ||
var pullable = Comp<PullableComponent>(urist); | ||
|
||
#pragma warning disable RA0002 | ||
buckle.Delay = TimeSpan.Zero; | ||
#pragma warning restore RA0002 | ||
|
||
// Initially not buckled to the chair and not pulling anything | ||
Assert.That(buckle.Buckled, Is.False); | ||
Assert.That(buckle.BuckledTo, Is.Null); | ||
Assert.That(strap.BuckledEntities, Is.Empty); | ||
Assert.That(puller.Pulling, Is.Null); | ||
Assert.That(pullable.Puller, Is.Null); | ||
Assert.That(pullable.BeingPulled, Is.False); | ||
|
||
// Strap the human to the chair | ||
Assert.That(Server.System<SharedBuckleSystem>().TryBuckle(sUrist, SPlayer, STarget.Value)); | ||
await RunTicks(5); | ||
Assert.That(buckle.Buckled, Is.True); | ||
Assert.That(buckle.BuckledTo, Is.EqualTo(STarget)); | ||
Assert.That(strap.BuckledEntities, Is.EquivalentTo(new[]{sUrist})); | ||
Assert.That(puller.Pulling, Is.Null); | ||
Assert.That(pullable.Puller, Is.Null); | ||
Assert.That(pullable.BeingPulled, Is.False); | ||
|
||
// Start pulling, and thus unbuckle them | ||
await PressKey(ContentKeyFunctions.TryPullObject, cursorEntity:urist); | ||
await RunTicks(5); | ||
Assert.That(buckle.Buckled, Is.False); | ||
Assert.That(buckle.BuckledTo, Is.Null); | ||
Assert.That(strap.BuckledEntities, Is.Empty); | ||
Assert.That(puller.Pulling, Is.EqualTo(sUrist)); | ||
Assert.That(pullable.Puller, Is.EqualTo(SPlayer)); | ||
Assert.That(pullable.BeingPulled, Is.True); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.