2023-08-08 03:28:59 +03:00
|
|
|
|
using Content.Shared.Body.Systems;
|
|
|
|
|
|
using Content.Shared.Buckle.Components;
|
2023-08-13 10:29:39 +03:00
|
|
|
|
using Content.Shared.Movement.Events;
|
2023-08-08 03:28:59 +03:00
|
|
|
|
using Content.Shared.Movement.Systems;
|
|
|
|
|
|
using Content.Shared.Standing;
|
2023-08-13 10:29:39 +03:00
|
|
|
|
using Content.Shared.Throwing;
|
2023-08-08 03:28:59 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Traits.Assorted;
|
|
|
|
|
|
|
|
|
|
|
|
public sealed class LegsParalyzedSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
|
|
|
|
|
|
[Dependency] private readonly StandingStateSystem _standingSystem = default!;
|
|
|
|
|
|
[Dependency] private readonly SharedBodySystem _bodySystem = default!;
|
|
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup);
|
|
|
|
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown);
|
|
|
|
|
|
SubscribeLocalEvent<LegsParalyzedComponent, BuckleChangeEvent>(OnBuckleChange);
|
2023-08-13 10:29:39 +03:00
|
|
|
|
SubscribeLocalEvent<LegsParalyzedComponent, ThrowPushbackAttemptEvent>(OnThrowPushbackAttempt);
|
|
|
|
|
|
SubscribeLocalEvent<LegsParalyzedComponent, UpdateCanMoveEvent>(OnUpdateCanMoveEvent);
|
2023-08-08 03:28:59 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args)
|
|
|
|
|
|
{
|
|
|
|
|
|
// TODO: In future probably must be surgery related wound
|
2023-08-13 10:29:39 +03:00
|
|
|
|
_movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20);
|
2023-08-08 03:28:59 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args)
|
|
|
|
|
|
{
|
|
|
|
|
|
_standingSystem.Stand(uid);
|
|
|
|
|
|
_bodySystem.UpdateMovementSpeed(uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnBuckleChange(EntityUid uid, LegsParalyzedComponent component, ref BuckleChangeEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (args.Buckling)
|
|
|
|
|
|
{
|
|
|
|
|
|
_standingSystem.Stand(args.BuckledEntity);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_standingSystem.Down(args.BuckledEntity);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-13 10:29:39 +03:00
|
|
|
|
|
|
|
|
|
|
private void OnUpdateCanMoveEvent(EntityUid uid, LegsParalyzedComponent component, UpdateCanMoveEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Cancel();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnThrowPushbackAttempt(EntityUid uid, LegsParalyzedComponent component, ThrowPushbackAttemptEvent args)
|
|
|
|
|
|
{
|
|
|
|
|
|
args.Cancel();
|
|
|
|
|
|
}
|
2023-08-08 03:28:59 +03:00
|
|
|
|
}
|