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.
94 lines
3.2 KiB
C#
94 lines
3.2 KiB
C#
using Content.IntegrationTests.Fixtures;
|
|
using Content.Server.Stunnable;
|
|
using Content.Shared.Inventory;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Map;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
[TestFixture]
|
|
public sealed class InventoryHelpersTest : GameTest
|
|
{
|
|
[TestPrototypes]
|
|
private const string Prototypes = @"
|
|
- type: entity
|
|
name: InventoryStunnableDummy
|
|
id: InventoryStunnableDummy
|
|
components:
|
|
- type: Inventory
|
|
- type: ContainerContainer
|
|
- type: MobState
|
|
|
|
- type: entity
|
|
name: InventoryJumpsuitJanitorDummy
|
|
id: InventoryJumpsuitJanitorDummy
|
|
components:
|
|
- type: Clothing
|
|
slots: [innerclothing]
|
|
|
|
- type: entity
|
|
name: InventoryIDCardDummy
|
|
id: InventoryIDCardDummy
|
|
components:
|
|
- type: Clothing
|
|
QuickEquip: false
|
|
slots:
|
|
- idcard
|
|
- type: Pda
|
|
";
|
|
[Test]
|
|
public async Task SpawnItemInSlotTest()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
|
|
var sEntities = server.ResolveDependency<IEntityManager>();
|
|
var systemMan = sEntities.EntitySysManager;
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var human = sEntities.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
|
var invSystem = systemMan.GetEntitySystem<InventorySystem>();
|
|
|
|
Assert.Multiple(() =>
|
|
{
|
|
// Can't do the test if this human doesn't have the slots for it.
|
|
Assert.That(invSystem.HasSlot(human, "jumpsuit"));
|
|
Assert.That(invSystem.HasSlot(human, "id"));
|
|
});
|
|
|
|
Assert.That(invSystem.SpawnItemInSlot(human, "jumpsuit", "InventoryJumpsuitJanitorDummy", true));
|
|
|
|
#pragma warning disable NUnit2045
|
|
// Do we actually have the uniform equipped?
|
|
Assert.That(invSystem.TryGetSlotEntity(human, "jumpsuit", out var uniform));
|
|
Assert.That(sEntities.GetComponent<MetaDataComponent>(uniform.Value).EntityPrototype is
|
|
{
|
|
ID: "InventoryJumpsuitJanitorDummy"
|
|
});
|
|
#pragma warning restore NUnit2045
|
|
|
|
systemMan.GetEntitySystem<StunSystem>().TryUpdateStunDuration(human, TimeSpan.FromSeconds(1f));
|
|
|
|
#pragma warning disable NUnit2045
|
|
// Since the mob is stunned, they can't equip this.
|
|
Assert.That(invSystem.SpawnItemInSlot(human, "id", "InventoryIDCardDummy", true), Is.False);
|
|
|
|
// Make sure we don't have the ID card equipped.
|
|
Assert.That(invSystem.TryGetSlotEntity(human, "item", out _), Is.False);
|
|
|
|
// Let's try skipping the interaction check and see if it equips it!
|
|
Assert.That(invSystem.SpawnItemInSlot(human, "id", "InventoryIDCardDummy", true, true));
|
|
Assert.That(invSystem.TryGetSlotEntity(human, "id", out var idUid));
|
|
Assert.That(sEntities.GetComponent<MetaDataComponent>(idUid.Value).EntityPrototype is
|
|
{
|
|
ID: "InventoryIDCardDummy"
|
|
});
|
|
#pragma warning restore NUnit2045
|
|
sEntities.DeleteEntity(human);
|
|
});
|
|
}
|
|
}
|
|
}
|