mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03: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
48 lines
1.5 KiB
C#
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
|
|
{
|
|
}
|