Content update for NetEntities (#18935)
This commit is contained in:
@@ -3,6 +3,8 @@ using Content.Shared.Actions;
|
||||
using Content.Shared.CombatMode;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Players;
|
||||
using PlayerManager = Robust.Client.Player.PlayerManager;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Actions;
|
||||
|
||||
@@ -23,30 +25,32 @@ public sealed class ActionsAddedTest
|
||||
var client = pair.Client;
|
||||
var sEntMan = server.ResolveDependency<IEntityManager>();
|
||||
var cEntMan = client.ResolveDependency<IEntityManager>();
|
||||
var session = server.ResolveDependency<IPlayerManager>().ServerSessions.Single();
|
||||
var clientSession = client.ResolveDependency<Robust.Client.Player.IPlayerManager>().LocalPlayer?.Session;
|
||||
var serverSession = server.ResolveDependency<IPlayerManager>().ServerSessions.Single();
|
||||
var sActionSystem = server.System<SharedActionsSystem>();
|
||||
var cActionSystem = client.System<SharedActionsSystem>();
|
||||
|
||||
// Dummy ticker is disabled - client should be in control of a normal mob.
|
||||
Assert.NotNull(session.AttachedEntity);
|
||||
var ent = session.AttachedEntity!.Value;
|
||||
Assert.That(sEntMan.EntityExists(ent));
|
||||
Assert.That(cEntMan.EntityExists(ent));
|
||||
Assert.That(sEntMan.HasComponent<ActionsComponent>(ent));
|
||||
Assert.That(cEntMan.HasComponent<ActionsComponent>(ent));
|
||||
Assert.That(sEntMan.HasComponent<CombatModeComponent>(ent));
|
||||
Assert.That(cEntMan.HasComponent<CombatModeComponent>(ent));
|
||||
Assert.NotNull(serverSession.AttachedEntity);
|
||||
var serverEnt = serverSession.AttachedEntity!.Value;
|
||||
var clientEnt = clientSession!.AttachedEntity!.Value;
|
||||
Assert.That(sEntMan.EntityExists(serverEnt));
|
||||
Assert.That(cEntMan.EntityExists(clientEnt));
|
||||
Assert.That(sEntMan.HasComponent<ActionsComponent>(serverEnt));
|
||||
Assert.That(cEntMan.HasComponent<ActionsComponent>(clientEnt));
|
||||
Assert.That(sEntMan.HasComponent<CombatModeComponent>(serverEnt));
|
||||
Assert.That(cEntMan.HasComponent<CombatModeComponent>(clientEnt));
|
||||
|
||||
var sComp = sEntMan.GetComponent<ActionsComponent>(ent);
|
||||
var cComp = cEntMan.GetComponent<ActionsComponent>(ent);
|
||||
var sComp = sEntMan.GetComponent<ActionsComponent>(serverEnt);
|
||||
var cComp = cEntMan.GetComponent<ActionsComponent>(clientEnt);
|
||||
|
||||
// Mob should have a combat-mode action.
|
||||
// This action should have a non-null event both on the server & client.
|
||||
var evType = typeof(ToggleCombatActionEvent);
|
||||
|
||||
var sActions = sActionSystem.GetActions(ent).Where(
|
||||
var sActions = sActionSystem.GetActions(serverEnt).Where(
|
||||
x => x.Comp is InstantActionComponent act && act.Event?.GetType() == evType).ToArray();
|
||||
var cActions = cActionSystem.GetActions(ent).Where(
|
||||
var cActions = cActionSystem.GetActions(clientEnt).Where(
|
||||
x => x.Comp is InstantActionComponent act && act.Event?.GetType() == evType).ToArray();
|
||||
|
||||
Assert.That(sActions.Length, Is.EqualTo(1));
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed class DispenserTest : InteractionTest
|
||||
|
||||
// Beaker is back in the player's hands
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
|
||||
AssertPrototype("Beaker", Hands.ActiveHandEntity);
|
||||
AssertPrototype("Beaker", SEntMan.GetNetEntity(Hands.ActiveHandEntity));
|
||||
|
||||
// Re-insert the beaker
|
||||
await Interact();
|
||||
@@ -40,6 +40,6 @@ public sealed class DispenserTest : InteractionTest
|
||||
await ClickControl<ReagentDispenserWindow>(nameof(ReagentDispenserWindow.EjectButton));
|
||||
await RunTicks(5);
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Not.Null);
|
||||
AssertPrototype("Beaker", Hands.ActiveHandEntity);
|
||||
AssertPrototype("Beaker", SEntMan.GetNetEntity(Hands.ActiveHandEntity));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Content.IntegrationTests.Tests
|
||||
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
|
||||
var server = pair.Server;
|
||||
var client = pair.Client;
|
||||
EntityUid entity = default;
|
||||
|
||||
var clientEntManager = client.ResolveDependency<IEntityManager>();
|
||||
var serverEntManager = server.ResolveDependency<IEntityManager>();
|
||||
var eyeManager = client.ResolveDependency<IEyeManager>();
|
||||
@@ -56,35 +56,38 @@ namespace Content.IntegrationTests.Tests
|
||||
var eye = client.ResolveDependency<IEyeManager>().CurrentEye;
|
||||
|
||||
var testMap = await pair.CreateTestMap();
|
||||
|
||||
EntityUid serverEnt = default;
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
var ent = serverEntManager.SpawnEntity(prototype, testMap.GridCoords);
|
||||
serverEntManager.System<SharedTransformSystem>().SetWorldRotation(ent, angle);
|
||||
entity = ent;
|
||||
serverEnt = serverEntManager.SpawnEntity(prototype, testMap.GridCoords);
|
||||
serverEntManager.System<SharedTransformSystem>().SetWorldRotation(serverEnt, angle);
|
||||
});
|
||||
|
||||
// Let client sync up.
|
||||
await pair.RunTicksSync(5);
|
||||
|
||||
var hit = false;
|
||||
var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(serverEnt));
|
||||
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
var sprite = spriteQuery.GetComponent(entity);
|
||||
var sprite = spriteQuery.GetComponent(clientEnt);
|
||||
sprite.Scale = new Vector2(scale, scale);
|
||||
|
||||
// these tests currently all assume player eye is 0
|
||||
eyeManager.CurrentEye.Rotation = 0;
|
||||
|
||||
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(entity);
|
||||
var clickable = clientEntManager.GetComponent<ClickableComponent>(entity);
|
||||
var pos = clientEntManager.System<SharedTransformSystem>().GetWorldPosition(clientEnt);
|
||||
var clickable = clientEntManager.GetComponent<ClickableComponent>(clientEnt);
|
||||
|
||||
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(entity), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
|
||||
hit = clickable.CheckClick(sprite, xformQuery.GetComponent(clientEnt), xformQuery, new Vector2(clickPosX, clickPosY) + pos, eye, out _, out _, out _);
|
||||
});
|
||||
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
serverEntManager.DeleteEntity(entity);
|
||||
serverEntManager.DeleteEntity(serverEnt);
|
||||
});
|
||||
|
||||
await pair.CleanReturnAsync();
|
||||
|
||||
@@ -29,7 +29,7 @@ public sealed class ClimbingTest : MovementTest
|
||||
|
||||
// Try to start climbing
|
||||
var sys = SEntMan.System<ClimbSystem>();
|
||||
await Server.WaitPost(() => sys.TryClimb(Player, Player, Target.Value, out _));
|
||||
await Server.WaitPost(() => sys.TryClimb(SEntMan.GetEntity(Player), SEntMan.GetEntity(Player), SEntMan.GetEntity(Target.Value), out _));
|
||||
await AwaitDoAfters();
|
||||
|
||||
// Player should now be climbing
|
||||
@@ -56,7 +56,7 @@ public sealed class ClimbingTest : MovementTest
|
||||
Assert.That(Delta(), Is.LessThan(0));
|
||||
|
||||
// Start climbing
|
||||
await Server.WaitPost(() => sys.TryClimb(Player, Player, Target.Value, out _));
|
||||
await Server.WaitPost(() => sys.TryClimb(SEntMan.GetEntity(Player), SEntMan.GetEntity(Player), SEntMan.GetEntity(Target.Value), out _));
|
||||
await AwaitDoAfters();
|
||||
|
||||
Assert.Multiple(() =>
|
||||
|
||||
@@ -17,7 +17,9 @@ public sealed class ComputerConstruction : InteractionTest
|
||||
|
||||
// Initial interaction (ghost turns into real entity)
|
||||
await Interact(Steel, 5);
|
||||
AssertPrototype(ComputerFrame);
|
||||
ClientAssertPrototype(ComputerFrame, ClientTarget);
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
ClientTarget = null;
|
||||
|
||||
// Perform construction steps
|
||||
await Interact(
|
||||
@@ -29,7 +31,7 @@ public sealed class ComputerConstruction : InteractionTest
|
||||
Screw);
|
||||
|
||||
// Construction finished, target entity was replaced with a new one:
|
||||
AssertPrototype(ComputerId);
|
||||
AssertPrototype(ComputerId, Target);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Stacks;
|
||||
using Robust.Shared.Containers;
|
||||
|
||||
@@ -40,7 +41,7 @@ public sealed class CraftingTests : InteractionTest
|
||||
{
|
||||
// Spawn a full tack of rods in the user's hands.
|
||||
await PlaceInHands(Rod, 10);
|
||||
await SpawnEntity((Cable, 10), PlayerCoords);
|
||||
await SpawnEntity((Cable, 10), SEntMan.GetCoordinates(PlayerCoords));
|
||||
|
||||
// Attempt (and fail) to craft without glass.
|
||||
await CraftItem(Spear, shouldSucceed: false);
|
||||
@@ -69,9 +70,10 @@ public sealed class CraftingTests : InteractionTest
|
||||
[Test]
|
||||
public async Task CancelCraft()
|
||||
{
|
||||
var rods = await SpawnEntity((Rod, 10), TargetCoords);
|
||||
var wires = await SpawnEntity((Cable, 10), TargetCoords);
|
||||
var shard = await SpawnEntity(ShardGlass, TargetCoords);
|
||||
var serverTargetCoords = SEntMan.GetCoordinates(TargetCoords);
|
||||
var rods = await SpawnEntity((Rod, 10), serverTargetCoords);
|
||||
var wires = await SpawnEntity((Cable, 10), serverTargetCoords);
|
||||
var shard = await SpawnEntity(ShardGlass, serverTargetCoords);
|
||||
|
||||
var rodStack = SEntMan.GetComponent<StackComponent>(rods);
|
||||
var wireStack = SEntMan.GetComponent<StackComponent>(wires);
|
||||
@@ -86,7 +88,7 @@ public sealed class CraftingTests : InteractionTest
|
||||
});
|
||||
|
||||
#pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. If we await it we will be waiting forever.
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, SEntMan.GetEntity(Player)));
|
||||
#pragma warning restore CS4014
|
||||
await RunTicks(1);
|
||||
|
||||
@@ -116,7 +118,7 @@ public sealed class CraftingTests : InteractionTest
|
||||
|
||||
// Re-attempt the do-after
|
||||
#pragma warning disable CS4014 // Legacy construction code uses DoAfterAwait. See above.
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, Player));
|
||||
await Server.WaitPost(() => SConstruction.TryStartItemConstruction(Spear, SEntMan.GetEntity(Player)));
|
||||
#pragma warning restore CS4014
|
||||
await RunTicks(1);
|
||||
|
||||
|
||||
@@ -18,14 +18,16 @@ public sealed class GrilleWindowConstruction : InteractionTest
|
||||
// Construct Grille
|
||||
await StartConstruction(Grille);
|
||||
await Interact(Rod, 10);
|
||||
AssertPrototype(Grille);
|
||||
ClientAssertPrototype(Grille, ClientTarget);
|
||||
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
var grille = Target;
|
||||
|
||||
// Construct Window
|
||||
await StartConstruction(Window);
|
||||
await Interact(Glass, 10);
|
||||
AssertPrototype(Window);
|
||||
ClientAssertPrototype(Window, ClientTarget);
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
|
||||
// Deconstruct Window
|
||||
await Interact(Screw, Wrench);
|
||||
@@ -50,7 +52,7 @@ public sealed class GrilleWindowConstruction : InteractionTest
|
||||
await Client.WaitPost(() =>
|
||||
{
|
||||
var proto = ProtoMan.Index<ConstructionPrototype>(second);
|
||||
Assert.That(CConSys.TrySpawnGhost(proto, TargetCoords, Direction.South, out _), Is.False);
|
||||
Assert.That(CConSys.TrySpawnGhost(proto, CEntMan.GetCoordinates(TargetCoords), Direction.South, out _), Is.False);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ public sealed class MachineConstruction : InteractionTest
|
||||
{
|
||||
await StartConstruction(MachineFrame);
|
||||
await Interact(Steel, 5);
|
||||
AssertPrototype(Unfinished);
|
||||
ClientAssertPrototype(Unfinished, ClientTarget);
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
await Interact(Wrench, Cable);
|
||||
AssertPrototype(MachineFrame);
|
||||
await Interact(ProtolatheBoard, Bin1, Bin1, Manipulator1, Manipulator1, Beaker, Beaker, Screw);
|
||||
@@ -61,9 +62,10 @@ public sealed class MachineConstruction : InteractionTest
|
||||
{
|
||||
// Partially deconstruct a protolathe.
|
||||
await SpawnTarget(Protolathe);
|
||||
var serverTarget = SEntMan.GetEntity(Target!.Value);
|
||||
|
||||
// Initially has all quality-1 parts.
|
||||
foreach (var part in SConstruction.GetAllParts(Target!.Value))
|
||||
foreach (var part in SConstruction.GetAllParts(serverTarget))
|
||||
{
|
||||
Assert.That(part.Rating, Is.EqualTo(1));
|
||||
}
|
||||
@@ -78,7 +80,7 @@ public sealed class MachineConstruction : InteractionTest
|
||||
AssertPrototype(Protolathe);
|
||||
|
||||
// Query now returns higher quality parts.
|
||||
foreach (var part in SConstruction.GetAllParts(Target!.Value))
|
||||
foreach (var part in SConstruction.GetAllParts(SEntMan.GetEntity(Target!.Value)))
|
||||
{
|
||||
Assert.That(part.Rating, Is.EqualTo(4));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
|
||||
@@ -14,7 +14,8 @@ public sealed class WallConstruction : InteractionTest
|
||||
await StartConstruction(Wall);
|
||||
await Interact(Steel, 2);
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Null);
|
||||
AssertPrototype(Girder);
|
||||
ClientAssertPrototype(Girder, ClientTarget);
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
await Interact(Steel, 2);
|
||||
Assert.That(Hands.ActiveHandEntity, Is.Null);
|
||||
AssertPrototype(WallSolid);
|
||||
|
||||
@@ -12,7 +12,7 @@ public sealed class WindowConstruction : InteractionTest
|
||||
{
|
||||
await StartConstruction(Window);
|
||||
await Interact(Glass, 5);
|
||||
AssertPrototype(Window);
|
||||
ClientAssertPrototype(Window, ClientTarget);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -29,7 +29,7 @@ public sealed class WindowConstruction : InteractionTest
|
||||
{
|
||||
await StartConstruction(RWindow);
|
||||
await Interact(RGlass, 5);
|
||||
AssertPrototype(RWindow);
|
||||
ClientAssertPrototype(RWindow, ClientTarget);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -19,7 +19,7 @@ public sealed class WindowRepair : InteractionTest
|
||||
var damageType = Server.ResolveDependency<IPrototypeManager>().Index<DamageTypePrototype>("Blunt");
|
||||
var damage = new DamageSpecifier(damageType, FixedPoint2.New(10));
|
||||
Assert.That(comp.Damage.Total, Is.EqualTo(FixedPoint2.Zero));
|
||||
await Server.WaitPost(() => sys.TryChangeDamage(Target, damage, ignoreResistances: true));
|
||||
await Server.WaitPost(() => sys.TryChangeDamage(SEntMan.GetEntity(Target), damage, ignoreResistances: true));
|
||||
await RunTicks(5);
|
||||
Assert.That(comp.Damage.Total, Is.GreaterThan(FixedPoint2.Zero));
|
||||
|
||||
|
||||
@@ -35,32 +35,34 @@ namespace Content.IntegrationTests.Tests
|
||||
public async Task TestA()
|
||||
{
|
||||
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
|
||||
var s = pair.Server;
|
||||
var c = pair.Client;
|
||||
var server = pair.Server;
|
||||
var client = pair.Client;
|
||||
|
||||
var cEntities = c.ResolveDependency<IEntityManager>();
|
||||
var ent = s.ResolveDependency<IEntityManager>();
|
||||
var clientEntManager = client.ResolveDependency<IEntityManager>();
|
||||
var serverEntManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
EntityUid dummy = default;
|
||||
var mapManager = s.ResolveDependency<IMapManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var mapId = mapManager.CreateMap();
|
||||
|
||||
await s.WaitPost(() =>
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
var pos = new MapCoordinates(Vector2.Zero, mapId);
|
||||
var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var container = ent.SpawnEntity("ContainerOcclusionA", pos);
|
||||
dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var container = serverEntManager.SpawnEntity("ContainerOcclusionA", pos);
|
||||
dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
|
||||
entStorage.Insert(dummy, container);
|
||||
});
|
||||
|
||||
await pair.RunTicksSync(5);
|
||||
|
||||
await c.WaitAssertion(() =>
|
||||
var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
|
||||
var light = cEntities.GetComponent<PointLightComponent>(dummy);
|
||||
var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
|
||||
var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(sprite.ContainerOccluded);
|
||||
@@ -75,32 +77,34 @@ namespace Content.IntegrationTests.Tests
|
||||
public async Task TestB()
|
||||
{
|
||||
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
|
||||
var s = pair.Server;
|
||||
var c = pair.Client;
|
||||
var server = pair.Server;
|
||||
var client = pair.Client;
|
||||
|
||||
var cEntities = c.ResolveDependency<IEntityManager>();
|
||||
var ent = s.ResolveDependency<IEntityManager>();
|
||||
var clientEntManager = client.ResolveDependency<IEntityManager>();
|
||||
var serverEntManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
EntityUid dummy = default;
|
||||
var mapManager = s.ResolveDependency<IMapManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var mapId = mapManager.CreateMap();
|
||||
|
||||
await s.WaitPost(() =>
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
var pos = new MapCoordinates(Vector2.Zero, mapId);
|
||||
var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var container = ent.SpawnEntity("ContainerOcclusionB", pos);
|
||||
dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var container = serverEntManager.SpawnEntity("ContainerOcclusionB", pos);
|
||||
dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
|
||||
entStorage.Insert(dummy, container);
|
||||
});
|
||||
|
||||
await pair.RunTicksSync(5);
|
||||
|
||||
await c.WaitAssertion(() =>
|
||||
var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
|
||||
var light = cEntities.GetComponent<PointLightComponent>(dummy);
|
||||
var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
|
||||
var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(sprite.ContainerOccluded, Is.False);
|
||||
@@ -115,23 +119,23 @@ namespace Content.IntegrationTests.Tests
|
||||
public async Task TestAb()
|
||||
{
|
||||
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
|
||||
var s = pair.Server;
|
||||
var c = pair.Client;
|
||||
var server = pair.Server;
|
||||
var client = pair.Client;
|
||||
|
||||
var cEntities = c.ResolveDependency<IEntityManager>();
|
||||
var ent = s.ResolveDependency<IEntityManager>();
|
||||
var clientEntManager = client.ResolveDependency<IEntityManager>();
|
||||
var serverEntManager = server.ResolveDependency<IEntityManager>();
|
||||
|
||||
EntityUid dummy = default;
|
||||
var mapManager = s.ResolveDependency<IMapManager>();
|
||||
var mapManager = server.ResolveDependency<IMapManager>();
|
||||
var mapId = mapManager.CreateMap();
|
||||
|
||||
await s.WaitPost(() =>
|
||||
await server.WaitPost(() =>
|
||||
{
|
||||
var pos = new MapCoordinates(Vector2.Zero, mapId);
|
||||
var entStorage = ent.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var containerA = ent.SpawnEntity("ContainerOcclusionA", pos);
|
||||
var containerB = ent.SpawnEntity("ContainerOcclusionB", pos);
|
||||
dummy = ent.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
var entStorage = serverEntManager.EntitySysManager.GetEntitySystem<EntityStorageSystem>();
|
||||
var containerA = serverEntManager.SpawnEntity("ContainerOcclusionA", pos);
|
||||
var containerB = serverEntManager.SpawnEntity("ContainerOcclusionB", pos);
|
||||
dummy = serverEntManager.SpawnEntity("ContainerOcclusionDummy", pos);
|
||||
|
||||
entStorage.Insert(containerB, containerA);
|
||||
entStorage.Insert(dummy, containerB);
|
||||
@@ -139,10 +143,12 @@ namespace Content.IntegrationTests.Tests
|
||||
|
||||
await pair.RunTicksSync(5);
|
||||
|
||||
await c.WaitAssertion(() =>
|
||||
var clientEnt = clientEntManager.GetEntity(serverEntManager.GetNetEntity(dummy));
|
||||
|
||||
await client.WaitAssertion(() =>
|
||||
{
|
||||
var sprite = cEntities.GetComponent<SpriteComponent>(dummy);
|
||||
var light = cEntities.GetComponent<PointLightComponent>(dummy);
|
||||
var sprite = clientEntManager.GetComponent<SpriteComponent>(clientEnt);
|
||||
var light = clientEntManager.GetComponent<PointLightComponent>(clientEnt);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(sprite.ContainerOccluded);
|
||||
|
||||
@@ -3,6 +3,8 @@ using Content.IntegrationTests.Tests.Construction.Interaction;
|
||||
using Content.IntegrationTests.Tests.Interaction;
|
||||
using Content.IntegrationTests.Tests.Weldable;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.DoAfter;
|
||||
|
||||
namespace Content.IntegrationTests.Tests.DoAfter;
|
||||
|
||||
@@ -50,10 +52,10 @@ public sealed class DoAfterCancellationTests : InteractionTest
|
||||
await StartConstruction(WallConstruction.Wall);
|
||||
await Interact(Steel, 5, awaitDoAfters: false);
|
||||
await CancelDoAfters();
|
||||
Assert.That(Target.HasValue && Target.Value.IsClientSide());
|
||||
|
||||
await Interact(Steel, 5);
|
||||
AssertPrototype(WallConstruction.Girder);
|
||||
ClientAssertPrototype(WallConstruction.Girder, ClientTarget);
|
||||
Target = CTestSystem.Ghosts[ClientTarget!.Value.GetHashCode()];
|
||||
await Interact(Steel, 5, awaitDoAfters: false);
|
||||
await CancelDoAfters();
|
||||
AssertPrototype(WallConstruction.Girder);
|
||||
@@ -84,7 +86,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
|
||||
await AssertTile(Floor);
|
||||
|
||||
// Second DoAfter cancels the first.
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
|
||||
await AssertTile(Floor);
|
||||
|
||||
@@ -112,7 +114,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
|
||||
|
||||
// Second DoAfter cancels the first.
|
||||
// Not using helper, because it runs too many ticks & causes the do-after to finish.
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
|
||||
@@ -135,7 +137,7 @@ public sealed class DoAfterCancellationTests : InteractionTest
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(1));
|
||||
Assert.That(comp.IsWelded, Is.True);
|
||||
});
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(ActiveDoAfters.Count(), Is.EqualTo(0));
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
{
|
||||
var tickTime = 1.0f / timing.TickRate;
|
||||
var mob = entityManager.SpawnEntity("DoAfterDummy", MapCoordinates.Nullspace);
|
||||
var args = new DoAfterArgs(mob, tickTime / 2, ev, null) { Broadcast = true };
|
||||
var args = new DoAfterArgs(entityManager, mob, tickTime / 2, ev, null) { Broadcast = true };
|
||||
#pragma warning disable NUnit2045 // Interdependent assertions.
|
||||
Assert.That(doAfterSystem.TryStartDoAfter(args));
|
||||
Assert.That(ev.Cancelled, Is.False);
|
||||
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.DoAfter
|
||||
var tickTime = 1.0f / timing.TickRate;
|
||||
|
||||
var mob = entityManager.SpawnEntity("DoAfterDummy", MapCoordinates.Nullspace);
|
||||
var args = new DoAfterArgs(mob, tickTime * 2, ev, null) { Broadcast = true };
|
||||
var args = new DoAfterArgs(entityManager, mob, tickTime * 2, ev, null) { Broadcast = true };
|
||||
|
||||
if (!doAfterSystem.TryStartDoAfter(args, out var id))
|
||||
{
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace Content.IntegrationTests.Tests
|
||||
{
|
||||
var mapId = mapManager.CreateMap();
|
||||
var grid = mapManager.CreateGrid(mapId);
|
||||
// TODO: Fix this better in engine.
|
||||
grid.SetTile(Vector2i.Zero, new Tile(1));
|
||||
var coord = new EntityCoordinates(grid.Owner, 0, 0);
|
||||
entityMan.SpawnEntity(protoId, coord);
|
||||
}
|
||||
@@ -57,7 +59,7 @@ namespace Content.IntegrationTests.Tests
|
||||
var query = entityMan.AllEntityQueryEnumerator<TComp>();
|
||||
while (query.MoveNext(out var uid, out var meta))
|
||||
yield return (uid, meta);
|
||||
};
|
||||
}
|
||||
|
||||
var entityMetas = Query<MetaDataComponent>(entityMan).ToList();
|
||||
foreach (var (uid, meta) in entityMetas)
|
||||
|
||||
@@ -84,8 +84,8 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
Assert.That(cuffed.CuffedHandCount, Is.GreaterThan(0), "Handcuffing a player did not result in their hands being cuffed");
|
||||
|
||||
// Test to ensure a player with 4 hands will still only have 2 hands cuffed
|
||||
AddHand(human, host);
|
||||
AddHand(human, host);
|
||||
AddHand(entityManager.GetNetEntity(human), host);
|
||||
AddHand(entityManager.GetNetEntity(human), host);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -101,7 +101,7 @@ namespace Content.IntegrationTests.Tests.GameObjects.Components.ActionBlocking
|
||||
await pair.CleanReturnAsync();
|
||||
}
|
||||
|
||||
private static void AddHand(EntityUid to, IServerConsoleHost host)
|
||||
private static void AddHand(NetEntity to, IServerConsoleHost host)
|
||||
{
|
||||
host.ExecuteCommand(null, $"addhand {to}");
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
|
||||
EntityUid target = default;
|
||||
EntityUid item = default;
|
||||
EntityUid containerEntity = default;
|
||||
IContainer container = null;
|
||||
BaseContainer container = null;
|
||||
|
||||
await server.WaitAssertion(() =>
|
||||
{
|
||||
|
||||
@@ -13,7 +13,9 @@ using Content.Server.Gravity;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Tools.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Construction.Prototypes;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Client.GameObjects;
|
||||
@@ -40,13 +42,15 @@ public abstract partial class InteractionTest
|
||||
|
||||
await Client.WaitPost(() =>
|
||||
{
|
||||
Assert.That(CConSys.TrySpawnGhost(proto, TargetCoords, Direction.South, out Target),
|
||||
Assert.That(CConSys.TrySpawnGhost(proto, CEntMan.GetCoordinates(TargetCoords), Direction.South, out var clientTarget),
|
||||
Is.EqualTo(shouldSucceed));
|
||||
|
||||
if (!shouldSucceed)
|
||||
return;
|
||||
var comp = CEntMan.GetComponent<ConstructionGhostComponent>(Target!.Value);
|
||||
ConstructionGhostId = comp.GhostId;
|
||||
|
||||
var comp = CEntMan.GetComponent<ConstructionGhostComponent>(clientTarget!.Value);
|
||||
ClientTarget = clientTarget;
|
||||
ConstructionGhostId = comp.Owner.Id;
|
||||
});
|
||||
|
||||
await RunTicks(1);
|
||||
@@ -61,7 +65,7 @@ public abstract partial class InteractionTest
|
||||
|
||||
// Please someone purge async construction code
|
||||
Task<bool> task = default!;
|
||||
await Server.WaitPost(() => task = SConstruction.TryStartItemConstruction(prototype, Player));
|
||||
await Server.WaitPost(() => task = SConstruction.TryStartItemConstruction(prototype, SEntMan.GetEntity(Player)));
|
||||
|
||||
Task? tickTask = null;
|
||||
while (!task.IsCompleted)
|
||||
@@ -86,10 +90,10 @@ public abstract partial class InteractionTest
|
||||
[MemberNotNull(nameof(Target))]
|
||||
protected async Task SpawnTarget(string prototype)
|
||||
{
|
||||
Target = EntityUid.Invalid;
|
||||
Target = NetEntity.Invalid;
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
Target = SEntMan.SpawnEntity(prototype, TargetCoords);
|
||||
Target = SEntMan.GetNetEntity(SEntMan.SpawnEntity(prototype, SEntMan.GetCoordinates(TargetCoords)));
|
||||
});
|
||||
|
||||
await RunTicks(5);
|
||||
@@ -102,8 +106,9 @@ public abstract partial class InteractionTest
|
||||
protected async Task StartDeconstruction(string prototype)
|
||||
{
|
||||
await SpawnTarget(prototype);
|
||||
Assert.That(SEntMan.TryGetComponent(Target, out ConstructionComponent? comp));
|
||||
await Server.WaitPost(() => SConstruction.SetPathfindingTarget(Target!.Value, comp!.DeconstructionNode, comp));
|
||||
var serverTarget = SEntMan.GetEntity(Target);
|
||||
Assert.That(SEntMan.TryGetComponent(serverTarget, out ConstructionComponent? comp));
|
||||
await Server.WaitPost(() => SConstruction.SetPathfindingTarget(serverTarget!.Value, comp!.DeconstructionNode, comp));
|
||||
await RunTicks(5);
|
||||
}
|
||||
|
||||
@@ -116,7 +121,7 @@ public abstract partial class InteractionTest
|
||||
{
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
Assert.That(HandSys.TryDrop(Player, null, false, true, Hands));
|
||||
Assert.That(HandSys.TryDrop(SEntMan.GetEntity(Player), null, false, true, Hands));
|
||||
SEntMan.DeleteEntity(held);
|
||||
SLogger.Debug($"Deleting held entity");
|
||||
});
|
||||
@@ -161,16 +166,18 @@ public abstract partial class InteractionTest
|
||||
}
|
||||
|
||||
// spawn and pick up the new item
|
||||
var item = await SpawnEntity(entity, PlayerCoords);
|
||||
var item = await SpawnEntity(entity, SEntMan.GetCoordinates(PlayerCoords));
|
||||
WelderComponent? welder = null;
|
||||
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
Assert.That(HandSys.TryPickup(Player, item, Hands.ActiveHand, false, false, false, Hands));
|
||||
var playerEnt = SEntMan.GetEntity(Player);
|
||||
|
||||
Assert.That(HandSys.TryPickup(playerEnt, item, Hands.ActiveHand, false, false, false, Hands));
|
||||
|
||||
// turn on welders
|
||||
if (enableWelder && SEntMan.TryGetComponent(item, out welder) && !welder.Lit)
|
||||
Assert.That(ToolSys.TryTurnWelderOn(item, Player, welder));
|
||||
Assert.That(ToolSys.TryTurnWelderOn(item, playerEnt, welder));
|
||||
});
|
||||
|
||||
await RunTicks(1);
|
||||
@@ -184,9 +191,9 @@ public abstract partial class InteractionTest
|
||||
/// <summary>
|
||||
/// Pick up an entity. Defaults to just deleting the previously held entity.
|
||||
/// </summary>
|
||||
protected async Task Pickup(EntityUid? uid = null, bool deleteHeld = true)
|
||||
protected async Task Pickup(NetEntity? entity = null, bool deleteHeld = true)
|
||||
{
|
||||
uid ??= Target;
|
||||
entity ??= Target;
|
||||
|
||||
if (Hands.ActiveHand == null)
|
||||
{
|
||||
@@ -197,15 +204,17 @@ public abstract partial class InteractionTest
|
||||
if (deleteHeld)
|
||||
await DeleteHeldEntity();
|
||||
|
||||
var uid = SEntMan.GetEntity(entity);
|
||||
|
||||
if (!SEntMan.TryGetComponent(uid, out ItemComponent? item))
|
||||
{
|
||||
Assert.Fail($"Entity {uid} is not an item");
|
||||
Assert.Fail($"Entity {entity} is not an item");
|
||||
return;
|
||||
}
|
||||
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
Assert.That(HandSys.TryPickup(Player, uid!.Value, Hands.ActiveHand, false, false, false, Hands, item));
|
||||
Assert.That(HandSys.TryPickup(SEntMan.GetEntity(Player), uid.Value, Hands.ActiveHand, false, false, false, Hands, item));
|
||||
});
|
||||
|
||||
await RunTicks(1);
|
||||
@@ -225,7 +234,7 @@ public abstract partial class InteractionTest
|
||||
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
Assert.That(HandSys.TryDrop(Player, handsComp: Hands));
|
||||
Assert.That(HandSys.TryDrop(SEntMan.GetEntity(Player), handsComp: Hands));
|
||||
});
|
||||
|
||||
await RunTicks(1);
|
||||
@@ -247,7 +256,7 @@ public abstract partial class InteractionTest
|
||||
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
InteractSys.UserInteraction(Player, SEntMan.GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetComponent<TransformComponent>(target).Coordinates, target);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -274,7 +283,7 @@ public abstract partial class InteractionTest
|
||||
// (e.g., servers attempt to assemble construction examine hints).
|
||||
if (Target != null)
|
||||
{
|
||||
await Client.WaitPost(() => ExamineSys.DoExamine(Target.Value));
|
||||
await Client.WaitPost(() => ExamineSys.DoExamine(CEntMan.GetEntity(Target.Value)));
|
||||
}
|
||||
|
||||
await PlaceInHands(entity);
|
||||
@@ -286,16 +295,19 @@ public abstract partial class InteractionTest
|
||||
/// </summary>
|
||||
protected async Task Interact(bool shouldSucceed = true, bool awaitDoAfters = true)
|
||||
{
|
||||
if (Target == null || !Target.Value.IsClientSide())
|
||||
var clientTarget = ClientTarget;
|
||||
|
||||
if ((clientTarget?.IsValid() != true || CEntMan.Deleted(clientTarget)) && (Target == null || Target.Value.IsValid()))
|
||||
{
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(Player, TargetCoords, Target));
|
||||
await Server.WaitPost(() => InteractSys.UserInteraction(SEntMan.GetEntity(Player), SEntMan.GetCoordinates(TargetCoords), SEntMan.GetEntity(Target)));
|
||||
await RunTicks(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The entity is client-side, so attempt to start construction
|
||||
var ghost = CEntMan.GetComponent<ConstructionGhostComponent>(Target.Value);
|
||||
await Client.WaitPost(() => CConSys.TryStartConstruction(ghost.GhostId));
|
||||
var clientEnt = ClientTarget ?? CEntMan.GetEntity(Target);
|
||||
|
||||
await Client.WaitPost(() => CConSys.TryStartConstruction(clientEnt!.Value));
|
||||
await RunTicks(5);
|
||||
}
|
||||
|
||||
@@ -366,7 +378,7 @@ public abstract partial class InteractionTest
|
||||
{
|
||||
foreach (var doAfter in doAfters)
|
||||
{
|
||||
DoAfterSys.Cancel(Player, doAfter.Index, DoAfters);
|
||||
DoAfterSys.Cancel(SEntMan.GetEntity(Player), doAfter.Index, DoAfters);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -386,34 +398,33 @@ public abstract partial class InteractionTest
|
||||
/// </summary>
|
||||
protected async Task CheckTargetChange(bool shouldSucceed)
|
||||
{
|
||||
EntityUid newTarget = default;
|
||||
if (Target == null)
|
||||
return;
|
||||
var target = Target.Value;
|
||||
|
||||
var target = Target.Value;
|
||||
await RunTicks(5);
|
||||
|
||||
if (target.IsClientSide())
|
||||
if (ClientTarget != null && CEntMan.IsClientSide(ClientTarget.Value))
|
||||
{
|
||||
Assert.That(CEntMan.Deleted(target), Is.EqualTo(shouldSucceed),
|
||||
Assert.That(CEntMan.Deleted(ClientTarget.Value), Is.EqualTo(shouldSucceed),
|
||||
$"Construction ghost was {(shouldSucceed ? "not deleted" : "deleted")}.");
|
||||
|
||||
if (shouldSucceed)
|
||||
{
|
||||
Assert.That(CTestSystem.Ghosts.TryGetValue(ConstructionGhostId, out newTarget),
|
||||
Assert.That(CTestSystem.Ghosts.TryGetValue(ConstructionGhostId, out var newWeh),
|
||||
$"Failed to get construction entity from ghost Id");
|
||||
|
||||
await Client.WaitPost(() => CLogger.Debug($"Construction ghost {ConstructionGhostId} became entity {newTarget}"));
|
||||
Target = newTarget;
|
||||
await Client.WaitPost(() => CLogger.Debug($"Construction ghost {ConstructionGhostId} became entity {newWeh}"));
|
||||
Target = newWeh;
|
||||
}
|
||||
}
|
||||
|
||||
if (STestSystem.EntChanges.TryGetValue(Target.Value, out newTarget))
|
||||
if (STestSystem.EntChanges.TryGetValue(Target.Value, out var newServerWeh))
|
||||
{
|
||||
await Server.WaitPost(
|
||||
() => SLogger.Debug($"Construction entity {Target.Value} changed to {newTarget}"));
|
||||
() => SLogger.Debug($"Construction entity {Target.Value} changed to {newServerWeh}"));
|
||||
|
||||
Target = newTarget;
|
||||
Target = newServerWeh;
|
||||
}
|
||||
|
||||
if (Target != target)
|
||||
@@ -422,7 +433,7 @@ public abstract partial class InteractionTest
|
||||
|
||||
#region Asserts
|
||||
|
||||
protected void AssertPrototype(string? prototype, EntityUid? target = null)
|
||||
protected void ClientAssertPrototype(string? prototype, NetEntity? target = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
@@ -431,11 +442,17 @@ public abstract partial class InteractionTest
|
||||
return;
|
||||
}
|
||||
|
||||
var meta = SEntMan.GetComponent<MetaDataComponent>(target.Value);
|
||||
var meta = SEntMan.GetComponent<MetaDataComponent>(SEntMan.GetEntity(target.Value));
|
||||
Assert.That(meta.EntityPrototype?.ID, Is.EqualTo(prototype));
|
||||
}
|
||||
|
||||
protected void AssertAnchored(bool anchored = true, EntityUid? target = null)
|
||||
protected void ClientAssertPrototype(string? prototype, EntityUid? target)
|
||||
{
|
||||
var netEnt = CTestSystem.Ghosts[target.GetHashCode()];
|
||||
AssertPrototype(prototype, netEnt);
|
||||
}
|
||||
|
||||
protected void AssertPrototype(string? prototype, NetEntity? target = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
@@ -444,8 +461,21 @@ public abstract partial class InteractionTest
|
||||
return;
|
||||
}
|
||||
|
||||
var sXform = SEntMan.GetComponent<TransformComponent>(target.Value);
|
||||
var cXform = CEntMan.GetComponent<TransformComponent>(target.Value);
|
||||
var meta = SEntMan.GetComponent<MetaDataComponent>(SEntMan.GetEntity(target.Value));
|
||||
Assert.That(meta.EntityPrototype?.ID, Is.EqualTo(prototype));
|
||||
}
|
||||
|
||||
protected void AssertAnchored(bool anchored = true, NetEntity? target = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
{
|
||||
Assert.Fail("No target specified");
|
||||
return;
|
||||
}
|
||||
|
||||
var sXform = SEntMan.GetComponent<TransformComponent>(SEntMan.GetEntity(target.Value));
|
||||
var cXform = CEntMan.GetComponent<TransformComponent>(CEntMan.GetEntity(target.Value));
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
@@ -454,7 +484,7 @@ public abstract partial class InteractionTest
|
||||
});
|
||||
}
|
||||
|
||||
protected void AssertDeleted(bool deleted = true, EntityUid? target = null)
|
||||
protected void AssertDeleted(bool deleted = true, NetEntity? target = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
@@ -465,15 +495,15 @@ public abstract partial class InteractionTest
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(SEntMan.Deleted(target), Is.EqualTo(deleted));
|
||||
Assert.That(CEntMan.Deleted(target), Is.EqualTo(deleted));
|
||||
Assert.That(SEntMan.Deleted(SEntMan.GetEntity(target)), Is.EqualTo(deleted));
|
||||
Assert.That(CEntMan.Deleted(CEntMan.GetEntity(target)), Is.EqualTo(deleted));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Assert whether or not the target has the given component.
|
||||
/// </summary>
|
||||
protected void AssertComp<T>(bool hasComp = true, EntityUid? target = null)
|
||||
protected void AssertComp<T>(bool hasComp = true, NetEntity? target = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
@@ -482,24 +512,25 @@ public abstract partial class InteractionTest
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.That(SEntMan.HasComponent<T>(target), Is.EqualTo(hasComp));
|
||||
Assert.That(SEntMan.HasComponent<T>(SEntMan.GetEntity(target)), Is.EqualTo(hasComp));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check that the tile at the target position matches some prototype.
|
||||
/// </summary>
|
||||
protected async Task AssertTile(string? proto, EntityCoordinates? coords = null)
|
||||
protected async Task AssertTile(string? proto, NetCoordinates? coords = null)
|
||||
{
|
||||
var targetTile = proto == null
|
||||
? Tile.Empty
|
||||
: new Tile(TileMan[proto].TileId);
|
||||
|
||||
var tile = Tile.Empty;
|
||||
var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
|
||||
var serverCoords = SEntMan.GetCoordinates(coords ?? TargetCoords);
|
||||
var pos = serverCoords.ToMap(SEntMan, Transform);
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
if (MapMan.TryFindGridAt(pos, out _, out var grid))
|
||||
tile = grid.GetTileRef(coords ?? TargetCoords).Tile;
|
||||
tile = grid.GetTileRef(serverCoords).Tile;
|
||||
});
|
||||
|
||||
Assert.That(tile.TypeId, Is.EqualTo(targetTile.TypeId));
|
||||
@@ -541,11 +572,12 @@ public abstract partial class InteractionTest
|
||||
foreach (var ent in entities)
|
||||
{
|
||||
var transform = xformQuery.GetComponent(ent);
|
||||
var netEnt = SEntMan.GetNetEntity(ent);
|
||||
|
||||
if (ent == transform.MapUid
|
||||
|| ent == transform.GridUid
|
||||
|| ent == Player
|
||||
|| ent == Target)
|
||||
|| netEnt == Player
|
||||
|| netEnt == Target)
|
||||
{
|
||||
toRemove.Add(ent);
|
||||
}
|
||||
@@ -646,31 +678,31 @@ public abstract partial class InteractionTest
|
||||
/// <summary>
|
||||
/// Convenience method to get components on the target. Returns SERVER-SIDE components.
|
||||
/// </summary>
|
||||
protected T Comp<T>(EntityUid? target = null) where T : IComponent
|
||||
protected T Comp<T>(NetEntity? target = null) where T : IComponent
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
Assert.Fail("No target specified");
|
||||
|
||||
return SEntMan.GetComponent<T>(target!.Value);
|
||||
return SEntMan.GetComponent<T>(SEntMan.GetEntity(target!.Value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the tile at the target position to some prototype.
|
||||
/// </summary>
|
||||
protected async Task SetTile(string? proto, EntityCoordinates? coords = null, MapGridComponent? grid = null)
|
||||
protected async Task SetTile(string? proto, NetCoordinates? coords = null, MapGridComponent? grid = null)
|
||||
{
|
||||
var tile = proto == null
|
||||
? Tile.Empty
|
||||
: new Tile(TileMan[proto].TileId);
|
||||
|
||||
var pos = (coords ?? TargetCoords).ToMap(SEntMan, Transform);
|
||||
var pos = SEntMan.GetCoordinates(coords ?? TargetCoords).ToMap(SEntMan, Transform);
|
||||
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
if (grid != null || MapMan.TryFindGridAt(pos, out var gridUid, out grid))
|
||||
{
|
||||
grid.SetTile(coords ?? TargetCoords, tile);
|
||||
grid.SetTile(SEntMan.GetCoordinates(coords ?? TargetCoords), tile);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -681,7 +713,7 @@ public abstract partial class InteractionTest
|
||||
gridUid = grid.Owner;
|
||||
var gridXform = SEntMan.GetComponent<TransformComponent>(gridUid);
|
||||
Transform.SetWorldPosition(gridXform, pos.Position);
|
||||
grid.SetTile(coords ?? TargetCoords, tile);
|
||||
grid.SetTile(SEntMan.GetCoordinates(coords ?? TargetCoords), tile);
|
||||
|
||||
if (!MapMan.TryFindGridAt(pos, out _, out grid))
|
||||
Assert.Fail("Failed to create grid?");
|
||||
@@ -743,7 +775,7 @@ public abstract partial class InteractionTest
|
||||
await RunTicks(15);
|
||||
}
|
||||
|
||||
protected bool TryGetBui(Enum key, [NotNullWhen(true)] out BoundUserInterface? bui, EntityUid? target = null, bool shouldSucceed = true)
|
||||
protected bool TryGetBui(Enum key, [NotNullWhen(true)] out BoundUserInterface? bui, NetEntity? target = null, bool shouldSucceed = true)
|
||||
{
|
||||
bui = null;
|
||||
target ??= Target;
|
||||
@@ -753,17 +785,19 @@ public abstract partial class InteractionTest
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CEntMan.TryGetComponent<ClientUserInterfaceComponent>(target, out var ui))
|
||||
var clientTarget = CEntMan.GetEntity(target);
|
||||
|
||||
if (!CEntMan.TryGetComponent<ClientUserInterfaceComponent>(clientTarget, out var ui))
|
||||
{
|
||||
if (shouldSucceed)
|
||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have a bui component");
|
||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(SEntMan.GetEntity(target.Value))} does not have a bui component");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ui.OpenInterfaces.TryGetValue(key, out bui))
|
||||
{
|
||||
if (shouldSucceed)
|
||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(target.Value)} does not have an open bui with key {key.GetType()}.{key}.");
|
||||
Assert.Fail($"Entity {SEntMan.ToPrettyString(SEntMan.GetEntity(target.Value))} does not have an open bui with key {key.GetType()}.{key}.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -909,7 +943,7 @@ public abstract partial class InteractionTest
|
||||
|
||||
#region Power
|
||||
|
||||
protected void ToggleNeedPower(EntityUid? target = null)
|
||||
protected void ToggleNeedPower(NetEntity? target = null)
|
||||
{
|
||||
var comp = Comp<ApcPowerReceiverComponent>(target);
|
||||
comp.NeedsPower = !comp.NeedsPower;
|
||||
@@ -963,8 +997,8 @@ public abstract partial class InteractionTest
|
||||
protected async Task PressKey(
|
||||
BoundKeyFunction key,
|
||||
int ticks = 1,
|
||||
EntityCoordinates? coordinates = null,
|
||||
EntityUid cursorEntity = default)
|
||||
NetCoordinates? coordinates = null,
|
||||
NetEntity cursorEntity = default)
|
||||
{
|
||||
await SetKey(key, BoundKeyState.Down, coordinates, cursorEntity);
|
||||
await RunTicks(ticks);
|
||||
@@ -978,15 +1012,20 @@ public abstract partial class InteractionTest
|
||||
protected async Task SetKey(
|
||||
BoundKeyFunction key,
|
||||
BoundKeyState state,
|
||||
EntityCoordinates? coordinates = null,
|
||||
EntityUid cursorEntity = default)
|
||||
NetCoordinates? coordinates = null,
|
||||
NetEntity cursorEntity = default)
|
||||
{
|
||||
var coords = coordinates ?? TargetCoords;
|
||||
ScreenCoordinates screen = default;
|
||||
|
||||
var funcId = InputManager.NetworkBindMap.KeyFunctionID(key);
|
||||
var message = new FullInputCmdMessage(CTiming.CurTick, CTiming.TickFraction, funcId, state,
|
||||
coords, screen, cursorEntity);
|
||||
var message = new ClientFullInputCmdMessage(CTiming.CurTick, CTiming.TickFraction, funcId)
|
||||
{
|
||||
State = state,
|
||||
Coordinates = CEntMan.GetCoordinates(coords),
|
||||
ScreenCoordinates = screen,
|
||||
Uid = CEntMan.GetEntity(cursorEntity),
|
||||
};
|
||||
|
||||
await Client.WaitPost(() => InputSystem.HandleInputCommand(ClientSession, key, message));
|
||||
}
|
||||
|
||||
@@ -53,22 +53,24 @@ public abstract partial class InteractionTest
|
||||
/// Target coordinates. Note that this does not necessarily correspond to the position of the <see cref="Target"/>
|
||||
/// entity.
|
||||
/// </summary>
|
||||
protected EntityCoordinates TargetCoords;
|
||||
protected NetCoordinates TargetCoords;
|
||||
|
||||
/// <summary>
|
||||
/// Initial player coordinates. Note that this does not necessarily correspond to the position of the
|
||||
/// <see cref="Player"/> entity.
|
||||
/// </summary>
|
||||
protected EntityCoordinates PlayerCoords;
|
||||
protected NetCoordinates PlayerCoords;
|
||||
|
||||
/// <summary>
|
||||
/// The player entity that performs all these interactions. Defaults to an admin-observer with 1 hand.
|
||||
/// </summary>
|
||||
protected EntityUid Player;
|
||||
protected NetEntity Player;
|
||||
|
||||
protected ICommonSession ClientSession = default!;
|
||||
protected IPlayerSession ServerSession = default!;
|
||||
|
||||
public EntityUid? ClientTarget;
|
||||
|
||||
/// <summary>
|
||||
/// The current target entity. This is the default entity for various helper functions.
|
||||
/// </summary>
|
||||
@@ -77,7 +79,7 @@ public abstract partial class InteractionTest
|
||||
/// interactions often swap out entities, and there are helper methods that attempt to automatically upddate
|
||||
/// the target entity. See <see cref="CheckTargetChange"/>
|
||||
/// </remarks>
|
||||
protected EntityUid? Target;
|
||||
protected NetEntity? Target;
|
||||
|
||||
/// <summary>
|
||||
/// When attempting to start construction, this is the client-side ID of the construction ghost.
|
||||
@@ -174,8 +176,8 @@ public abstract partial class InteractionTest
|
||||
|
||||
// Setup map.
|
||||
await Pair.CreateTestMap();
|
||||
PlayerCoords = MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
TargetCoords = MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan);
|
||||
PlayerCoords = SEntMan.GetNetCoordinates(MapData.GridCoords.Offset(new Vector2(0.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan));
|
||||
TargetCoords = SEntMan.GetNetCoordinates(MapData.GridCoords.Offset(new Vector2(1.5f, 0.5f)).WithEntityId(MapData.MapUid, Transform, SEntMan));
|
||||
await SetTile(Plating, grid: MapData.MapGrid);
|
||||
|
||||
// Get player data
|
||||
@@ -195,15 +197,16 @@ public abstract partial class InteractionTest
|
||||
SEntMan.System<SharedMindSystem>().WipeMind(ServerSession.ContentData()?.Mind);
|
||||
|
||||
old = cPlayerMan.LocalPlayer.ControlledEntity;
|
||||
Player = SEntMan.SpawnEntity(PlayerPrototype, PlayerCoords);
|
||||
Actor.Attach(Player, ServerSession);
|
||||
Hands = SEntMan.GetComponent<HandsComponent>(Player);
|
||||
DoAfters = SEntMan.GetComponent<DoAfterComponent>(Player);
|
||||
Player = SEntMan.GetNetEntity(SEntMan.SpawnEntity(PlayerPrototype, SEntMan.GetCoordinates(PlayerCoords)));
|
||||
var serverPlayerEnt = SEntMan.GetEntity(Player);
|
||||
Actor.Attach(serverPlayerEnt, ServerSession);
|
||||
Hands = SEntMan.GetComponent<HandsComponent>(serverPlayerEnt);
|
||||
DoAfters = SEntMan.GetComponent<DoAfterComponent>(serverPlayerEnt);
|
||||
});
|
||||
|
||||
// Check player got attached.
|
||||
await RunTicks(5);
|
||||
Assert.That(cPlayerMan.LocalPlayer.ControlledEntity, Is.EqualTo(Player));
|
||||
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
|
||||
|
||||
// Delete old player entity.
|
||||
await Server.WaitPost(() =>
|
||||
@@ -216,7 +219,7 @@ public abstract partial class InteractionTest
|
||||
await Server.WaitPost(() =>
|
||||
{
|
||||
var bodySystem = SEntMan.System<BodySystem>();
|
||||
var hands = bodySystem.GetBodyChildrenOfType(Player, BodyPartType.Hand).ToArray();
|
||||
var hands = bodySystem.GetBodyChildrenOfType(SEntMan.GetEntity(Player), BodyPartType.Hand).ToArray();
|
||||
|
||||
for (var i = 1; i < hands.Length; i++)
|
||||
{
|
||||
@@ -229,8 +232,8 @@ public abstract partial class InteractionTest
|
||||
await Pair.ReallyBeIdle(5);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(cPlayerMan.LocalPlayer.ControlledEntity, Is.EqualTo(Player));
|
||||
Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(Player));
|
||||
Assert.That(CEntMan.GetNetEntity(cPlayerMan.LocalPlayer.ControlledEntity), Is.EqualTo(Player));
|
||||
Assert.That(sPlayerMan.GetSessionByUserId(ClientSession.UserId).AttachedEntity, Is.EqualTo(SEntMan.GetEntity(Player)));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Content.IntegrationTests.Tests.Interaction;
|
||||
/// </summary>
|
||||
public sealed class InteractionTestSystem : EntitySystem
|
||||
{
|
||||
public Dictionary<int, EntityUid> Ghosts = new();
|
||||
public Dictionary<EntityUid, EntityUid> EntChanges = new();
|
||||
public Dictionary<int, NetEntity> Ghosts = new();
|
||||
public Dictionary<NetEntity, NetEntity> EntChanges = new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -23,7 +23,8 @@ public sealed class InteractionTestSystem : EntitySystem
|
||||
|
||||
private void OnEntChange(ConstructionChangeEntityEvent ev)
|
||||
{
|
||||
EntChanges[ev.Old] = ev.New;
|
||||
Assert.That(!IsClientSide(ev.Old) && !IsClientSide(ev.New));
|
||||
EntChanges[GetNetEntity(ev.Old)] = GetNetEntity(ev.New);
|
||||
}
|
||||
|
||||
private void OnAck(AckStructureConstructionMessage ev)
|
||||
|
||||
@@ -27,16 +27,18 @@ public abstract class MovementTest : InteractionTest
|
||||
public override async Task Setup()
|
||||
{
|
||||
await base.Setup();
|
||||
var pCoords = SEntMan.GetCoordinates(PlayerCoords);
|
||||
|
||||
for (var i = -Tiles; i <= Tiles; i++)
|
||||
{
|
||||
await SetTile(Plating, PlayerCoords.Offset(new Vector2(i, 0)), MapData.MapGrid);
|
||||
await SetTile(Plating, SEntMan.GetNetCoordinates(pCoords.Offset(new Vector2(i, 0))), MapData.MapGrid);
|
||||
}
|
||||
AssertGridCount(1);
|
||||
|
||||
if (AddWalls)
|
||||
{
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(-Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", PlayerCoords.Offset(new Vector2(Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", pCoords.Offset(new Vector2(-Tiles, 0)));
|
||||
await SpawnEntity("WallSolid", pCoords.Offset(new Vector2(Tiles, 0)));
|
||||
}
|
||||
|
||||
await AddGravity();
|
||||
@@ -46,7 +48,7 @@ public abstract class MovementTest : InteractionTest
|
||||
/// <summary>
|
||||
/// Get the relative horizontal between two entities. Defaults to using the target & player entity.
|
||||
/// </summary>
|
||||
protected float Delta(EntityUid? target = null, EntityUid? other = null)
|
||||
protected float Delta(NetEntity? target = null, NetEntity? other = null)
|
||||
{
|
||||
target ??= Target;
|
||||
if (target == null)
|
||||
@@ -55,7 +57,7 @@ public abstract class MovementTest : InteractionTest
|
||||
return 0;
|
||||
}
|
||||
|
||||
var delta = Transform.GetWorldPosition(target.Value) - Transform.GetWorldPosition(other ?? Player);
|
||||
var delta = Transform.GetWorldPosition(SEntMan.GetEntity(target.Value)) - Transform.GetWorldPosition(SEntMan.GetEntity(other ?? Player));
|
||||
return delta.X;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
clientComponent = cEntityManager.GetComponent<PredictionTestComponent>(serverEnt);
|
||||
clientComponent = cEntityManager.GetComponent<PredictionTestComponent>(cEntityManager.GetEntity(sEntityManager.GetNetEntity(serverEnt)));
|
||||
});
|
||||
|
||||
var baseTick = sGameTiming.CurTick.Value;
|
||||
@@ -110,7 +110,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), true));
|
||||
});
|
||||
Assert.That(clientComponent.Foo, Is.True);
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send event to server to change flag again, this time to disable it..
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), false));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
});
|
||||
@@ -270,7 +270,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send first event to disable the flag (reminder: it never got accepted by the server).
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, false));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), false));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.False);
|
||||
});
|
||||
@@ -298,7 +298,7 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
// Send another event, to re-enable it.
|
||||
await client.WaitPost(() =>
|
||||
{
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(serverEnt, true));
|
||||
cEntityManager.RaisePredictiveEvent(new SetFooMessage(sEntityManager.GetNetEntity(serverEnt), true));
|
||||
|
||||
Assert.That(clientComponent.Foo, Is.True);
|
||||
});
|
||||
@@ -406,12 +406,14 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
private void HandleMessage(SetFooMessage message, EntitySessionEventArgs args)
|
||||
{
|
||||
var component = EntityManager.GetComponent<PredictionTestComponent>(message.Uid);
|
||||
var uid = GetEntity(message.Uid);
|
||||
|
||||
var component = EntityManager.GetComponent<PredictionTestComponent>(uid);
|
||||
var old = component.Foo;
|
||||
if (Allow)
|
||||
{
|
||||
component.Foo = message.NewFoo;
|
||||
Dirty(message.Uid, component);
|
||||
Dirty(uid, component);
|
||||
}
|
||||
|
||||
EventTriggerList.Add((_gameTiming.CurTick, _gameTiming.IsFirstTimePredicted, old, component.Foo, message.NewFoo));
|
||||
@@ -420,13 +422,13 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
public sealed class SetFooMessage : EntityEventArgs
|
||||
{
|
||||
public SetFooMessage(EntityUid uid, bool newFoo)
|
||||
public SetFooMessage(NetEntity uid, bool newFoo)
|
||||
{
|
||||
Uid = uid;
|
||||
NewFoo = newFoo;
|
||||
}
|
||||
|
||||
public EntityUid Uid { get; }
|
||||
public NetEntity Uid { get; }
|
||||
public bool NewFoo { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public sealed class ModularGrenadeTests : InteractionTest
|
||||
{
|
||||
await PlaceInHands(Steel, 5);
|
||||
await CraftItem("ModularGrenadeRecipe");
|
||||
Target = await FindEntity("ModularGrenade");
|
||||
Target = SEntMan.GetNetEntity(await FindEntity("ModularGrenade"));
|
||||
|
||||
await Drop();
|
||||
await Interact(Cable);
|
||||
|
||||
@@ -34,7 +34,7 @@ public sealed class SlippingTest : MovementTest
|
||||
// Player is to the left of the banana peel and has not slipped.
|
||||
#pragma warning disable NUnit2045
|
||||
Assert.That(Delta(), Is.GreaterThan(0.5f));
|
||||
Assert.That(sys.Slipped, Does.Not.Contain(Player));
|
||||
Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
|
||||
#pragma warning restore NUnit2045
|
||||
|
||||
// Walking over the banana slowly does not trigger a slip.
|
||||
@@ -42,14 +42,14 @@ public sealed class SlippingTest : MovementTest
|
||||
await Move(DirectionFlag.East, 1f);
|
||||
#pragma warning disable NUnit2045
|
||||
Assert.That(Delta(), Is.LessThan(0.5f));
|
||||
Assert.That(sys.Slipped, Does.Not.Contain(Player));
|
||||
Assert.That(sys.Slipped, Does.Not.Contain(SEntMan.GetEntity(Player)));
|
||||
#pragma warning restore NUnit2045
|
||||
AssertComp<KnockedDownComponent>(false, Player);
|
||||
|
||||
// Moving at normal speeds does trigger a slip.
|
||||
await SetKey(EngineKeyFunctions.Walk, BoundKeyState.Up);
|
||||
await Move(DirectionFlag.West, 1f);
|
||||
Assert.That(sys.Slipped, Does.Contain(Player));
|
||||
Assert.That(sys.Slipped, Does.Contain(SEntMan.GetEntity(Player)));
|
||||
AssertComp<KnockedDownComponent>(true, Player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public sealed class TileConstructionTests : InteractionTest
|
||||
|
||||
// Place Lattice
|
||||
var oldPos = TargetCoords;
|
||||
TargetCoords = new EntityCoordinates(MapData.MapUid, 1, 0);
|
||||
TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
|
||||
await Interact(Rod);
|
||||
TargetCoords = oldPos;
|
||||
await AssertTile(Lattice);
|
||||
@@ -75,7 +75,7 @@ public sealed class TileConstructionTests : InteractionTest
|
||||
|
||||
// Space -> Lattice
|
||||
var oldPos = TargetCoords;
|
||||
TargetCoords = new EntityCoordinates(MapData.MapUid, 1, 0);
|
||||
TargetCoords = SEntMan.GetNetCoordinates(new EntityCoordinates(MapData.MapUid, 1, 0));
|
||||
await Interact(Rod);
|
||||
TargetCoords = oldPos;
|
||||
await AssertTile(Lattice);
|
||||
|
||||
Reference in New Issue
Block a user