ShakeableComponent.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. namespace Content.Shared.Nutrition.Components;
  4. /// <summary>
  5. /// Adds a "Shake" verb to the entity's verb menu.
  6. /// Handles checking the entity can be shaken, displaying popups when shaking,
  7. /// and raising a ShakeEvent when a shake occurs.
  8. /// Reacting to being shaken is left up to other components.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent]
  11. public sealed partial class ShakeableComponent : Component
  12. {
  13. /// <summary>
  14. /// How long it takes to shake this item.
  15. /// </summary>
  16. [DataField]
  17. public TimeSpan ShakeDuration = TimeSpan.FromSeconds(1f);
  18. /// <summary>
  19. /// Does the entity need to be in the user's hand in order to be shaken?
  20. /// </summary>
  21. [DataField]
  22. public bool RequireInHand;
  23. /// <summary>
  24. /// Label to display in the verbs menu for this item's shake action.
  25. /// </summary>
  26. [DataField]
  27. public LocId ShakeVerbText = "shakeable-verb";
  28. /// <summary>
  29. /// Text that will be displayed to the user when shaking this item.
  30. /// </summary>
  31. [DataField]
  32. public LocId ShakePopupMessageSelf = "shakeable-popup-message-self";
  33. /// <summary>
  34. /// Text that will be displayed to other users when someone shakes this item.
  35. /// </summary>
  36. [DataField]
  37. public LocId ShakePopupMessageOthers = "shakeable-popup-message-others";
  38. /// <summary>
  39. /// The sound that will be played when shaking this item.
  40. /// </summary>
  41. [DataField]
  42. public SoundSpecifier ShakeSound = new SoundPathSpecifier("/Audio/Items/soda_shake.ogg");
  43. }