23 lines
591 B
C#
23 lines
591 B
C#
using Content.Server.Spawners.Components;
|
|
using Robust.Shared.Spawners;
|
|
|
|
namespace Content.Server.Spawners.EntitySystems;
|
|
|
|
public sealed class SpawnOnDespawnSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SpawnOnDespawnComponent, TimedDespawnEvent>(OnDespawn);
|
|
}
|
|
|
|
private void OnDespawn(EntityUid uid, SpawnOnDespawnComponent comp, ref TimedDespawnEvent args)
|
|
{
|
|
if (!TryComp<TransformComponent>(uid, out var xform))
|
|
return;
|
|
|
|
Spawn(comp.Prototype, xform.Coordinates);
|
|
}
|
|
}
|