mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-02-14 19:29:53 +01:00
24 lines
671 B
C#
24 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);
|
|
}
|
|
}
|