Stun and Stamina Visuals (#37196)

* Stun animation

* Commit 2

* Almost working commit

* Best commit

* Minor cleanup and value adjustments

* Fix animation data getting wasted and cleaned up some stuff

* Don't animate if dead

* AppearanceSystem is for chumps

* Cleanup

* More cleanup

* More cleanup

* Half working commit

* Documentation

* Works

* ComponentHandleState my beloved

* AppearanceComp compatibility

* Address review

* Borgar

* AND NOW THE END IS NEAR

* AppearanceSystem compliance (Real)

* Don't need to log missing there

* I actually hate mob prototypes so much you don't even know

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
Princess Cheeseballs
2025-07-11 05:13:11 -07:00
committed by GitHub
parent a268a4aacc
commit ac895a0db4
12 changed files with 514 additions and 46 deletions

View File

@@ -20,15 +20,17 @@ using Robust.Shared.Audio.Systems;
using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Timing;
namespace Content.Shared.Stunnable;
public abstract class SharedStunSystem : EntitySystem
public abstract partial class SharedStunSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] protected readonly ActionBlockerSystem Blocker = default!;
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] protected readonly SharedAppearanceSystem Appearance = default!;
[Dependency] private readonly EntityWhitelistSystem _entityWhitelist = default!;
[Dependency] private readonly StandingStateSystem _standingState = default!;
[Dependency] private readonly StatusEffectsSystem _statusEffect = default!;
@@ -49,7 +51,7 @@ public abstract class SharedStunSystem : EntitySystem
SubscribeLocalEvent<SlowedDownComponent, ComponentShutdown>(OnSlowRemove);
SubscribeLocalEvent<StunnedComponent, ComponentStartup>(UpdateCanMove);
SubscribeLocalEvent<StunnedComponent, ComponentShutdown>(UpdateCanMove);
SubscribeLocalEvent<StunnedComponent, ComponentShutdown>(OnStunShutdown);
SubscribeLocalEvent<StunOnContactComponent, StartCollideEvent>(OnStunOnContactCollide);
@@ -71,6 +73,9 @@ public abstract class SharedStunSystem : EntitySystem
SubscribeLocalEvent<StunnedComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
SubscribeLocalEvent<StunnedComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
SubscribeLocalEvent<MobStateComponent, MobStateChangedEvent>(OnMobStateChanged);
// Stun Appearance Data
InitializeAppearance();
}
private void OnAttemptInteract(Entity<StunnedComponent> ent, ref InteractionAttemptEvent args)
@@ -107,9 +112,16 @@ public abstract class SharedStunSystem : EntitySystem
}
private void OnStunShutdown(Entity<StunnedComponent> ent, ref ComponentShutdown args)
{
// This exists so the client can end their funny animation if they're playing one.
UpdateCanMove(ent, ent.Comp, args);
Appearance.RemoveData(ent, StunVisuals.SeeingStars);
}
private void UpdateCanMove(EntityUid uid, StunnedComponent component, EntityEventArgs args)
{
_blocker.UpdateCanMove(uid);
Blocker.UpdateCanMove(uid);
}
private void OnStunOnContactCollide(Entity<StunOnContactComponent> ent, ref StartCollideEvent args)