Add missing CleanReturnAsync() to some tests. (#18471)
This commit is contained in:
@@ -157,7 +157,11 @@ public sealed class SaveLoadReparentTest
|
||||
Assert.That(component.ParentSlot.Child, Is.EqualTo(id));
|
||||
});
|
||||
}
|
||||
|
||||
maps.DeleteMap(mapId);
|
||||
}
|
||||
});
|
||||
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,7 @@ public sealed class LogErrorTest
|
||||
// But errors do
|
||||
await server.WaitPost(() => Assert.Throws<AssertionException>(() => logmill.Error("test")));
|
||||
await client.WaitPost(() => Assert.Throws<AssertionException>(() => logmill.Error("test")));
|
||||
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ namespace Content.IntegrationTests.Tests.Networking
|
||||
|
||||
Assert.That(clEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates,
|
||||
Is.EqualTo(svEntityManager.GetComponent<TransformComponent>(lastSvEntity).Coordinates));
|
||||
|
||||
await pairTracker.CleanReturnAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using Content.Server.GameTicking;
|
||||
using Content.Server.Humanoid;
|
||||
using Content.Server.Kitchen.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Body.Organ;
|
||||
using Content.Shared.Body.Part;
|
||||
using Content.Shared.Body.Prototypes;
|
||||
using Content.Shared.Body.Systems;
|
||||
@@ -36,11 +36,74 @@ public sealed class BodySystem : SharedBodySystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<BodyPartComponent, ComponentStartup>(OnPartStartup);
|
||||
SubscribeLocalEvent<BodyComponent, ComponentStartup>(OnBodyStartup);
|
||||
SubscribeLocalEvent<BodyComponent, MoveInputEvent>(OnRelayMoveInput);
|
||||
SubscribeLocalEvent<BodyComponent, ApplyMetabolicMultiplierEvent>(OnApplyMetabolicMultiplier);
|
||||
SubscribeLocalEvent<BodyComponent, BeingMicrowavedEvent>(OnBeingMicrowaved);
|
||||
}
|
||||
|
||||
private void OnPartStartup(EntityUid uid, BodyPartComponent component, ComponentStartup args)
|
||||
{
|
||||
// This inter-entity relationship makes be deeply uncomfortable because its probably going to re-encounter
|
||||
// all of the networking & startup ordering issues that containers and joints have.
|
||||
// TODO just use containers. Please.
|
||||
|
||||
foreach (var slot in component.Children.Values)
|
||||
{
|
||||
DebugTools.Assert(slot.Parent == uid);
|
||||
if (slot.Child == null)
|
||||
continue;
|
||||
|
||||
if (TryComp(slot.Child, out BodyPartComponent? child))
|
||||
{
|
||||
child.ParentSlot = slot;
|
||||
Dirty(slot.Child.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.Error($"Body part encountered missing limbs: {ToPrettyString(uid)}. Slot: {slot.Id}");
|
||||
slot.Child = null;
|
||||
}
|
||||
|
||||
foreach (var slot in component.Organs.Values)
|
||||
{
|
||||
DebugTools.Assert(slot.Parent == uid);
|
||||
if (slot.Child == null)
|
||||
continue;
|
||||
|
||||
if (TryComp(slot.Child, out OrganComponent? child))
|
||||
{
|
||||
child.ParentSlot = slot;
|
||||
Dirty(slot.Child.Value);
|
||||
continue;
|
||||
}
|
||||
|
||||
Log.Error($"Body part encountered missing organ: {ToPrettyString(uid)}. Slot: {slot.Id}");
|
||||
slot.Child = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnBodyStartup(EntityUid uid, BodyComponent component, ComponentStartup args)
|
||||
{
|
||||
if (component.Root is not { } slot)
|
||||
return;
|
||||
|
||||
DebugTools.Assert(slot.Parent == uid);
|
||||
if (slot.Child == null)
|
||||
return;
|
||||
|
||||
if (!TryComp(slot.Child, out BodyPartComponent? child))
|
||||
{
|
||||
Log.Error($"Body part encountered missing limbs: {ToPrettyString(uid)}. Slot: {slot.Id}");
|
||||
slot.Child = null;
|
||||
return;
|
||||
}
|
||||
|
||||
child.ParentSlot = slot;
|
||||
Dirty(slot.Child.Value);
|
||||
}
|
||||
|
||||
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, ref MoveInputEvent args)
|
||||
{
|
||||
if (_mobState.IsDead(uid) && _mindSystem.TryGetMind(uid, out var mind))
|
||||
|
||||
@@ -10,6 +10,7 @@ public sealed class OrganComponent : Component
|
||||
[DataField("body")]
|
||||
public EntityUid? Body;
|
||||
|
||||
[DataField("parent")]
|
||||
// TODO use containers. See comments in BodyPartComponent.
|
||||
// Do not rely on this in client-side code.
|
||||
public OrganSlot? ParentSlot;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,17 @@ public sealed class BodyPartComponent : Component
|
||||
[DataField("body")]
|
||||
public EntityUid? Body;
|
||||
|
||||
[DataField("parent")]
|
||||
// This inter-entity relationship makes be deeply uncomfortable because its probably going to re-encounter all of the
|
||||
// networking issues that containers and joints have.
|
||||
// TODO just use containers. Please.
|
||||
// Do not use set or get data from this in client-side code.
|
||||
public BodyPartSlot? ParentSlot;
|
||||
|
||||
// Do not use set or get data from this in client-side code.
|
||||
[DataField("children")]
|
||||
public Dictionary<string, BodyPartSlot> Children = new();
|
||||
|
||||
// See all the above ccomments.
|
||||
[DataField("organs")]
|
||||
public Dictionary<string, OrganSlot> Organs = new();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public partial class SharedBodySystem
|
||||
if (args.Current is not BodyComponentState state)
|
||||
return;
|
||||
|
||||
body.Root = state.Root;
|
||||
body.Root = state.Root; // TODO use containers. This is broken and does not work.
|
||||
body.GibSound = state.GibSound;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ public partial class SharedBodySystem
|
||||
return;
|
||||
|
||||
part.Body = state.Body;
|
||||
part.ParentSlot = state.ParentSlot;
|
||||
part.Children = state.Children;
|
||||
part.Organs = state.Organs;
|
||||
part.ParentSlot = state.ParentSlot; // TODO use containers. This is broken and does not work.
|
||||
part.Children = state.Children; // TODO use containers. This is broken and does not work.
|
||||
part.Organs = state.Organs; // TODO end my suffering.
|
||||
part.PartType = state.PartType;
|
||||
part.IsVital = state.IsVital;
|
||||
part.Symmetry = state.Symmetry;
|
||||
|
||||
Reference in New Issue
Block a user