using Content.Shared._DV.Surgery;
using Content.Shared.Body.Components;
using Content.Shared.FixedPoint;
using Content.Shared.Forensics.Components;
namespace Content.Shared.Body.Systems;
///
/// Makes bodyparts and organs filthy and dna-contaminated when a body is gibbed or butchered.
/// Adds some friction to organ harvesting -> free alien organs pipeline, you need to actually operate on the corpse.
///
public abstract partial class SharedBodySystem
{
[Dependency] private readonly SurgeryCleanSystem _clean = default!;
///
/// Dirtiness to give giblets.
///
public static readonly FixedPoint2 DirtAdded = FixedPoint2.New(100);
private void InitializeGibDirtying()
{
SubscribeLocalEvent(OnGibbed);
}
private void OnGibbed(Entity ent, ref BodyGibbedEvent args)
{
var dna = CompOrNull(ent)?.DNA;
foreach (var giblet in args.Gibs)
{
_clean.AddDirt(giblet, DirtAdded);
_clean.AddDna(giblet, dna);
}
}
}
///
/// Raised by body system on the body entity after being gibbed.
///
[ByRefEvent]
public record struct BodyGibbedEvent(HashSet Gibs);