Social a-anxiety/st-st-stuttering t-trait. (#20500)

* This was supposed to be a challenge

* Component magik

* Add documentation
This commit is contained in:
Vasilis
2023-10-21 22:09:54 +02:00
committed by GitHub
parent 93c345a1b9
commit 9ea8e03c23
4 changed files with 47 additions and 6 deletions

View File

@@ -31,10 +31,10 @@ namespace Content.Server.Speech.EntitySystems
private void OnAccent(EntityUid uid, StutteringAccentComponent component, AccentGetEvent args)
{
args.Message = Accentuate(args.Message);
args.Message = Accentuate(args.Message, component);
}
public string Accentuate(string message)
public string Accentuate(string message, StutteringAccentComponent component)
{
var length = message.Length;
@@ -45,17 +45,17 @@ namespace Content.Server.Speech.EntitySystems
for (var i = 0; i < length; i++)
{
newLetter = message[i].ToString();
if (Stutter.IsMatch(newLetter) && _random.Prob(0.8f))
if (Stutter.IsMatch(newLetter) && _random.Prob(component.MatchRandomProb))
{
if (_random.Prob(0.1f))
if (_random.Prob(component.FourRandomProb))
{
newLetter = $"{newLetter}-{newLetter}-{newLetter}-{newLetter}";
}
else if (_random.Prob(0.2f))
else if (_random.Prob(component.ThreeRandomProb))
{
newLetter = $"{newLetter}-{newLetter}-{newLetter}";
}
else if (_random.Prob(0.05f))
else if (_random.Prob(component.CutRandomProb))
{
newLetter = "";
}