From e4fbe81aa71548f6b59cf138e44b52280ae5073c Mon Sep 17 00:00:00 2001 From: BIGZi0348 <118811750+BIGZi0348@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:56:26 +0300 Subject: [PATCH] =?UTF-8?q?=D0=AF=20=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B4=D0=B8=D0=BB=D0=B4=D0=BE=20=D0=B1=D0=BB=D1=8F?= =?UTF-8?q?=D1=82=D1=8C...=20(#165)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_Amour/Vibrator/VibratorSystem.cs | 6 +++--- .../_Amour/Vibrator/VibratorSystem.cs | 20 +++++++++++-------- .../_Amour/Vibrator/VibratorSystem.cs | 14 ++++++------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Content.Client/_Amour/Vibrator/VibratorSystem.cs b/Content.Client/_Amour/Vibrator/VibratorSystem.cs index a8f11c0be7..6eec4030d6 100644 --- a/Content.Client/_Amour/Vibrator/VibratorSystem.cs +++ b/Content.Client/_Amour/Vibrator/VibratorSystem.cs @@ -20,16 +20,16 @@ public sealed class VibratorSystem : SharedVibratorSystem private void OnAnimationCompleted(EntityUid uid, VibratorComponent component, AnimationCompletedEvent args) { - if(args.Key != _vibration || !component.IsVibrating) + if (args.Key != _vibration || !component.IsVibrating) return; - _animationSystem.Play(uid,GetAnimation(), _vibration); + _animationSystem.Play(uid, GetAnimation(), _vibration); } public override void ToggleVibrate(EntityUid uid, VibratorComponent component) { if (component.IsVibrating) - _animationSystem.Play(uid,GetAnimation(), _vibration); + _animationSystem.Play(uid, GetAnimation(), _vibration); } diff --git a/Content.Server/_Amour/Vibrator/VibratorSystem.cs b/Content.Server/_Amour/Vibrator/VibratorSystem.cs index c1b2948492..f983a01936 100644 --- a/Content.Server/_Amour/Vibrator/VibratorSystem.cs +++ b/Content.Server/_Amour/Vibrator/VibratorSystem.cs @@ -13,26 +13,30 @@ public sealed class VibratorSystem : SharedVibratorSystem { base.Initialize(); - SubscribeLocalEvent(OnUseInHand); - SubscribeLocalEvent(OnInit); - SubscribeLocalEvent(OnsignalReceived); + SubscribeLocalEvent(OnUseInHand); + SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(OnsignalReceived); } - private void OnsignalReceived(EntityUid uid, VibratorComponent component,ref SignalReceivedEvent args) + private void OnsignalReceived(EntityUid uid, VibratorComponent component, ref SignalReceivedEvent args) { - if(args.Port != component.TogglePort) + if (args.Port != component.TogglePort) return; - ToggleVibration(uid,component); + ToggleVibration(uid, component); } private void OnInit(EntityUid uid, VibratorComponent component, ComponentInit args) { - _signalSystem.EnsureSinkPorts(uid,component.TogglePort); + _signalSystem.EnsureSinkPorts(uid, component.TogglePort); } private void OnUseInHand(EntityUid uid, VibratorComponent component, UseInHandEvent args) { - ToggleVibration(uid,component); + if (args.Handled) + return; + + ToggleVibration(uid, component); + args.Handled = true; } } diff --git a/Content.Shared/_Amour/Vibrator/VibratorSystem.cs b/Content.Shared/_Amour/Vibrator/VibratorSystem.cs index 8265cfea9a..d3c9ebc607 100644 --- a/Content.Shared/_Amour/Vibrator/VibratorSystem.cs +++ b/Content.Shared/_Amour/Vibrator/VibratorSystem.cs @@ -6,31 +6,31 @@ public abstract class SharedVibratorSystem : EntitySystem { public override void Initialize() { - SubscribeLocalEvent(OnGetState); - SubscribeLocalEvent(OnHandleState); + SubscribeLocalEvent(OnGetState); + SubscribeLocalEvent(OnHandleState); } private void OnHandleState(EntityUid uid, VibratorComponent component, ref ComponentHandleState args) { - if(args.Current is not VibratorComponentState state) + if (args.Current is not VibratorComponentState state) return; component.IsVibrating = state.IsVibrating; - ToggleVibrate(uid,component); + ToggleVibrate(uid, component); } - private void OnGetState(EntityUid uid, VibratorComponent component,ref ComponentGetState args) + private void OnGetState(EntityUid uid, VibratorComponent component, ref ComponentGetState args) { args.State = new VibratorComponentState(component.IsVibrating); } public void ToggleVibration(EntityUid uid, VibratorComponent? component = null) { - if(!Resolve(uid,ref component)) + if (!Resolve(uid, ref component)) return; component.IsVibrating = !component.IsVibrating; - Dirty(uid,component); + Dirty(uid, component); } public virtual void ToggleVibrate(EntityUid uid, VibratorComponent component)