Files
wwdpublic/Content.Server/_White/Animations/Systems/WhiteAnimationPlayerSystem.cs
Spatison 8e5d669987 Generic animations (#1067)
* generic animation

* AnimateOnHit

* Dynamic Value

* AnimateOnStartup

* Animated Emotes

* Play Animation Command

* RedFox review

* Rabbit review

* RedFox review

* PlayClient

* Rabbit review

* RedFox review
2026-02-13 21:40:44 +02:00

81 lines
3.3 KiB
C#

using Content.Shared._White.Animations.Prototypes;
using Content.Shared._White.Animations.Systems;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
namespace Content.Server._White.Animations.Systems;
public sealed class WhiteAnimationPlayerSystem : SharedWhiteAnimationPlayerSystem
{
#region Public API
public override void Play(EntityUid uid, ProtoId<AnimationPrototype> animationId, bool force = false)
{
var filter = Filter.Pvs(uid, entityManager: EntityManager);
RaiseNetworkEvent(new PlayAnimationMessage(GetNetEntity(uid), animationId, force), filter);
}
public override void Play(EntityUid uid, ProtoId<AnimationPrototype> animationId, EntityUid recipient, bool force = false)
{
if (!TryComp<ActorComponent>(recipient, out var actor))
return;
RaiseNetworkEvent(new PlayAnimationMessage(GetNetEntity(uid), animationId, force), actor.PlayerSession);
}
public override void Play(EntityUid uid, ProtoId<AnimationPrototype> animationId, ICommonSession recipient, bool force = false) =>
RaiseNetworkEvent(new PlayAnimationMessage(GetNetEntity(uid), animationId, force), recipient);
public override void Play(EntityUid uid, ProtoId<AnimationPrototype> animationId, Filter filter, bool force = false) =>
RaiseNetworkEvent(new PlayAnimationMessage(GetNetEntity(uid), animationId, force), filter);
public override void PlayClient(EntityUid uid, ProtoId<AnimationPrototype> animationId, bool force = false)
{
// This is for the client
}
public override void PlayClient(EntityUid uid, ProtoId<AnimationPrototype> animationId, EntityUid recipient, bool force = false)
{
// This is for the client
}
public override void PlayPredicted(EntityUid uid, ProtoId<AnimationPrototype> animationId, EntityUid recipient, bool force = false)
{
var filter = Filter.PvsExcept(recipient, entityManager: EntityManager);
RaiseNetworkEvent(new PlayAnimationMessage(GetNetEntity(uid), animationId, force), filter);
}
public override void Stop(EntityUid uid, string animationkey)
{
var filter = Filter.Pvs(uid, entityManager: EntityManager);
RaiseNetworkEvent(new StopAnimationMessage(GetNetEntity(uid), animationkey), filter);
}
public override void Stop(EntityUid uid, string animationkey, EntityUid recipient)
{
if (!TryComp<ActorComponent>(recipient, out var actor))
return;
RaiseNetworkEvent(new StopAnimationMessage(GetNetEntity(uid), animationkey), actor.PlayerSession);
}
public override void Stop(EntityUid uid, string animationkey, ICommonSession recipient) =>
RaiseNetworkEvent(new StopAnimationMessage(GetNetEntity(uid), animationkey), recipient);
public override void Stop(EntityUid uid, string animationkey, Filter filter) =>
RaiseNetworkEvent(new StopAnimationMessage(GetNetEntity(uid), animationkey), filter);
public override void StopClient(EntityUid uid, string animationkey, EntityUid recipient)
{
// This is for the client
}
public override void StopPredicted(EntityUid uid, string animationkey, EntityUid recipient)
{
var filter = Filter.PvsExcept(recipient, entityManager: EntityManager);
RaiseNetworkEvent(new StopAnimationMessage(GetNetEntity(uid), animationkey), filter);
}
#endregion
}