Content update for NetEntities (#18935)
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user