CatStation/Content.Shared/CriminalRecords/Systems/SharedCriminalRecordsHackerSystem.cs
Pieter-Jan Briers 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

48 lines
1.5 KiB
C#

using Content.Shared.CriminalRecords.Components;
using Content.Shared.DoAfter;
using Content.Shared.Interaction;
using Content.Shared.Ninja.Systems;
using Robust.Shared.Serialization;
namespace Content.Shared.CriminalRecords.Systems;
public abstract partial class SharedCriminalRecordsHackerSystem : EntitySystem
{
[Dependency] private SharedDoAfterSystem _doAfter = default!;
[Dependency] private SharedNinjaGlovesSystem _gloves = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CriminalRecordsHackerComponent, BeforeInteractHandEvent>(OnBeforeInteractHand);
}
private void OnBeforeInteractHand(Entity<CriminalRecordsHackerComponent> ent, ref BeforeInteractHandEvent args)
{
// TODO: generic event
if (args.Handled || !_gloves.AbilityCheck(ent, args, out var target))
return;
if (!HasComp<CriminalRecordsConsoleComponent>(target))
return;
var doAfterArgs = new DoAfterArgs(EntityManager, ent, ent.Comp.Delay, new CriminalRecordsHackDoAfterEvent(), target: target, used: ent, eventTarget: ent)
{
BreakOnDamage = true,
BreakOnMove = true,
MovementThreshold = 0.5f
};
_doAfter.TryStartDoAfter(doAfterArgs);
args.Handled = true;
}
}
/// <summary>
/// Raised on the user when the doafter completes.
/// </summary>
[Serializable, NetSerializable]
public sealed partial class CriminalRecordsHackDoAfterEvent : SimpleDoAfterEvent
{
}