mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 16:47:26 +00:00
* 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.
95 lines
2.8 KiB
C#
95 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using Content.IntegrationTests.Fixtures;
|
|
using Content.Server.Station.Systems;
|
|
using Content.Shared.Inventory;
|
|
using Content.Shared.Preferences;
|
|
using Content.Shared.Preferences.Loadouts;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.IntegrationTests.Tests.Preferences;
|
|
|
|
[TestFixture]
|
|
public sealed class LoadoutTests : GameTest
|
|
{
|
|
[TestPrototypes]
|
|
private const string Prototypes = @"
|
|
- type: playTimeTracker
|
|
id: PlayTimeLoadoutTester
|
|
|
|
- type: loadout
|
|
id: TestJumpsuit
|
|
equipment:
|
|
jumpsuit: ClothingUniformJumpsuitColorGrey
|
|
|
|
- type: loadoutGroup
|
|
id: LoadoutTesterJumpsuit
|
|
name: generic-unknown
|
|
loadouts:
|
|
- TestJumpsuit
|
|
|
|
- type: roleLoadout
|
|
id: JobLoadoutTester
|
|
groups:
|
|
- LoadoutTesterJumpsuit
|
|
|
|
- type: job
|
|
id: LoadoutTester
|
|
playTimeTracker: PlayTimeLoadoutTester
|
|
";
|
|
|
|
private readonly Dictionary<string, EntProtoId> _expectedEquipment = new()
|
|
{
|
|
["jumpsuit"] = "ClothingUniformJumpsuitColorGrey"
|
|
};
|
|
|
|
public override PoolSettings PoolSettings => new()
|
|
{
|
|
Dirty = true,
|
|
};
|
|
|
|
/// <summary>
|
|
/// Checks that an empty loadout still spawns with default gear and not naked.
|
|
/// </summary>
|
|
[Test]
|
|
public async Task TestEmptyLoadout()
|
|
{
|
|
var pair = Pair;
|
|
var server = pair.Server;
|
|
|
|
var entManager = server.ResolveDependency<IEntityManager>();
|
|
|
|
// Check that an empty role loadout spawns gear
|
|
var stationSystem = entManager.System<StationSpawningSystem>();
|
|
var inventorySystem = entManager.System<InventorySystem>();
|
|
var testMap = await pair.CreateTestMap();
|
|
|
|
await server.WaitAssertion(() =>
|
|
{
|
|
var profile = new HumanoidCharacterProfile();
|
|
|
|
profile.SetLoadout(new RoleLoadout("LoadoutTester"));
|
|
|
|
var tester = stationSystem.SpawnPlayerMob(testMap.GridCoords, job: "LoadoutTester", profile, station: null);
|
|
|
|
var slotQuery = inventorySystem.GetSlotEnumerator(tester);
|
|
var checkedCount = 0;
|
|
while (slotQuery.NextItem(out var item, out var slot))
|
|
{
|
|
// Make sure the slot is valid
|
|
Assert.That(_expectedEquipment.TryGetValue(slot.Name, out var expectedItem), $"Spawned item in unexpected slot: {slot.Name}");
|
|
|
|
// Make sure that the item is the right one
|
|
var meta = entManager.GetComponent<MetaDataComponent>(item);
|
|
Assert.That(meta.EntityPrototype.ID, Is.EqualTo(expectedItem.Id), $"Spawned wrong item in slot {slot.Name}!");
|
|
|
|
checkedCount++;
|
|
}
|
|
// Make sure the number of items is the same
|
|
Assert.That(checkedCount, Is.EqualTo(_expectedEquipment.Count), "Number of items does not match expected!");
|
|
|
|
entManager.DeleteEntity(tester);
|
|
});
|
|
}
|
|
}
|