Фиксы (#332)
* - fix: Fix desword flipping on server. * - fix: Fix invalid cult target. * - fix: Fix narsie summon. * - tweak: Weaker heavy attack. * - tweak: Less toy desword stamina damage. * - fix: FrameUpdate. * - tweak: Less blunt bleed.
This commit is contained in:
40
Content.Shared/_White/Animations/SharedFlipOnHitSystem.cs
Normal file
40
Content.Shared/_White/Animations/SharedFlipOnHitSystem.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Shared._White.Animations;
|
||||
|
||||
public abstract class SharedFlipOnHitSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FlipOnHitComponent, MeleeHitEvent>(OnHit);
|
||||
}
|
||||
|
||||
private void OnHit(Entity<FlipOnHitComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
if (!_timing.IsFirstTimePredicted)
|
||||
return;
|
||||
|
||||
if (args.HitEntities.Count == 0)
|
||||
return;
|
||||
|
||||
if (TryComp(ent, out ItemToggleComponent? itemToggle) && !itemToggle.Activated)
|
||||
return;
|
||||
|
||||
PlayAnimation(args.User);
|
||||
}
|
||||
|
||||
protected abstract void PlayAnimation(EntityUid user);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public sealed class FlipOnHitEvent(NetEntity user) : EntityEventArgs
|
||||
{
|
||||
public NetEntity User = user;
|
||||
}
|
||||
Reference in New Issue
Block a user