using Content.Shared.Animals.Systems;
using Robust.Shared.GameStates;
using Robust.Shared.Network;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Shared.Animals.Components;
///
/// Makes an entity able to memorize chat/radio messages.
///
[RegisterComponent, NetworkedComponent]
[AutoGenerateComponentPause]
public sealed partial class ParrotMemoryComponent : Component
{
///
/// List of SpeechMemory records this entity has learned.
///
[DataField]
public List SpeechMemories = new();
///
/// The % chance an entity with this component learns a phrase when learning is off cooldown.
///
[DataField]
public float LearnChance = 0.6f;
///
/// Time after which another attempt can be made at learning a phrase.
///
[DataField]
public TimeSpan LearnCooldown = TimeSpan.FromMinutes(1);
///
/// Next time at which the parrot can attempt to learn something.
///
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
[AutoPausedField]
public TimeSpan NextLearnInterval = TimeSpan.Zero;
///
/// The number of speech entries that are remembered.
///
[DataField]
public int MaxSpeechMemory = 50;
///
/// Minimum length of a speech entry.
///
[DataField]
public int MinEntryLength = 4;
///
/// Maximum length of a speech entry.
///
[DataField]
public int MaxEntryLength = 50;
}
[Serializable, NetSerializable]
public record struct SpeechMemory(NetUserId? NetUserId, string Message);