Fix test threading (#31669)
This commit is contained in:
@@ -32,11 +32,16 @@ public sealed class ActionPvsDetachTest
|
|||||||
// PVS-detach action entities
|
// PVS-detach action entities
|
||||||
// We do this by just giving them the ghost layer
|
// We do this by just giving them the ghost layer
|
||||||
var visSys = server.System<VisibilitySystem>();
|
var visSys = server.System<VisibilitySystem>();
|
||||||
|
|
||||||
|
await server.WaitPost(() =>
|
||||||
|
{
|
||||||
var enumerator = server.Transform(ent).ChildEnumerator;
|
var enumerator = server.Transform(ent).ChildEnumerator;
|
||||||
while (enumerator.MoveNext(out var child))
|
while (enumerator.MoveNext(out var child))
|
||||||
{
|
{
|
||||||
visSys.AddLayer(child, (int)VisibilityFlags.Ghost);
|
visSys.AddLayer(child, (int)VisibilityFlags.Ghost);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
await pair.RunTicksSync(5);
|
await pair.RunTicksSync(5);
|
||||||
|
|
||||||
// Client's actions have left been detached / are out of view, but action comp state has not changed
|
// Client's actions have left been detached / are out of view, but action comp state has not changed
|
||||||
@@ -44,11 +49,14 @@ public sealed class ActionPvsDetachTest
|
|||||||
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
||||||
|
|
||||||
// Re-enter PVS view
|
// Re-enter PVS view
|
||||||
enumerator = server.Transform(ent).ChildEnumerator;
|
await server.WaitPost(() =>
|
||||||
|
{
|
||||||
|
var enumerator = server.Transform(ent).ChildEnumerator;
|
||||||
while (enumerator.MoveNext(out var child))
|
while (enumerator.MoveNext(out var child))
|
||||||
{
|
{
|
||||||
visSys.RemoveLayer(child, (int) VisibilityFlags.Ghost);
|
visSys.RemoveLayer(child, (int) VisibilityFlags.Ghost);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
await pair.RunTicksSync(5);
|
await pair.RunTicksSync(5);
|
||||||
Assert.That(sys.GetActions(ent).Count(), Is.EqualTo(initActions));
|
Assert.That(sys.GetActions(ent).Count(), Is.EqualTo(initActions));
|
||||||
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
Assert.That(cSys.GetActions(cEnt).Count(), Is.EqualTo(initActions));
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ public sealed class BuckleDragTest : InteractionTest
|
|||||||
Assert.That(pullable.BeingPulled, Is.False);
|
Assert.That(pullable.BeingPulled, Is.False);
|
||||||
|
|
||||||
// Strap the human to the chair
|
// Strap the human to the chair
|
||||||
|
await Server.WaitAssertion(() =>
|
||||||
|
{
|
||||||
Assert.That(Server.System<SharedBuckleSystem>().TryBuckle(sUrist, SPlayer, STarget.Value));
|
Assert.That(Server.System<SharedBuckleSystem>().TryBuckle(sUrist, SPlayer, STarget.Value));
|
||||||
|
});
|
||||||
|
|
||||||
await RunTicks(5);
|
await RunTicks(5);
|
||||||
Assert.That(buckle.Buckled, Is.True);
|
Assert.That(buckle.Buckled, Is.True);
|
||||||
Assert.That(buckle.BuckledTo, Is.EqualTo(STarget));
|
Assert.That(buckle.BuckledTo, Is.EqualTo(STarget));
|
||||||
|
|||||||
@@ -257,9 +257,12 @@ public sealed class CargoTest
|
|||||||
var entManager = server.ResolveDependency<IEntityManager>();
|
var entManager = server.ResolveDependency<IEntityManager>();
|
||||||
var priceSystem = entManager.System<PricingSystem>();
|
var priceSystem = entManager.System<PricingSystem>();
|
||||||
|
|
||||||
|
await server.WaitAssertion(() =>
|
||||||
|
{
|
||||||
var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace);
|
var ent = entManager.SpawnEntity("StackEnt", MapCoordinates.Nullspace);
|
||||||
var price = priceSystem.GetPrice(ent);
|
var price = priceSystem.GetPrice(ent);
|
||||||
Assert.That(price, Is.EqualTo(100.0));
|
Assert.That(price, Is.EqualTo(100.0));
|
||||||
|
});
|
||||||
|
|
||||||
await pair.CleanReturnAsync();
|
await pair.CleanReturnAsync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,10 +143,10 @@ public sealed class SuicideCommandTests
|
|||||||
mobStateComp = entManager.GetComponent<MobStateComponent>(player);
|
mobStateComp = entManager.GetComponent<MobStateComponent>(player);
|
||||||
mobThresholdsComp = entManager.GetComponent<MobThresholdsComponent>(player);
|
mobThresholdsComp = entManager.GetComponent<MobThresholdsComponent>(player);
|
||||||
damageableComp = entManager.GetComponent<DamageableComponent>(player);
|
damageableComp = entManager.GetComponent<DamageableComponent>(player);
|
||||||
});
|
|
||||||
|
|
||||||
if (protoMan.TryIndex<DamageTypePrototype>("Slash", out var slashProto))
|
if (protoMan.TryIndex<DamageTypePrototype>("Slash", out var slashProto))
|
||||||
damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5)));
|
damageableSystem.TryChangeDamage(player, new DamageSpecifier(slashProto, FixedPoint2.New(46.5)));
|
||||||
|
});
|
||||||
|
|
||||||
// Check that running the suicide command kills the player
|
// Check that running the suicide command kills the player
|
||||||
// and properly ghosts them without them being able to return to their body
|
// and properly ghosts them without them being able to return to their body
|
||||||
|
|||||||
@@ -97,13 +97,14 @@ public sealed class DockTest : ContentUnitTest
|
|||||||
var entManager = server.ResolveDependency<IEntityManager>();
|
var entManager = server.ResolveDependency<IEntityManager>();
|
||||||
var dockingSystem = entManager.System<DockingSystem>();
|
var dockingSystem = entManager.System<DockingSystem>();
|
||||||
var mapSystem = entManager.System<SharedMapSystem>();
|
var mapSystem = entManager.System<SharedMapSystem>();
|
||||||
|
MapGridComponent mapGrid = default!;
|
||||||
|
|
||||||
var mapGrid = entManager.AddComponent<MapGridComponent>(map.MapUid);
|
|
||||||
var shuttle = EntityUid.Invalid;
|
var shuttle = EntityUid.Invalid;
|
||||||
|
|
||||||
// Spawn shuttle and affirm no valid docks.
|
// Spawn shuttle and affirm no valid docks.
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
|
mapGrid = entManager.AddComponent<MapGridComponent>(map.MapUid);
|
||||||
entManager.DeleteEntity(map.Grid);
|
entManager.DeleteEntity(map.Grid);
|
||||||
Assert.That(entManager.System<MapLoaderSystem>().TryLoad(otherMap.MapId, "/Maps/Shuttles/emergency.yml", out var rootUids));
|
Assert.That(entManager.System<MapLoaderSystem>().TryLoad(otherMap.MapId, "/Maps/Shuttles/emergency.yml", out var rootUids));
|
||||||
shuttle = rootUids[0];
|
shuttle = rootUids[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user