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
29 lines
748 B
C#
29 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);
|
|
}
|
|
}
|