* Backpacks/Belts * Cleans up Headsets * Glasses and Gloves (Remind me to make an alpha for those stupid gloves) * This commit has taken too many of my damn tears please appreciate it * Holy SHIT that was an ordeal * NECK and MASKS * Jumpsuits/skirts * Goodbye old color.rsi * Outerclothing * More Outerclothing * It builds now * More ID organization :) * Gloves up to scratch * My piss burns * GLasses * Added some more glasses * Mission control we are ready for review * Hotfix * Cleanup * Fix not commenting out whole line in contents * duffelbag => duffel bag * Update Resources/Prototypes/Entities/Clothing/OuterClothing/hardsuits.yml Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Fixed Breath Mask * Scrubs * New line * Fixed Build * Ok * Update engivend.yml * Fix meson glasses prototype in boxes * Fix prototype name for sec glasses in boxes * Fix InventoryHelpersTest janitor jumpsuit prototype * Fix outdated stationstation prototypes * Fix vending machines having invalid starting inventories * Fix chapel vending machine Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
80 lines
3.1 KiB
C#
80 lines
3.1 KiB
C#
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Content.Server.GameObjects.Components.GUI;
|
|
using Content.Server.GameObjects.Components.Items.Storage;
|
|
using Content.Server.GameObjects.Components.Mobs;
|
|
using Content.Server.Utility;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.Interfaces.Map;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
|
|
|
namespace Content.IntegrationTests.Tests
|
|
{
|
|
[TestFixture]
|
|
[TestOf(typeof(InventoryHelpers))]
|
|
public class InventoryHelpersTest : ContentIntegrationTest
|
|
{
|
|
private const string PROTOTYPES = @"
|
|
- type: entity
|
|
name: InventoryStunnableDummy
|
|
id: InventoryStunnableDummy
|
|
components:
|
|
- type: Inventory
|
|
- type: Stunnable
|
|
";
|
|
[Test]
|
|
public async Task SpawnItemInSlotTest()
|
|
{
|
|
var options = new ServerIntegrationOptions {ExtraPrototypes = PROTOTYPES};
|
|
var server = StartServerDummyTicker(options);
|
|
|
|
IEntity human = null;
|
|
InventoryComponent inventory = null;
|
|
StunnableComponent stun = null;
|
|
|
|
|
|
server.Assert(() =>
|
|
{
|
|
var mapMan = IoCManager.Resolve<IMapManager>();
|
|
|
|
mapMan.CreateNewMapEntity(MapId.Nullspace);
|
|
|
|
var entityMan = IoCManager.Resolve<IEntityManager>();
|
|
|
|
human = entityMan.SpawnEntity("InventoryStunnableDummy", MapCoordinates.Nullspace);
|
|
inventory = human.GetComponent<InventoryComponent>();
|
|
stun = human.GetComponent<StunnableComponent>();
|
|
|
|
// Can't do the test if this human doesn't have the slots for it.
|
|
Assert.That(inventory.HasSlot(Slots.INNERCLOTHING));
|
|
Assert.That(inventory.HasSlot(Slots.IDCARD));
|
|
|
|
Assert.That(inventory.SpawnItemInSlot(Slots.INNERCLOTHING, "ClothingUniformJumpsuitJanitor", true));
|
|
|
|
// Do we actually have the uniform equipped?
|
|
Assert.That(inventory.TryGetSlotItem(Slots.INNERCLOTHING, out ItemComponent uniform));
|
|
Assert.That(uniform.Owner.Prototype != null && uniform.Owner.Prototype.ID == "ClothingUniformJumpsuitJanitor");
|
|
|
|
stun.Stun(1f);
|
|
|
|
// Since the mob is stunned, they can't equip this.
|
|
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "AssistantIDCard", true), Is.False);
|
|
|
|
// Make sure we don't have the ID card equipped.
|
|
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent _), Is.False);
|
|
|
|
// Let's try skipping the interaction check and see if it equips it!
|
|
Assert.That(inventory.SpawnItemInSlot(Slots.IDCARD, "AssistantIDCard", false));
|
|
Assert.That(inventory.TryGetSlotItem(Slots.IDCARD, out ItemComponent id));
|
|
Assert.That(id.Owner.Prototype != null && id.Owner.Prototype.ID == "AssistantIDCard");
|
|
});
|
|
|
|
await server.WaitIdleAsync();
|
|
}
|
|
}
|
|
}
|