mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-19 06:28:40 +03:00
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using Content.Shared.Body.Events;
|
|
using Content.Server.Body.Components;
|
|
using Content.Shared.Body.Systems;
|
|
using Content.Shared._Shitmed.Body.Organ;
|
|
using Content.Server._Shitmed.DelayedDeath;
|
|
|
|
namespace Content.Server._Shitmed.Body.Organ;
|
|
|
|
public sealed class HeartSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<HeartComponent, OrganAddedToBodyEvent>(HandleAddition);
|
|
SubscribeLocalEvent<HeartComponent, OrganRemovedFromBodyEvent>(HandleRemoval);
|
|
}
|
|
|
|
private void HandleRemoval(EntityUid uid, HeartComponent _, ref OrganRemovedFromBodyEvent args)
|
|
{
|
|
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.OldBody))
|
|
return;
|
|
|
|
// TODO: Add some form of very violent bleeding effect.
|
|
EnsureComp<DelayedDeathComponent>(args.OldBody);
|
|
}
|
|
|
|
private void HandleAddition(EntityUid uid, HeartComponent _, ref OrganAddedToBodyEvent args)
|
|
{
|
|
if (TerminatingOrDeleted(uid) || TerminatingOrDeleted(args.Body))
|
|
return;
|
|
|
|
if (_bodySystem.TryGetBodyOrganEntityComps<BrainComponent>(args.Body, out var _))
|
|
RemComp<DelayedDeathComponent>(args.Body);
|
|
}
|
|
// Shitmed-End
|
|
}
|