This commit is contained in:
Leon Friedrich
2022-03-17 20:13:31 +13:00
committed by GitHub
parent 7b84362901
commit bfd95c493b
94 changed files with 1454 additions and 2185 deletions

View File

@@ -4,6 +4,7 @@ using Content.Client.Items.Components;
using Content.Server.Hands.Components;
using Content.Server.Interaction;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Weapons.Melee;
@@ -54,6 +55,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var sysMan = server.ResolveDependency<IEntitySystemManager>();
var handSys = sysMan.GetEntitySystem<SharedHandsSystem>();
var mapId = MapId.Nullspace;
var coords = MapCoordinates.Nullspace;
@@ -71,7 +74,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
server.Assert(() =>
{
user = sEntities.SpawnEntity(null, coords);
user.EnsureComponent<HandsComponent>().AddHand("hand", HandLocation.Left);
user.EnsureComponent<HandsComponent>();
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, coords);
item = sEntities.SpawnEntity(null, coords);
item.EnsureComponent<ItemComponent>();
@@ -98,8 +102,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(interactUsing, Is.False);
Assert.That(interactHand);
Assert.That(sEntities.TryGetComponent<HandsComponent>(user, out var hands));
Assert.That(hands.PutInHand(sEntities.GetComponent<SharedItemComponent>(item)));
Assert.That(handSys.TryPickup(user, item));
interactionSystem.UserInteraction(user, sEntities.GetComponent<TransformComponent>(target).Coordinates, target);
Assert.That(interactUsing);
@@ -124,6 +127,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var sysMan = server.ResolveDependency<IEntitySystemManager>();
var handSys = sysMan.GetEntitySystem<SharedHandsSystem>();
var mapId = MapId.Nullspace;
var coords = MapCoordinates.Nullspace;
@@ -142,7 +147,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
server.Assert(() =>
{
user = sEntities.SpawnEntity(null, coords);
user.EnsureComponent<HandsComponent>().AddHand("hand", HandLocation.Left);
user.EnsureComponent<HandsComponent>();
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, new MapCoordinates((1.9f, 0), mapId));
item = sEntities.SpawnEntity(null, coords);
item.EnsureComponent<ItemComponent>();
@@ -170,8 +176,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(interactUsing, Is.False);
Assert.That(interactHand, Is.False);
Assert.That(sEntities.TryGetComponent<HandsComponent?>(user, out var hands));
Assert.That(hands.PutInHand(sEntities.GetComponent<SharedItemComponent>(item)));
Assert.That(handSys.TryPickup(user, item));
interactionSystem.UserInteraction(user, sEntities.GetComponent<TransformComponent>(target).Coordinates, target);
Assert.That(interactUsing, Is.False);
@@ -195,6 +200,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var sysMan = server.ResolveDependency<IEntitySystemManager>();
var handSys = sysMan.GetEntitySystem<SharedHandsSystem>();
var mapId = MapId.Nullspace;
var coords = MapCoordinates.Nullspace;
@@ -212,7 +219,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
server.Assert(() =>
{
user = sEntities.SpawnEntity(null, coords);
user.EnsureComponent<HandsComponent>().AddHand("hand", HandLocation.Left);
user.EnsureComponent<HandsComponent>();
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, new MapCoordinates((InteractionSystem.InteractionRange - 0.1f, 0), mapId));
item = sEntities.SpawnEntity(null, coords);
item.EnsureComponent<ItemComponent>();
@@ -239,8 +247,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(interactUsing, Is.False);
Assert.That(interactHand);
Assert.That(sEntities.TryGetComponent<HandsComponent>(user, out var hands));
Assert.That(hands.PutInHand(sEntities.GetComponent<SharedItemComponent>(item)));
Assert.That(handSys.TryPickup(user, item));
interactionSystem.UserInteraction(user, sEntities.GetComponent<TransformComponent>(target).Coordinates, target);
Assert.That(interactUsing);
@@ -265,6 +272,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var sysMan = server.ResolveDependency<IEntitySystemManager>();
var handSys = sysMan.GetEntitySystem<SharedHandsSystem>();
var mapId = MapId.Nullspace;
var coords = MapCoordinates.Nullspace;
@@ -282,7 +291,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
server.Assert(() =>
{
user = sEntities.SpawnEntity(null, coords);
user.EnsureComponent<HandsComponent>().AddHand("hand", HandLocation.Left);
user.EnsureComponent<HandsComponent>();
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, new MapCoordinates((SharedInteractionSystem.InteractionRange + 0.01f, 0), mapId));
item = sEntities.SpawnEntity(null, coords);
item.EnsureComponent<ItemComponent>();
@@ -309,8 +319,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(interactUsing, Is.False);
Assert.That(interactHand, Is.False);
Assert.That(sEntities.TryGetComponent<HandsComponent?>(user, out var hands));
Assert.That(hands.PutInHand(sEntities.GetComponent<SharedItemComponent>(item)));
Assert.That(handSys.TryPickup(user, item));
interactionSystem.UserInteraction(user, sEntities.GetComponent<TransformComponent>(target).Coordinates, target);
Assert.That(interactUsing, Is.False);
@@ -335,6 +344,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
var sEntities = server.ResolveDependency<IEntityManager>();
var mapManager = server.ResolveDependency<IMapManager>();
var sysMan = server.ResolveDependency<IEntitySystemManager>();
var handSys = sysMan.GetEntitySystem<SharedHandsSystem>();
var mapId = MapId.Nullspace;
var coords = MapCoordinates.Nullspace;
@@ -354,7 +365,8 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
server.Assert(() =>
{
user = sEntities.SpawnEntity(null, coords);
user.EnsureComponent<HandsComponent>().AddHand("hand", HandLocation.Left);
user.EnsureComponent<HandsComponent>();
handSys.AddHand(user, "hand", HandLocation.Left);
target = sEntities.SpawnEntity(null, coords);
item = sEntities.SpawnEntity(null, coords);
item.EnsureComponent<ItemComponent>();
@@ -394,8 +406,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(interactUsing, Is.False);
Assert.That(interactHand);
Assert.That(sEntities.TryGetComponent<HandsComponent?>(user, out var hands));
Assert.That(hands.PutInHand(sEntities.GetComponent<SharedItemComponent>(item)));
Assert.That(handSys.TryPickup(user, item));
interactionSystem.UserInteraction(user, sEntities.GetComponent<TransformComponent>(target).Coordinates, target);
Assert.That(interactUsing, Is.False);