mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-09-15 14:52:26 +02: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
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using Content.Server.Administration.Logs;
|
|
using Content.Server.DeviceLinking.Components;
|
|
using Content.Shared.Database;
|
|
using Content.Shared.Interaction.Events;
|
|
using Content.Shared.Timing;
|
|
|
|
namespace Content.Server.DeviceLinking.Systems;
|
|
|
|
public sealed partial class SignallerSystem : EntitySystem
|
|
{
|
|
[Dependency] private DeviceLinkSystem _link = default!;
|
|
[Dependency] private IAdminLogManager _adminLogger = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<SignallerComponent, ComponentInit>(OnInit);
|
|
SubscribeLocalEvent<SignallerComponent, UseInHandEvent>(OnUseInHand);
|
|
}
|
|
|
|
private void OnInit(EntityUid uid, SignallerComponent component, ComponentInit args)
|
|
{
|
|
_link.EnsureSourcePorts(uid, component.Port);
|
|
}
|
|
|
|
private void OnUseInHand(EntityUid uid, SignallerComponent component, UseInHandEvent args)
|
|
{
|
|
if (args.Handled)
|
|
return;
|
|
|
|
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(args.User):actor} triggered signaler {ToPrettyString(uid):tool}");
|
|
_link.InvokePort(uid, component.Port);
|
|
args.Handled = true;
|
|
}
|
|
}
|