Trigger Refactor (#39034)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.DeviceLinking.Components;
|
||||
using Content.Server.Explosion.EntitySystems;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Timing;
|
||||
@@ -10,7 +9,6 @@ namespace Content.Server.DeviceLinking.Systems;
|
||||
public sealed class SignallerSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DeviceLinkSystem _link = default!;
|
||||
[Dependency] private readonly UseDelaySystem _useDelay = default!;
|
||||
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -19,7 +17,6 @@ public sealed class SignallerSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<SignallerComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<SignallerComponent, UseInHandEvent>(OnUseInHand);
|
||||
SubscribeLocalEvent<SignallerComponent, TriggerEvent>(OnTrigger);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, SignallerComponent component, ComponentInit args)
|
||||
@@ -36,16 +33,4 @@ public sealed class SignallerSystem : EntitySystem
|
||||
_link.InvokePort(uid, component.Port);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnTrigger(EntityUid uid, SignallerComponent component, TriggerEvent args)
|
||||
{
|
||||
if (!TryComp(uid, out UseDelayComponent? useDelay)
|
||||
// if on cooldown, do nothing
|
||||
// and set cooldown to prevent clocks
|
||||
|| !_useDelay.TryResetDelay((uid, useDelay), true))
|
||||
return;
|
||||
|
||||
_link.InvokePort(uid, component.Port);
|
||||
args.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user