ECS and cleanup body system, merge body templates and presets into body prototypes (#11991)

Co-authored-by: Jezithyr <Jezithyr@gmail.com>
This commit is contained in:
DrSmugleaf
2022-10-23 00:46:28 +02:00
committed by GitHub
parent 9a38736c3c
commit f323fb7644
140 changed files with 2478 additions and 2571 deletions

View File

@@ -1,22 +1,22 @@
using System.Linq;
using Content.Server.Body.Systems;
using Content.Server.Chemistry.Components.SolutionManager;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Construction;
using Content.Server.Kitchen.Components;
using Content.Shared.Destructible;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Kitchen.Components;
using Robust.Shared.Player;
using Content.Shared.Interaction.Events;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Server.Hands.Systems;
using Content.Server.Kitchen.Components;
using Content.Server.Power.Components;
using Content.Server.Temperature.Components;
using Content.Server.Temperature.Systems;
using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Destructible;
using Content.Shared.FixedPoint;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Kitchen;
using Content.Shared.Kitchen.Components;
using Content.Shared.Popups;
using Content.Shared.Power;
using Content.Shared.Tag;
@@ -24,11 +24,13 @@ using Robust.Server.Containers;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Player;
namespace Content.Server.Kitchen.EntitySystems
{
public sealed class MicrowaveSystem : EntitySystem
{
[Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly ContainerSystem _container = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly RecipeManager _recipeManager = default!;
@@ -182,29 +184,19 @@ namespace Content.Server.Kitchen.EntitySystems
var victim = args.Victim;
var headCount = 0;
if (TryComp<SharedBodyComponent>(victim, out var body))
if (TryComp<BodyComponent>(victim, out var body))
{
var headSlots = body.GetSlotsOfType(BodyPartType.Head);
var headSlots = _bodySystem.GetBodyChildrenOfType(victim, BodyPartType.Head, body);
foreach (var slot in headSlots)
foreach (var part in headSlots)
{
var part = slot.Part;
if (part == null ||
!body.TryDropPart(slot, out var dropped))
if (!_bodySystem.OrphanPart(part.Id, part.Component))
{
continue;
}
foreach (var droppedPart in dropped.Values)
{
if (droppedPart.PartType != BodyPartType.Head)
{
continue;
}
component.Storage.Insert(droppedPart.Owner);
headCount++;
}
component.Storage.Insert(part.Id);
headCount++;
}
}

View File

@@ -1,4 +1,5 @@
using Content.Server.DoAfter;
using Content.Server.Body.Systems;
using Content.Server.DoAfter;
using Content.Server.Kitchen.Components;
using Content.Server.MobState;
using Content.Shared.Body.Components;
@@ -16,6 +17,7 @@ namespace Content.Server.Kitchen.EntitySystems;
public sealed class SharpSystem : EntitySystem
{
[Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!;
@@ -95,7 +97,7 @@ public sealed class SharpSystem : EntitySystem
popupEnt = Spawn(proto, coords.Offset(_robustRandom.NextVector2(0.25f)));
}
var hasBody = TryComp<SharedBodyComponent>(ev.Entity, out var body);
var hasBody = TryComp<BodyComponent>(ev.Entity, out var body);
// only show a big popup when butchering living things.
var popupType = PopupType.Small;
@@ -107,7 +109,7 @@ public sealed class SharpSystem : EntitySystem
if (hasBody)
{
body!.Gib();
_bodySystem.GibBody(body!.Owner, body: body);
}
else
{