Update trivial components to use auto comp states (#20539)

This commit is contained in:
DrSmugleaf
2023-09-28 16:20:29 -07:00
committed by GitHub
parent 14cfe44ece
commit a44fa86b68
158 changed files with 806 additions and 2866 deletions

View File

@@ -1,8 +1,6 @@
using System.Collections.Specialized;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.Prototypes;
namespace Content.Shared.Speech
{
@@ -10,31 +8,30 @@ namespace Content.Shared.Speech
/// 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, change speech verbs, datafields for the sounds in question, and relevant AudioParams.
/// </summary>
[RegisterComponent, NetworkedComponent]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class SpeechComponent : Component
{
[DataField("enabled"), Access(typeof(SpeechSystem),
Friend = AccessPermissions.ReadWrite,
Other = AccessPermissions.Read)]
[DataField, AutoNetworkedField]
[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]
public ProtoId<SpeechSoundsPrototype>? SpeechSounds;
/// <summary>
/// What speech verb prototype should be used by default for displaying this entity's messages?
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("speechVerb", customTypeSerializer:typeof(PrototypeIdSerializer<SpeechVerbPrototype>))]
public string SpeechVerb = "Default";
[DataField]
public ProtoId<SpeechVerbPrototype> SpeechVerb = "Default";
/// <summary>
/// A mapping from chat suffixes loc strings to speech verb prototypes that should be conditionally used.
/// For things like '?' changing to 'asks' or '!!' making text bold and changing to 'yells'. Can be overridden if necessary.
/// </summary>
[DataField("suffixSpeechVerbs", customTypeSerializer:typeof(PrototypeIdValueDictionarySerializer<string, SpeechVerbPrototype>))]
public Dictionary<string, string> SuffixSpeechVerbs = new()
[DataField]
public Dictionary<string, ProtoId<SpeechVerbPrototype>> SuffixSpeechVerbs = new()
{
{ "chat-speech-verb-suffix-exclamation-strong", "DefaultExclamationStrong" },
{ "chat-speech-verb-suffix-exclamation", "DefaultExclamation" },
@@ -43,11 +40,11 @@ namespace Content.Shared.Speech
{ "chat-speech-verb-suffix-mumble", "DefaultMumble" },
};
[DataField("audioParams")]
[DataField]
public AudioParams AudioParams = AudioParams.Default.WithVolume(6f).WithRolloffFactor(4.5f);
[ViewVariables(VVAccess.ReadWrite)]
[DataField("soundCooldownTime")]
[DataField]
public float SoundCooldownTime { get; set; } = 0.5f;
public TimeSpan LastTimeSoundPlayed = TimeSpan.Zero;