* Init Commit * Remove unused code, fix stun visuals bug * Update Content.Shared/Stunnable/SharedStunSystem.cs * Some initial changes * first batch of changes * Commit * One line cleanup * KnockdownStatusEffect ain't worth it. * Fix 2 bugs * Fixes * Remove that actually, * Commit * Better solution * Alright final commit I think * Add better remarks * How the fuck did this not get pushed??? * Wait no why was my ryder trying to push that??? I didn't make that change! DON'T DO THAT!!! * Review * Don't log that --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com>
64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
using Content.Server.Stunnable.Components;
|
|
using Content.Shared.Movement.Systems;
|
|
using JetBrains.Annotations;
|
|
using Content.Shared.Throwing;
|
|
using Robust.Shared.Physics.Events;
|
|
|
|
namespace Content.Server.Stunnable.Systems;
|
|
|
|
[UsedImplicitly]
|
|
internal sealed class StunOnCollideSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly StunSystem _stunSystem = default!;
|
|
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StunOnCollideComponent, StartCollideEvent>(HandleCollide);
|
|
SubscribeLocalEvent<StunOnCollideComponent, ThrowDoHitEvent>(HandleThrow);
|
|
}
|
|
|
|
private void TryDoCollideStun(Entity<StunOnCollideComponent> ent, EntityUid target)
|
|
{
|
|
_stunSystem.TryKnockdown(target, ent.Comp.KnockdownAmount, ent.Comp.Refresh, ent.Comp.AutoStand, ent.Comp.Drop);
|
|
|
|
if (ent.Comp.Refresh)
|
|
{
|
|
_stunSystem.TryUpdateStunDuration(target, ent.Comp.StunAmount);
|
|
_movementMod.TryUpdateMovementSpeedModDuration(
|
|
target,
|
|
MovementModStatusSystem.TaserSlowdown,
|
|
ent.Comp.SlowdownAmount,
|
|
ent.Comp.WalkSpeedModifier,
|
|
ent.Comp.SprintSpeedModifier
|
|
);
|
|
}
|
|
else
|
|
{
|
|
_stunSystem.TryAddStunDuration(target, ent.Comp.StunAmount);
|
|
_movementMod.TryAddMovementSpeedModDuration(
|
|
target,
|
|
MovementModStatusSystem.TaserSlowdown,
|
|
ent.Comp.SlowdownAmount,
|
|
ent.Comp.WalkSpeedModifier,
|
|
ent.Comp.SprintSpeedModifier
|
|
);
|
|
}
|
|
}
|
|
|
|
private void HandleCollide(Entity<StunOnCollideComponent> ent, ref StartCollideEvent args)
|
|
{
|
|
if (args.OurFixtureId != ent.Comp.FixtureID)
|
|
return;
|
|
|
|
TryDoCollideStun(ent, args.OtherEntity);
|
|
}
|
|
|
|
private void HandleThrow(Entity<StunOnCollideComponent> ent, ref ThrowDoHitEvent args)
|
|
{
|
|
TryDoCollideStun(ent, args.Target);
|
|
}
|
|
}
|