* Fix tests

* Fix test fail

* Apply same fix to other tests
This commit is contained in:
DrSmugleaf
2024-05-05 19:08:56 -07:00
committed by GitHub
parent c20df3e39f
commit eee8e03c15
4 changed files with 63 additions and 40 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Stacks;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using static Robust.UnitTesting.RobustIntegrationTest;
namespace Content.IntegrationTests.Tests.Interaction;
@@ -111,7 +112,7 @@ public abstract partial class InteractionTest
/// <summary>
/// Convert applicable entity prototypes into stack prototypes.
/// </summary>
public void ConvertToStacks(IPrototypeManager protoMan, IComponentFactory factory)
public async Task ConvertToStacks(IPrototypeManager protoMan, IComponentFactory factory, ServerIntegrationInstance server)
{
if (Converted)
return;
@@ -130,14 +131,17 @@ public abstract partial class InteractionTest
continue;
}
if (!entProto.TryGetComponent<StackComponent>(factory.GetComponentName(typeof(StackComponent)),
out var stackComp))
StackComponent? stack = null;
await server.WaitPost(() =>
{
entProto.TryGetComponent(factory.GetComponentName(typeof(StackComponent)), out stack);
});
if (stack == null)
continue;
}
toRemove.Add(id);
toAdd.Add((stackComp.StackTypeId, quantity));
toAdd.Add((stack.StackTypeId, quantity));
}
foreach (var id in toRemove)