mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 08:07:28 +00:00
* cleanup * fix fixtures * prediction * fix test * review * fix svalinn visuals * fix chargers * fix portable recharger and its unlit visuals * fix borgs * oomba review * fix examination prediction
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Content.Shared.ActionBlocker;
|
|
using Content.Shared.Item.ItemToggle.Components;
|
|
|
|
namespace Content.Shared.Stunnable;
|
|
|
|
public abstract class SharedStunbatonSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StunbatonComponent, ItemToggleActivateAttemptEvent>(TryTurnOn);
|
|
SubscribeLocalEvent<StunbatonComponent, ItemToggleDeactivateAttemptEvent>(TryTurnOff);
|
|
}
|
|
|
|
protected virtual void TryTurnOn(Entity<StunbatonComponent> entity, ref ItemToggleActivateAttemptEvent args)
|
|
{
|
|
if (args.User != null && !_actionBlocker.CanComplexInteract(args.User.Value)) {
|
|
args.Cancelled = true;
|
|
return;
|
|
}
|
|
}
|
|
|
|
protected virtual void TryTurnOff(Entity<StunbatonComponent> entity, ref ItemToggleDeactivateAttemptEvent args)
|
|
{
|
|
if (args.User != null && !_actionBlocker.CanComplexInteract(args.User.Value)) {
|
|
args.Cancelled = true;
|
|
return;
|
|
}
|
|
}
|
|
}
|