mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* IoC source gen compatibility Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter. * Missed a spot
30 lines
928 B
C#
30 lines
928 B
C#
using Content.Shared.Hands.EntitySystems;
|
|
|
|
namespace Content.Shared.Body;
|
|
|
|
public sealed partial class HandOrganSystem : EntitySystem
|
|
{
|
|
[Dependency] private 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);
|
|
}
|
|
}
|