Я починил дилдо блять... (#165)
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,26 +13,30 @@ public sealed class VibratorSystem : SharedVibratorSystem
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<VibratorComponent,UseInHandEvent>(OnUseInHand);
|
||||
SubscribeLocalEvent<VibratorComponent,ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<VibratorComponent,SignalReceivedEvent>(OnsignalReceived);
|
||||
SubscribeLocalEvent<VibratorComponent, UseInHandEvent>(OnUseInHand);
|
||||
SubscribeLocalEvent<VibratorComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<VibratorComponent, SignalReceivedEvent>(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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,31 +6,31 @@ public abstract class SharedVibratorSystem : EntitySystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<VibratorComponent,ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<VibratorComponent,ComponentHandleState>(OnHandleState);
|
||||
SubscribeLocalEvent<VibratorComponent, ComponentGetState>(OnGetState);
|
||||
SubscribeLocalEvent<VibratorComponent, ComponentHandleState>(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)
|
||||
|
||||
Reference in New Issue
Block a user