CardboardBoxComponent.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Robust.Shared.Audio;
  2. using Robust.Shared.GameStates;
  3. using Robust.Shared.Serialization;
  4. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
  5. namespace Content.Shared.CardboardBox.Components;
  6. /// <summary>
  7. /// Allows a user to control an EntityStorage entity while inside of it.
  8. /// Used for big cardboard box entities.
  9. /// </summary>
  10. [RegisterComponent, NetworkedComponent]
  11. public sealed partial class CardboardBoxComponent : Component
  12. {
  13. /// <summary>
  14. /// The person in control of this box
  15. /// </summary>
  16. [DataField("mover")]
  17. public EntityUid? Mover;
  18. /// <summary>
  19. /// The entity used for the box opening effect
  20. /// </summary>
  21. [ViewVariables(VVAccess.ReadWrite)]
  22. [DataField("effect")]
  23. public string Effect = "Exclamation";
  24. /// <summary>
  25. /// Sound played upon effect creation
  26. /// </summary>
  27. [ViewVariables(VVAccess.ReadWrite)]
  28. [DataField("effectSound")]
  29. public SoundSpecifier? EffectSound;
  30. /// <summary>
  31. /// Whether to prevent the box from making the sound and effect
  32. /// </summary>
  33. [ViewVariables(VVAccess.ReadWrite)]
  34. [DataField("quiet")]
  35. public bool Quiet = false;
  36. /// <summary>
  37. /// How far should the box opening effect go?
  38. /// </summary>
  39. [ViewVariables(VVAccess.ReadWrite)]
  40. [DataField("distance")]
  41. public float Distance = 6f;
  42. /// <summary>
  43. /// Time at which the sound effect can next be played.
  44. /// </summary>
  45. [DataField("effectCooldown", customTypeSerializer: typeof(TimeOffsetSerializer))]
  46. public TimeSpan EffectCooldown;
  47. /// <summary>
  48. /// Time between sound effects. Prevents effect spam
  49. /// </summary>
  50. [DataField("cooldownDuration")]
  51. public TimeSpan CooldownDuration = TimeSpan.FromSeconds(5f);
  52. }
  53. [Serializable, NetSerializable]
  54. public sealed class PlayBoxEffectMessage : EntityEventArgs
  55. {
  56. public NetEntity Source;
  57. public NetEntity Mover;
  58. public PlayBoxEffectMessage(NetEntity source, NetEntity mover)
  59. {
  60. Source = source;
  61. Mover = mover;
  62. }
  63. }