- add: dildos
This commit is contained in:
64
Content.Client/_Amour/Vibrator/VibratorSystem.cs
Normal file
64
Content.Client/_Amour/Vibrator/VibratorSystem.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared._Amour.Vibrator;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Animations;
|
||||
|
||||
namespace Content.Client._Amour.Vibrator;
|
||||
|
||||
public sealed class VibratorSystem : SharedVibratorSystem
|
||||
{
|
||||
[Dependency] private readonly AnimationPlayerSystem _animationSystem = default!;
|
||||
private readonly string _vibration = "vibration";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<VibratorComponent, AnimationCompletedEvent>(OnAnimationCompleted);
|
||||
}
|
||||
|
||||
private void OnAnimationCompleted(EntityUid uid, VibratorComponent component, AnimationCompletedEvent args)
|
||||
{
|
||||
if(args.Key != _vibration || !component.IsVibrating)
|
||||
return;
|
||||
|
||||
_animationSystem.Play(uid,GetAnimation(), _vibration);
|
||||
}
|
||||
|
||||
public override void ToggleVibrate(EntityUid uid, VibratorComponent component)
|
||||
{
|
||||
if (component.IsVibrating)
|
||||
_animationSystem.Play(uid,GetAnimation(), _vibration);
|
||||
|
||||
}
|
||||
|
||||
private Animation GetAnimation()
|
||||
{
|
||||
return new Animation
|
||||
{
|
||||
Length = TimeSpan.FromMilliseconds(100),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackComponentProperty
|
||||
{
|
||||
ComponentType = typeof(SpriteComponent),
|
||||
Property = nameof(SpriteComponent.Offset),
|
||||
InterpolationMode = AnimationInterpolationMode.Cubic,
|
||||
KeyFrames =
|
||||
{
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0f),
|
||||
|
||||
new AnimationTrackProperty.KeyFrame(new Vector2(0.1f, 0), 0.25f),
|
||||
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0.25f),
|
||||
|
||||
new AnimationTrackProperty.KeyFrame(new Vector2(-0.1f, 0), 0.25f),
|
||||
|
||||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0.25f),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user