forked from space-syndicate/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
285 additions
and
46 deletions.
There are no files selected for viewing
52 changes: 43 additions & 9 deletions
52
Content.Server/_CorvaxNext/Speech/Components/ParrotSpeechComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,74 @@ | ||
using Content.Server.Speech.EntitySystems; | ||
using Content.Shared.Whitelist; | ||
using Content.Server.Speech.EntitySystems; | ||
|
||
namespace Content.Server.Speech.Components; | ||
|
||
/// <summary> | ||
/// This component stores the parrot's learned phrases (both single words and multi-word phrases), | ||
/// and also controls time intervals and learning probabilities. | ||
/// </summary> | ||
[RegisterComponent] | ||
[Access(typeof(ParrotSpeechSystem))] | ||
public sealed partial class ParrotSpeechComponent : Component | ||
{ | ||
/// <summary> | ||
/// The maximum number of words the parrot can learn per phrase. | ||
/// Phrases are 1 to MaxPhraseLength words in length. | ||
/// The maximum number of words in a generated phrase if the parrot decides to combine single words. | ||
/// </summary> | ||
[DataField] | ||
public int MaximumPhraseLength = 7; | ||
|
||
/// <summary> | ||
/// The maximum amount of single-word phrases the parrot can store. | ||
/// </summary> | ||
[DataField] | ||
public int MaximumPhraseCount = 20; | ||
public int MaximumSingleWordCount = 60; | ||
|
||
/// <summary> | ||
/// The maximum amount of multi-word phrases the parrot can store. | ||
/// </summary> | ||
[DataField] | ||
public int MinimumWait = 60; // 1 minutes | ||
public int MaximumMultiWordCount = 20; | ||
|
||
/// <summary> | ||
/// Minimum delay (in seconds) before the next utterance. | ||
/// </summary> | ||
[DataField] | ||
public int MinimumWait = 60; // 1 minute | ||
|
||
/// <summary> | ||
/// Maximum delay (in seconds) before the next utterance. | ||
/// </summary> | ||
[DataField] | ||
public int MaximumWait = 120; // 2 minutes | ||
|
||
/// <summary> | ||
/// The probability that a parrot will learn from something an overheard phrase. | ||
/// Probability that the parrot learns an overheard phrase. | ||
/// </summary> | ||
[DataField] | ||
public float LearnChance = 0.2f; | ||
|
||
/// <summary> | ||
/// List of entities that are blacklisted from parrot listening. | ||
/// If the entity is in the blacklist, the parrot won't learn from them. | ||
/// </summary> | ||
[DataField] | ||
public EntityWhitelist Blacklist { get; private set; } = new(); | ||
|
||
[DataField] | ||
public TimeSpan? NextUtterance; | ||
/// <summary> | ||
/// Set of single-word phrases (unique words) the parrot has learned. | ||
/// </summary> | ||
[DataField(readOnly: true)] | ||
public HashSet<string> SingleWordPhrases = new(); | ||
|
||
/// <summary> | ||
/// Set of multi-word phrases (2 or more words) the parrot has learned. | ||
/// </summary> | ||
[DataField(readOnly: true)] | ||
public List<string> LearnedPhrases = new(); | ||
public HashSet<string> MultiWordPhrases = new(); | ||
|
||
/// <summary> | ||
/// The next time the parrot will speak (when the current time is beyond this value). | ||
/// </summary> | ||
[DataField] | ||
public TimeSpan? NextUtterance; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.