CatStation/Content.Shared/Body/HandOrganSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* 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
2026-05-09 03:29:58 +00:00

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);
}
}