CatStation/Content.Client/Doors/TurnstileSystem.cs
AftrLite 4645e40b60
The Respritening - Batch 1 (#44857)
* initial commit
LICENSES / COPYRIGHT ARE NOT FINALIZED.

* test push per ArtisticRoomba

* more progress

* nearly done

* push

* more progress

* second big wave
LICENSING REMAINS INCOMPLETE

* more progress + attributions

* astrotile consistency

* walls attribution pass!

* marble walls, concrete tweaks, attribution fixes

* linter fixes, provisional borders for marble walls

* test fixes

* why is PlatingDamaged load-bearing???

* fixed attribution that flew under the radar, updates to Damaged Plating & Damaged Steel tiles.

* requested changes

* airlock visualizer tweak

---------

Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com>
Co-authored-by: Whatstone <whatston3@gmail.com>
2026-08-12 17:46:16 +00:00

47 lines
1.4 KiB
C#

using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
namespace Content.Client.Doors;
/// <inheritdoc/>
public sealed partial class TurnstileSystem : SharedTurnstileSystem
{
[Dependency] private AppearanceSystem _appearance = default!;
[Dependency] private AnimationPlayerSystem _animation = default!;
private const string AnimationKey = "Turnstile";
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<TurnstileComponent, AnimationCompletedEvent>(OnAnimationCompleted);
}
private void OnAnimationCompleted(Entity<TurnstileComponent> ent, ref AnimationCompletedEvent args)
{
if (args.Key != AnimationKey)
return;
_appearance.SetData(ent, TurnstileVisualLayers.Base, TurnstileStates.Idle);
}
protected override void PlayAnimation(EntityUid uid, TurnstileStates state)
{
if (!TryComp<AnimationPlayerComponent>(uid, out var animation))
return;
if (_animation.HasRunningAnimation(uid, AnimationKey) || !TryComp<TurnstileComponent>(uid, out var turnComp))
return;
var anim = new Animation
{
Length = turnComp.AnimationCooldown,
};
_animation.Play((uid, animation), anim, AnimationKey);
_appearance.SetData(uid, TurnstileVisualLayers.Base, state);
}
}