mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* First impl. of appearance TryGetData cleanup * Handful of fixes * DamageVisuals: fix HandleDamage call, inheritdoc * bunch of unused AppearanceSystem instances * Handful more unused appearance systems, inheritdoc * JetpackSystem: Ent<T> * cleanup roundup, more Ent<T> * a few lingering AppearanceSystem.TryGetData calls * more lingering AppearanceData access * Remove unnecessary inheritdoc * once again, with feeling
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using Robust.Client.GameObjects;
|
|
using Content.Shared.Fax.Components;
|
|
using Content.Shared.Fax;
|
|
using Robust.Client.Animations;
|
|
|
|
namespace Content.Client.Fax.System;
|
|
|
|
/// <summary>
|
|
/// Visualizer for the fax machine which displays the correct sprite based on the inserted entity.
|
|
/// </summary>
|
|
public sealed partial class FaxVisualsSystem : EntitySystem
|
|
{
|
|
[Dependency] private AnimationPlayerSystem _player = default!;
|
|
|
|
[SubscribeLocalEvent]
|
|
private void OnAppearanceChanged(EntityUid uid, FaxMachineComponent component, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
if (_player.HasRunningAnimation(uid, "faxecute"))
|
|
return;
|
|
|
|
if (!args.TryGetData(FaxMachineVisuals.VisualState, out FaxMachineVisualState visuals)
|
|
|| visuals != FaxMachineVisualState.Inserting)
|
|
return;
|
|
|
|
_player.Play(uid,
|
|
new Animation()
|
|
{
|
|
Length = TimeSpan.FromSeconds(2.4),
|
|
AnimationTracks =
|
|
{
|
|
new AnimationTrackSpriteFlick()
|
|
{
|
|
LayerKey = FaxMachineVisuals.VisualState,
|
|
KeyFrames =
|
|
{
|
|
new AnimationTrackSpriteFlick.KeyFrame(component.InsertingState, 0f)
|
|
},
|
|
},
|
|
},
|
|
},
|
|
"faxecute");
|
|
}
|
|
}
|