fish-station/Content.Server/Coordinates/SpawnRandomOffsetSystem.cs
Kara 77964d4a6b
Kill SharedEntityExtensions and all popup extensions (#20909)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2023-10-16 16:56:09 +11:00

23 lines
671 B
C#

using Content.Shared.Random;
using Content.Shared.Random.Helpers;
using Robust.Shared.Random;
namespace Content.Server.Coordinates;
public sealed class SpawnRandomOffsetSystem : EntitySystem
{
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SpawnRandomOffsetComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(EntityUid uid, SpawnRandomOffsetComponent component, MapInitEvent args)
{
_randomHelper.RandomOffset(uid, component.Offset);
EntityManager.RemoveComponentDeferred(uid, component);
}
}