using Robust.Shared.Network;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Animals.Components;
///
/// Makes an entity able to memorize chat/radio messages
///
[RegisterComponent]
[AutoGenerateComponentPause]
public sealed partial class ParrotMemoryComponent : Component
{
///
/// List of SpeechMemory records this entity has learned
///
[DataField]
public List SpeechMemories = [];
///
/// 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;
}
public record struct SpeechMemory(NetUserId? NetUserId, string Message);