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:
@@ -3,5 +3,32 @@ namespace Content.Server.Speech.Components
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed partial class StutteringAccentComponent : Component
|
public sealed partial class StutteringAccentComponent : Component
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Percentage chance that a stutter will occur if it matches.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("matchRandomProb")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float MatchRandomProb = 0.8f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Percentage chance that a stutter occurs f-f-f-f-four times.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("fourRandomProb")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float FourRandomProb = 0.1f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Percentage chance that a stutter occurs t-t-t-three times.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("threeRandomProb")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float ThreeRandomProb = 0.2f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Percentage chance that a stutter cut off.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("cutRandomProb")]
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public float CutRandomProb = 0.05f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ namespace Content.Server.Speech.EntitySystems
|
|||||||
|
|
||||||
private void OnAccent(EntityUid uid, StutteringAccentComponent component, AccentGetEvent args)
|
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;
|
var length = message.Length;
|
||||||
|
|
||||||
@@ -45,17 +45,17 @@ namespace Content.Server.Speech.EntitySystems
|
|||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
newLetter = message[i].ToString();
|
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}";
|
newLetter = $"{newLetter}-{newLetter}-{newLetter}-{newLetter}";
|
||||||
}
|
}
|
||||||
else if (_random.Prob(0.2f))
|
else if (_random.Prob(component.ThreeRandomProb))
|
||||||
{
|
{
|
||||||
newLetter = $"{newLetter}-{newLetter}-{newLetter}";
|
newLetter = $"{newLetter}-{newLetter}-{newLetter}";
|
||||||
}
|
}
|
||||||
else if (_random.Prob(0.05f))
|
else if (_random.Prob(component.CutRandomProb))
|
||||||
{
|
{
|
||||||
newLetter = "";
|
newLetter = "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,3 +34,6 @@ trait-wheelchair-bound-desc = You cannot move without your wheelchair. Wheelchai
|
|||||||
|
|
||||||
trait-frontal-lisp-name = Frontal Lisp
|
trait-frontal-lisp-name = Frontal Lisp
|
||||||
trait-frontal-lisp-desc = You thpeak with a lithp
|
trait-frontal-lisp-desc = You thpeak with a lithp
|
||||||
|
|
||||||
|
trait-socialanxiety-name = Social Anxiety
|
||||||
|
trait-socialanxiety-desc = You are anxious when you speak and stutter.
|
||||||
|
|||||||
@@ -5,3 +5,14 @@
|
|||||||
components:
|
components:
|
||||||
- type: LightweightDrunk
|
- type: LightweightDrunk
|
||||||
boozeStrengthMultiplier: 2
|
boozeStrengthMultiplier: 2
|
||||||
|
|
||||||
|
- type: trait
|
||||||
|
id: SocialAnxiety
|
||||||
|
name: trait-socialanxiety-name
|
||||||
|
description: trait-socialanxiety-desc
|
||||||
|
components:
|
||||||
|
- type: StutteringAccent
|
||||||
|
matchRandomProb: 0.2
|
||||||
|
fourRandomProb: 0
|
||||||
|
threeRandomProb: 0.3
|
||||||
|
cutRandomProb: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user