mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
* Nubody * fix test fails * gibbing * lung test returns * doc comment * hand organ test * giblet test * yaml formatting * returning * relocate * trimming * re-smite * oops thusd tweak * arachnids have slower metabolism i guess * never mind the old behaviour is bad actually * rider whyyy * style changes and allat * fix collision --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
31 lines
929 B
C#
31 lines
929 B
C#
using Content.Shared.Hands.EntitySystems;
|
|
|
|
namespace Content.Shared.Body;
|
|
|
|
public sealed class HandOrganSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<HandOrganComponent, OrganGotInsertedEvent>(OnGotInserted);
|
|
SubscribeLocalEvent<HandOrganComponent, OrganGotRemovedEvent>(OnGotRemoved);
|
|
}
|
|
|
|
private void OnGotInserted(Entity<HandOrganComponent> ent, ref OrganGotInsertedEvent args)
|
|
{
|
|
_hands.AddHand(args.Target, ent.Comp.HandID, ent.Comp.Data);
|
|
}
|
|
|
|
private void OnGotRemoved(Entity<HandOrganComponent> ent, ref OrganGotRemovedEvent args)
|
|
{
|
|
// prevent a recursive double-delete bug
|
|
if (LifeStage(args.Target) >= EntityLifeStage.Terminating)
|
|
return;
|
|
|
|
_hands.RemoveHand(args.Target, ent.Comp.HandID);
|
|
}
|
|
}
|