Cleanup speech and emoting comps (#13194)

Networks speech and removes the shared prefix from emoting.
I have no idea if emoting is even being used or plan to be used in the interim.
This commit is contained in:
metalgearsloth
2022-12-28 04:03:25 +11:00
committed by GitHub
parent 2a8e5d9096
commit 0d7423c01d
8 changed files with 112 additions and 73 deletions

View File

@@ -0,0 +1,32 @@
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
namespace Content.Shared.Speech
{
/// <summary>
/// Component required for entities to be able to speak. (TODO: Entities can speak fine without this, this only forbids them speak if they have it and enabled is false.)
/// Contains the option to let entities make noise when speaking, datafields for the sounds in question, and relevant AudioParams.
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed class SpeechComponent : Component
{
[DataField("enabled"), Access(typeof(SpeechSystem),
Friend = AccessPermissions.ReadWrite,
Other = AccessPermissions.Read)]
public bool Enabled = true;
[ViewVariables(VVAccess.ReadWrite)]
[DataField("speechSounds", customTypeSerializer:typeof(PrototypeIdSerializer<SpeechSoundsPrototype>))]
public string? SpeechSounds;
[DataField("audioParams")]
public AudioParams AudioParams = AudioParams.Default.WithVolume(6f).WithRolloffFactor(4.5f);
[ViewVariables(VVAccess.ReadWrite)]
[DataField("soundCooldownTime")]
public float SoundCooldownTime { get; set; } = 0.5f;
public TimeSpan LastTimeSoundPlayed = TimeSpan.Zero;
}
}