mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-06-09 10:06:43 +02:00
d42adbf05d
* 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.
103 lines
3.6 KiB
C#
103 lines
3.6 KiB
C#
using Content.IntegrationTests.Fixtures;
|
|
using Content.Server.Power.Components;
|
|
using Content.Shared.Gravity;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Map.Components;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
/// Tests the behavior of GravityGeneratorComponent,
|
|
/// making sure that gravity is applied to the correct grids.
|
|
[TestFixture]
|
|
[TestOf(typeof(GravityGeneratorComponent))]
|
|
public sealed class GravityGridTest : GameTest
|
|
{
|
|
[TestPrototypes]
|
|
private const string Prototypes = @"
|
|
- type: entity
|
|
name: GridGravityGeneratorDummy
|
|
id: GridGravityGeneratorDummy
|
|
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
|
|
- type: UserInterface
|
|
";
|
|
[Test]
|
|
public async Task Test()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
|
|
var testMap = await pair.CreateTestMap();
|
|
|
|
var entityMan = server.EntMan;
|
|
var mapMan = server.MapMan;
|
|
var mapSys = entityMan.System<SharedMapSystem>();
|
|
|
|
EntityUid generator = default;
|
|
Entity<MapGridComponent> grid1 = default;
|
|
Entity<MapGridComponent> grid2 = default;
|
|
|
|
// Create grids
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var mapId = testMap.MapId;
|
|
grid1 = mapMan.CreateGridEntity(mapId);
|
|
grid2 = mapMan.CreateGridEntity(mapId);
|
|
|
|
mapSys.SetTile(grid1, grid1, Vector2i.Zero, new Tile(1));
|
|
mapSys.SetTile(grid2, grid2, Vector2i.Zero, new Tile(1));
|
|
|
|
generator = entityMan.SpawnEntity("GridGravityGeneratorDummy", new EntityCoordinates(grid1, 0.5f, 0.5f));
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(entityMan.HasComponent<GravityGeneratorComponent>(generator));
|
|
Assert.That(entityMan.HasComponent<ApcPowerReceiverComponent>(generator));
|
|
});
|
|
|
|
var powerComponent = entityMan.GetComponent<ApcPowerReceiverComponent>(generator);
|
|
powerComponent.NeedsPower = false;
|
|
});
|
|
|
|
await server.WaitRunTicks(5);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var generatorComponent = entityMan.GetComponent<GravityGeneratorComponent>(generator);
|
|
var powerComponent = entityMan.GetComponent<ApcPowerReceiverComponent>(generator);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(generatorComponent.GravityActive, Is.True);
|
|
Assert.That(!entityMan.GetComponent<GravityComponent>(grid1).Enabled);
|
|
Assert.That(entityMan.GetComponent<GravityComponent>(grid2).Enabled);
|
|
});
|
|
|
|
// Re-enable needs power so it turns off again.
|
|
// Charge rate is ridiculously high so it finishes in one tick.
|
|
powerComponent.NeedsPower = true;
|
|
});
|
|
|
|
await server.WaitRunTicks(5);
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var generatorComponent = entityMan.GetComponent<GravityGeneratorComponent>(generator);
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(generatorComponent.GravityActive, Is.False);
|
|
Assert.That(entityMan.GetComponent<GravityComponent>(grid2).Enabled, Is.False);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|