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