2022-11-06 18:05:44 -05:00
|
|
|
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
|
|
|
|
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
|
|
|
|
|
using Content.Shared.Popups;
|
|
|
|
|
|
using Robust.Shared.Player;
|
|
|
|
|
|
using Robust.Shared.Random;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
|
|
|
|
|
|
|
|
|
|
|
|
public sealed class RandomTeleportArtifactSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
|
|
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
2023-01-28 12:39:51 -05:00
|
|
|
|
[Dependency] private readonly SharedTransformSystem _xform = default!;
|
2022-11-06 18:05:44 -05:00
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
SubscribeLocalEvent<RandomTeleportArtifactComponent, ArtifactActivatedEvent>(OnActivate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnActivate(EntityUid uid, RandomTeleportArtifactComponent component, ArtifactActivatedEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
var xform = Transform(uid);
|
2022-12-19 10:41:47 +13:00
|
|
|
|
_popup.PopupCoordinates(Loc.GetString("blink-artifact-popup"), xform.Coordinates, PopupType.Medium);
|
2022-11-06 18:05:44 -05:00
|
|
|
|
|
2023-06-30 15:25:33 -04:00
|
|
|
|
_xform.SetCoordinates(uid, xform, xform.Coordinates.Offset(_random.NextVector2(component.MinRange, component.MaxRange)));
|
2022-11-06 18:05:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|