Files
space-station-14/Content.IntegrationTests/Tests/Gravity/WeightlessStatusTests.cs
T
Moony d42adbf05d Gametest Part 2: Preliminary refactor every test to use GameTest as the framework. (#43207)
* Pass 1.

* i'm FREE

* Prevent hangups.

* okay fine here's an attribute for settings, will polish later and prolly remove the overridable thing.

* sigh.

* fix singular trigger bug so LatheTest doesn't flake.

* Remove SystemAttribute usage.

* Poke

* I used the shotgun. You know why? Cause the shot gun doesn’t miss, and unlike the shitty hybrid taser it stops a criminal in their tracks in two hits. Bang, bang, and they’re fucking done. I use four shots just to make damn sure. Because, once again, I’m not there to coddle a buncha criminal scum sucking f------, I’m there to 1) Survive the fucking round. 2) Guard the armory. So you can absolutely get fucked. If I get unbanned, which I won’t, you can guarantee I will continue to use the shotgun to apprehend criminals. Because it’s quick, clean and effective as fuck. Why in the seven hells would I fuck around with the disabler shots, which take half a clip just to bring someone down, or with the tazer bolts which are slow as balls, impossible to aim and do about next to jack shit, fuck all. The shotgun is the superior law enforcement weapon. Because it stops crime. And it stops crime by reducing the number of criminals roaming the fucking halls.

* Change the faulty store test into two tests, one of which is ignored for failing.
2026-04-01 16:06:26 +00:00

93 lines
2.9 KiB
C#

using Content.IntegrationTests.Fixtures;
using Content.Server.Gravity;
using Content.Shared.Alert;
using Content.Shared.Gravity;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Gravity
{
[TestFixture]
[TestOf(typeof(GravitySystem))]
[TestOf(typeof(GravityGeneratorComponent))]
public sealed class WeightlessStatusTests : GameTest
{
[TestPrototypes]
private const string Prototypes = @"
- type: entity
name: HumanWeightlessDummy
id: HumanWeightlessDummy
components:
- type: Alerts
- type: Physics
bodyType: Dynamic
- type: GravityAffected
- type: entity
name: WeightlessGravityGeneratorDummy
id: WeightlessGravityGeneratorDummy
components:
- type: GravityGenerator
- type: PowerCharge
windowTitle: gravity-generator-window-title
idlePower: 50
chargeRate: 1000000000 # Set this really high so it discharges in a single tick.
activePower: 500
- type: ApcPowerReceiver
needsPower: false
- type: UserInterface
";
[Test]
public async Task WeightlessStatusTest()
{
var pair = Pair;
var server = pair.Server;
var entityManager = server.ResolveDependency<IEntityManager>();
var alertsSystem = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<AlertsSystem>();
var weightlessAlert = SharedGravitySystem.WeightlessAlert;
EntityUid human = default;
var testMap = await pair.CreateTestMap();
await server.WaitAssertion(() =>
{
human = entityManager.SpawnEntity("HumanWeightlessDummy", testMap.GridCoords);
Assert.That(entityManager.TryGetComponent(human, out AlertsComponent alerts));
});
// Let WeightlessSystem and GravitySystem tick
await pair.RunTicksSync(10);
var generatorUid = EntityUid.Invalid;
await server.WaitAssertion(() =>
{
// No gravity without a gravity generator
Assert.That(alertsSystem.IsShowingAlert(human, weightlessAlert));
generatorUid = entityManager.SpawnEntity("WeightlessGravityGeneratorDummy", entityManager.GetComponent<TransformComponent>(human).Coordinates);
});
// Let WeightlessSystem and GravitySystem tick
await pair.RunTicksSync(10);
await server.WaitAssertion(() =>
{
Assert.That(alertsSystem.IsShowingAlert(human, weightlessAlert), Is.False);
// This should kill gravity
entityManager.DeleteEntity(generatorUid);
});
await pair.RunTicksSync(10);
await server.WaitAssertion(() =>
{
Assert.That(alertsSystem.IsShowingAlert(human, weightlessAlert));
});
await pair.RunTicksSync(10);
}
}
}