Don't predict body init (#12163)

* Don't predict body init

Client doesn't handle predicted entity spawning so the organs hang around.

* Just use init

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2022-10-25 11:08:41 +11:00
committed by GitHub
parent 92e92dceb0
commit 70cf361caa
4 changed files with 27 additions and 28 deletions

View File

@@ -6,7 +6,9 @@ using Content.Server.Kitchen.Components;
using Content.Server.Mind.Components;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Body.Prototypes;
using Content.Shared.Body.Systems;
using Content.Shared.Coordinates;
using Content.Shared.Humanoid;
using Content.Shared.MobState.Components;
using Content.Shared.Movement.Events;
@@ -113,6 +115,21 @@ public sealed class BodySystem : SharedBodySystem
return true;
}
protected override void InitBody(BodyComponent body, BodyPrototype prototype)
{
var root = prototype.Slots[prototype.Root];
var bodyId = Spawn(root.Part, body.Owner.ToCoordinates());
var partComponent = Comp<BodyPartComponent>(bodyId);
var slot = new BodyPartSlot(root.Part, body.Owner, partComponent.PartType);
body.Root = slot;
partComponent.Body = bodyId;
Containers.EnsureContainer<Container>(body.Owner, BodyContainerId);
AttachPart(bodyId, slot, partComponent);
InitPart(partComponent, prototype, prototype.Root);
}
public override HashSet<EntityUid> GibBody(EntityUid? bodyId, bool gibOrgans = false, BodyComponent? body = null)
{
if (bodyId == null || !Resolve(bodyId.Value, ref body, false))