[RegisterComponent]
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;
}
}
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;
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 = "";
}
trait-frontal-lisp-name = Frontal Lisp
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.
components:
- type: LightweightDrunk
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