LegsParalyzedSystem.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Content.Shared.Body.Systems;
  2. using Content.Shared.Buckle.Components;
  3. using Content.Shared.Movement.Events;
  4. using Content.Shared.Movement.Systems;
  5. using Content.Shared.Standing;
  6. using Content.Shared.Throwing;
  7. namespace Content.Shared.Traits.Assorted;
  8. public sealed class LegsParalyzedSystem : EntitySystem
  9. {
  10. [Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifierSystem = default!;
  11. [Dependency] private readonly StandingStateSystem _standingSystem = default!;
  12. [Dependency] private readonly SharedBodySystem _bodySystem = default!;
  13. public override void Initialize()
  14. {
  15. SubscribeLocalEvent<LegsParalyzedComponent, ComponentStartup>(OnStartup);
  16. SubscribeLocalEvent<LegsParalyzedComponent, ComponentShutdown>(OnShutdown);
  17. SubscribeLocalEvent<LegsParalyzedComponent, BuckledEvent>(OnBuckled);
  18. SubscribeLocalEvent<LegsParalyzedComponent, UnbuckledEvent>(OnUnbuckled);
  19. SubscribeLocalEvent<LegsParalyzedComponent, ThrowPushbackAttemptEvent>(OnThrowPushbackAttempt);
  20. SubscribeLocalEvent<LegsParalyzedComponent, UpdateCanMoveEvent>(OnUpdateCanMoveEvent);
  21. }
  22. private void OnStartup(EntityUid uid, LegsParalyzedComponent component, ComponentStartup args)
  23. {
  24. // TODO: In future probably must be surgery related wound
  25. _movementSpeedModifierSystem.ChangeBaseSpeed(uid, 0, 0, 20);
  26. }
  27. private void OnShutdown(EntityUid uid, LegsParalyzedComponent component, ComponentShutdown args)
  28. {
  29. _standingSystem.Stand(uid);
  30. _bodySystem.UpdateMovementSpeed(uid);
  31. }
  32. private void OnBuckled(EntityUid uid, LegsParalyzedComponent component, ref BuckledEvent args)
  33. {
  34. _standingSystem.Stand(uid);
  35. }
  36. private void OnUnbuckled(EntityUid uid, LegsParalyzedComponent component, ref UnbuckledEvent args)
  37. {
  38. _standingSystem.Down(uid);
  39. }
  40. private void OnUpdateCanMoveEvent(EntityUid uid, LegsParalyzedComponent component, UpdateCanMoveEvent args)
  41. {
  42. args.Cancel();
  43. }
  44. private void OnThrowPushbackAttempt(EntityUid uid, LegsParalyzedComponent component, ThrowPushbackAttemptEvent args)
  45. {
  46. args.Cancel();
  47. }
  48. }