1
0

SharedVentriloquistPuppetSystem.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Content.Shared.ActionBlocker;
  2. using Content.Shared.Hands;
  3. using Content.Shared.Interaction.Events;
  4. using Content.Shared.Item;
  5. using Content.Shared.Emoting;
  6. using Content.Shared.Movement.Events;
  7. namespace Content.Shared.Puppet;
  8. // TODO deduplicate with BlockMovementComponent
  9. public abstract class SharedVentriloquistPuppetSystem : EntitySystem
  10. {
  11. [Dependency] private readonly ActionBlockerSystem _blocker = default!;
  12. public override void Initialize()
  13. {
  14. base.Initialize();
  15. SubscribeLocalEvent<VentriloquistPuppetComponent, UseAttemptEvent>(Cancel);
  16. SubscribeLocalEvent<VentriloquistPuppetComponent, InteractionAttemptEvent>(CancelInteract);
  17. SubscribeLocalEvent<VentriloquistPuppetComponent, DropAttemptEvent>(Cancel);
  18. SubscribeLocalEvent<VentriloquistPuppetComponent, PickupAttemptEvent>(Cancel);
  19. SubscribeLocalEvent<VentriloquistPuppetComponent, UpdateCanMoveEvent>(Cancel);
  20. SubscribeLocalEvent<VentriloquistPuppetComponent, EmoteAttemptEvent>(Cancel);
  21. SubscribeLocalEvent<VentriloquistPuppetComponent, ChangeDirectionAttemptEvent>(Cancel);
  22. SubscribeLocalEvent<VentriloquistPuppetComponent, ComponentStartup>(OnStartup);
  23. }
  24. private void CancelInteract(Entity<VentriloquistPuppetComponent> ent, ref InteractionAttemptEvent args)
  25. {
  26. args.Cancelled = true;
  27. }
  28. private void OnStartup(EntityUid uid, VentriloquistPuppetComponent component, ComponentStartup args)
  29. {
  30. _blocker.UpdateCanMove(uid);
  31. }
  32. private void Cancel<T>(EntityUid uid, VentriloquistPuppetComponent component, T args) where T : CancellableEntityEventArgs
  33. {
  34. args.Cancel();
  35. }
  36. }