VocalComponent.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Content.Shared.Chat.Prototypes;
  2. using Content.Shared.Humanoid;
  3. using Robust.Shared.Audio;
  4. using Robust.Shared.GameStates;
  5. using Robust.Shared.Prototypes;
  6. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  7. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  8. namespace Content.Shared.Speech.Components;
  9. /// <summary>
  10. /// Component required for entities to be able to do vocal emotions.
  11. /// </summary>
  12. [RegisterComponent, NetworkedComponent]
  13. [AutoGenerateComponentState]
  14. public sealed partial class VocalComponent : Component
  15. {
  16. /// <summary>
  17. /// Emote sounds prototype id for each sex (not gender).
  18. /// Entities without <see cref="HumanoidComponent"/> considered to be <see cref="Sex.Unsexed"/>.
  19. /// </summary>
  20. [DataField("sounds", customTypeSerializer: typeof(PrototypeIdValueDictionarySerializer<Sex, EmoteSoundsPrototype>))]
  21. [AutoNetworkedField]
  22. public Dictionary<Sex, string>? Sounds;
  23. [DataField("screamId", customTypeSerializer: typeof(PrototypeIdSerializer<EmotePrototype>))]
  24. [AutoNetworkedField]
  25. public string ScreamId = "Scream";
  26. [DataField("wilhelm")]
  27. [AutoNetworkedField]
  28. public SoundSpecifier Wilhelm = new SoundPathSpecifier("/Audio/Voice/Human/wilhelm_scream.ogg");
  29. [DataField("wilhelmProbability")]
  30. [AutoNetworkedField]
  31. public float WilhelmProbability = 0.0002f;
  32. [DataField("screamAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
  33. [AutoNetworkedField]
  34. public string? ScreamAction = "ActionScream";
  35. [DataField("screamActionEntity")]
  36. [AutoNetworkedField]
  37. public EntityUid? ScreamActionEntity;
  38. /// <summary>
  39. /// Currently loaded emote sounds prototype, based on entity sex.
  40. /// Null if no valid prototype for entity sex was found.
  41. /// </summary>
  42. [ViewVariables]
  43. [AutoNetworkedField]
  44. public EmoteSoundsPrototype? EmoteSounds = null;
  45. }