-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
…ngines into plasmaman
- Loading branch information
Showing
621 changed files
with
58,895 additions
and
4,941 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4=" | ||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM=" | ||
fi | ||
use flake | ||
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
using Robust.Client.Animations; | ||
using Robust.Shared.Animations; | ||
using Robust.Shared.GameStates; | ||
using Robust.Client.GameObjects; | ||
using Content.Shared.Emoting; | ||
using System.Numerics; | ||
using Robust.Shared.Prototypes; | ||
using Content.Shared.Chat.Prototypes; | ||
|
||
namespace Content.Client.Emoting; | ||
|
||
public sealed partial class AnimatedEmotesSystem : SharedAnimatedEmotesSystem | ||
{ | ||
[Dependency] private readonly AnimationPlayerSystem _anim = default!; | ||
[Dependency] private readonly IPrototypeManager _prot = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<AnimatedEmotesComponent, ComponentHandleState>(OnHandleState); | ||
|
||
SubscribeLocalEvent<AnimatedEmotesComponent, AnimationFlipEmoteEvent>(OnFlip); | ||
SubscribeLocalEvent<AnimatedEmotesComponent, AnimationSpinEmoteEvent>(OnSpin); | ||
SubscribeLocalEvent<AnimatedEmotesComponent, AnimationJumpEmoteEvent>(OnJump); | ||
} | ||
|
||
public void PlayEmote(EntityUid uid, Animation anim, string animationKey = "emoteAnimKeyId") | ||
{ | ||
if (_anim.HasRunningAnimation(uid, animationKey)) | ||
return; | ||
|
||
_anim.Play(uid, anim, animationKey); | ||
} | ||
|
||
private void OnHandleState(EntityUid uid, AnimatedEmotesComponent component, ref ComponentHandleState args) | ||
{ | ||
if (args.Current is not AnimatedEmotesComponentState state | ||
|| !_prot.TryIndex<EmotePrototype>(state.Emote, out var emote)) | ||
return; | ||
|
||
if (emote.Event != null) | ||
RaiseLocalEvent(uid, emote.Event); | ||
} | ||
|
||
private void OnFlip(Entity<AnimatedEmotesComponent> ent, ref AnimationFlipEmoteEvent args) | ||
{ | ||
var a = new Animation | ||
{ | ||
Length = TimeSpan.FromMilliseconds(500), | ||
AnimationTracks = | ||
{ | ||
new AnimationTrackComponentProperty | ||
{ | ||
ComponentType = typeof(SpriteComponent), | ||
Property = nameof(SpriteComponent.Rotation), | ||
InterpolationMode = AnimationInterpolationMode.Linear, | ||
KeyFrames = | ||
{ | ||
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(180), 0.25f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(360), 0.25f), | ||
} | ||
} | ||
} | ||
}; | ||
PlayEmote(ent, a); | ||
} | ||
private void OnSpin(Entity<AnimatedEmotesComponent> ent, ref AnimationSpinEmoteEvent args) | ||
{ | ||
var a = new Animation | ||
{ | ||
Length = TimeSpan.FromMilliseconds(600), | ||
AnimationTracks = | ||
{ | ||
new AnimationTrackComponentProperty | ||
{ | ||
ComponentType = typeof(TransformComponent), | ||
Property = nameof(TransformComponent.LocalRotation), | ||
InterpolationMode = AnimationInterpolationMode.Linear, | ||
KeyFrames = | ||
{ | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(0), 0f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(90), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(180), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(270), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(90), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(180), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.FromDegrees(270), 0.075f), | ||
new AnimationTrackProperty.KeyFrame(Angle.Zero, 0.075f), | ||
} | ||
} | ||
} | ||
}; | ||
PlayEmote(ent, a, "emoteAnimSpin"); | ||
} | ||
private void OnJump(Entity<AnimatedEmotesComponent> ent, ref AnimationJumpEmoteEvent args) | ||
{ | ||
var a = new Animation | ||
{ | ||
Length = TimeSpan.FromMilliseconds(250), | ||
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, .35f), 0.125f), | ||
new AnimationTrackProperty.KeyFrame(Vector2.Zero, 0.125f), | ||
} | ||
} | ||
} | ||
}; | ||
PlayEmote(ent, a); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.