mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-02 09:07:27 +00:00
90 lines
3.3 KiB
C#
90 lines
3.3 KiB
C#
using System.Collections.Generic;
|
|
using Content.IntegrationTests.Tests.Interaction;
|
|
using Content.Shared.Body;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.Humanoid.Markings;
|
|
using Content.Shared.Inventory;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.IntegrationTests.Tests.Humanoid;
|
|
|
|
[TestOf(typeof(SharedHideableHumanoidLayersSystem))]
|
|
public sealed class HideableHumanoidLayersTest : InteractionTest
|
|
{
|
|
protected override string PlayerPrototype => "MobVulpkanin";
|
|
|
|
[Test]
|
|
public async Task BasicHiding()
|
|
{
|
|
await SpawnTarget("ClothingMaskGas");
|
|
await Pickup(); // equip mask
|
|
await UseInHand();
|
|
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
var hideableHumanoidLayers = SEntMan.GetComponent<HideableHumanoidLayersComponent>(SPlayer);
|
|
Assert.That(hideableHumanoidLayers.HiddenLayers, Does.ContainKey(HumanoidVisualLayers.Snout).WithValue(SlotFlags.MASK));
|
|
});
|
|
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
SEntMan.DeleteEntity(STarget); // de-equip mask
|
|
|
|
var hideableHumanoidLayers = SEntMan.GetComponent<HideableHumanoidLayersComponent>(SPlayer);
|
|
Assert.That(hideableHumanoidLayers.HiddenLayers, Does.Not.ContainKey(HumanoidVisualLayers.Snout));
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public async Task DependentHiding()
|
|
{
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
var visualBody = SEntMan.System<SharedVisualBodySystem>();
|
|
visualBody.ApplyMarkings(SPlayer, new()
|
|
{
|
|
["Head"] = new()
|
|
{
|
|
[HumanoidVisualLayers.Snout] = new List<Marking>() {new("VulpSnout", 1)}, // Delta V - Added since our Vulp have no default Snout
|
|
[HumanoidVisualLayers.SnoutCover] = new List<Marking>() { new("VulpSnoutNose", 1) },
|
|
},
|
|
});
|
|
});
|
|
|
|
await SpawnTarget("ClothingMaskGas");
|
|
await Pickup(); // equip mask
|
|
await UseInHand();
|
|
|
|
await RunTicks(20);
|
|
|
|
await Client.WaitAssertion(() =>
|
|
{
|
|
var spriteSystem = CEntMan.System<SpriteSystem>();
|
|
var snoutIndex = spriteSystem.LayerMapGet(CPlayer, "VulpSnout-muzzle"); // Delta V - Fit to our Markings
|
|
var snoutCoverIndex = spriteSystem.LayerMapGet(CPlayer, "VulpSnoutNose-nose"); // Delta V - Fit to our Markings
|
|
var spriteComp = CEntMan.GetComponent<SpriteComponent>(CPlayer);
|
|
|
|
Assert.That(spriteComp[snoutIndex].Visible, Is.False);
|
|
Assert.That(spriteComp[snoutCoverIndex].Visible, Is.False);
|
|
});
|
|
|
|
await Server.WaitAssertion(() =>
|
|
{
|
|
SEntMan.DeleteEntity(STarget); // de-equip mask
|
|
});
|
|
|
|
await RunTicks(20);
|
|
|
|
await Client.WaitAssertion(() =>
|
|
{
|
|
var spriteSystem = CEntMan.System<SpriteSystem>();
|
|
var snoutIndex = spriteSystem.LayerMapGet(CPlayer, "VulpSnout-muzzle"); // Delta V - Fit to our Markings
|
|
var snoutCoverIndex = spriteSystem.LayerMapGet(CPlayer, "VulpSnoutNose-nose"); // Delta V - Fit to our Markings
|
|
var spriteComp = CEntMan.GetComponent<SpriteComponent>(CPlayer);
|
|
|
|
Assert.That(spriteComp[snoutIndex].Visible, Is.True);
|
|
Assert.That(spriteComp[snoutCoverIndex].Visible, Is.True);
|
|
});
|
|
}
|
|
}
|