Files
Pieter-Jan BriersandGitHub 5168b5f3d4 IoC source gen compatibility (#43863)
* 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
2026-05-09 03:29:58 +00:00

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;
}
}