Files
ss14-wl/Content.Server/RequiresGrid/RequiresGridSystem.cs
Pieter-Jan BriersandGitHub 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
748 B
C#

using Content.Server.Destructible;
namespace Content.Server.RequiresGrid;
public sealed partial class RequiresGridSystem : EntitySystem
{
[Dependency] private DestructibleSystem _destructible = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RequiresGridComponent, EntParentChangedMessage>(OnEntParentChanged);
}
private void OnEntParentChanged(EntityUid owner, RequiresGridComponent component, EntParentChangedMessage args)
{
if (args.OldParent == null)
return;
if (args.Transform.GridUid != null)
return;
if (TerminatingOrDeleted(owner))
return;
_destructible.DestroyEntity(owner);
}
}