Try fix organ networking (#23034)

This commit is contained in:
Leon Friedrich
2023-12-27 17:48:10 -05:00
committed by GitHub
parent 1c8eb2f3de
commit 0734a876f9
3 changed files with 84 additions and 52 deletions

View File

@@ -0,0 +1,43 @@
#nullable enable
using Content.Server.Body.Systems;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Body;
[TestFixture]
public sealed class GibTest
{
[Test]
public async Task TestGib()
{
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
var (server, client) = (pair.Server, pair.Client);
var map = await pair.CreateTestMap();
EntityUid target1 = default;
EntityUid target2 = default;
await server.WaitAssertion(() => target1 = server.EntMan.Spawn("MobHuman", map.MapCoords));
await server.WaitAssertion(() => target2 = server.EntMan.Spawn("MobHuman", map.MapCoords));
await pair.WaitCommand($"setoutfit {server.EntMan.GetNetEntity(target1)} CaptainGear");
await pair.WaitCommand($"setoutfit {server.EntMan.GetNetEntity(target2)} CaptainGear");
await pair.RunTicksSync(5);
var nuid1 = pair.ToClientUid(target1);
var nuid2 = pair.ToClientUid(target2);
Assert.That(client.EntMan.EntityExists(nuid1));
Assert.That(client.EntMan.EntityExists(nuid2));
await server.WaitAssertion(() => server.System<BodySystem>().GibBody(target1, gibOrgans: false));
await server.WaitAssertion(() => server.System<BodySystem>().GibBody(target2, gibOrgans: true));
await pair.RunTicksSync(5);
await pair.WaitCommand("dirty");
await pair.RunTicksSync(5);
Assert.That(!client.EntMan.EntityExists(nuid1));
Assert.That(!client.EntMan.EntityExists(nuid2));
await pair.CleanReturnAsync();
}
}