CatStation/Content.IntegrationTests/Tests/Movement/SlippingTest.cs
DrSmugleaf 65f5f67cd5
Make every EntitySystem partial (#45220)
* Make every EntitySystem partial

* Oobs thats for a diff PR

* Also oops on that one

* Test systems

* git are we fr

* Update file templates

* cleanup empty classes while we are here

* forgor

---------

Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
2026-08-14 18:24:47 +00:00

42 lines
1.5 KiB
C#

#nullable enable
using Content.IntegrationTests.Tests.Helpers;
using Content.Shared.Movement.Components;
using Content.Shared.Slippery;
using Content.Shared.Stunnable;
using Robust.Shared.Input;
using Robust.Shared.Maths;
namespace Content.IntegrationTests.Tests.Movement;
public sealed class SlippingTest : MovementTest
{
public sealed partial class SlipTestSystem : TestListenerSystem<SlipEvent>;
[Test]
public async Task BananaSlipTest()
{
await SpawnTarget("TrashBananaPeel");
var modifier = Comp<MovementSpeedModifierComponent>(Player).SprintSpeedModifier;
Assert.That(modifier, Is.EqualTo(1), "Player is not moving at full speed.");
// Player is to the left of the banana peel.
Assert.That(Delta(), Is.GreaterThan(0.5f));
// Walking over the banana slowly does not trigger a slip.
await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Down);
await AssertFiresEvent<SlipEvent>(async () => await Move(DirectionFlag.East, 1f), count: 0);
Assert.That(Delta(), Is.LessThan(0.5f));
AssertComp<KnockedDownComponent>(false, Player);
// Moving at normal speeds does trigger a slip.
await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Up);
await AssertFiresEvent<SlipEvent>(async () => await Move(DirectionFlag.West, 1f));
// And the person that slipped was the player
AssertEvent<SlipEvent>(predicate: @event => @event.Slipped == SPlayer);
AssertComp<KnockedDownComponent>(true, Player);
}
}