- add: more interaction shit
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System.Numerics;
|
||||
using Content.Server._Amour.Animation;
|
||||
using Content.Server._Amour.Crawl;
|
||||
using Content.Server.Pulling;
|
||||
using Content.Shared._Amour.Animation;
|
||||
using Content.Shared._Amour.InteractionPanel;
|
||||
using Robust.Shared.Animations;
|
||||
@@ -8,7 +10,9 @@ namespace Content.Server._Amour.InteractionPanel;
|
||||
|
||||
public sealed class Interactions : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly CrawlSystem _crawlSystem = default!;
|
||||
[Dependency] private readonly SharebleAnimationSystem _animationSystem = default!;
|
||||
[Dependency] private readonly PullingSystem _pullingSystem = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<InteractionPanelComponent,InteractionBeginningEvent>(OnBegin);
|
||||
@@ -33,36 +37,12 @@ public sealed class Interactions : EntitySystem
|
||||
|
||||
switch (args.Id)
|
||||
{
|
||||
case "SlapButt":
|
||||
OnSlapButt(uid,component,args);
|
||||
case "PullTarget" :
|
||||
_pullingSystem.TryStartPull(uid, args.Target);
|
||||
break;
|
||||
case "CrawlTarget" :
|
||||
_crawlSystem.EnableCrawl(args.Target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSlapButt(EntityUid uid, InteractionPanelComponent component, InteractionBeginningEvent args)
|
||||
{
|
||||
var rotation = (Transform(args.Target).LocalPosition - Transform(args.Performer).LocalPosition)*0.5f;
|
||||
|
||||
var animation = new Shared._Amour.Animation.Animation()
|
||||
{
|
||||
Length = TimeSpan.FromSeconds(0.5),
|
||||
AnimationTracks =
|
||||
{
|
||||
new AnimationTrackData()
|
||||
{
|
||||
ComponentType = "Sprite",
|
||||
Property = "Offset",
|
||||
InterpolationMode = AnimationInterpolationMode.Cubic,
|
||||
KeyFrames =
|
||||
{
|
||||
_animationSystem.KeyFrame(Vector2.Zero, 0),
|
||||
_animationSystem.KeyFrame(rotation, 0.100f),
|
||||
_animationSystem.KeyFrame(Vector2.Zero, 0.250f)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
_animationSystem.Play(uid,animation);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user